| 1 | //  Copyright 2004-2007 Jean-Francois Poilpret | 
| 2 | // | 
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); | 
| 4 | // you may not use this file except in compliance with the License. | 
| 5 | // You may obtain a copy of the License at | 
| 6 | // | 
| 7 | //     http://www.apache.org/licenses/LICENSE-2.0 | 
| 8 | // | 
| 9 | // Unless required by applicable law or agreed to in writing, software | 
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, | 
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
| 12 | // See the License for the specific language governing permissions and | 
| 13 | // limitations under the License. | 
| 14 |   | 
| 15 | package net.sourceforge.hiveboard.docking; | 
| 16 |   | 
| 17 | import org.flexdock.docking.DockingManager; | 
| 18 | import org.flexdock.view.View; | 
| 19 |   | 
| 20 | import net.sourceforge.hiveboard.Board; | 
| 21 |   | 
| 22 | public final class ViewHelper | 
| 23 | { | 
| 24 |         private ViewHelper() | 
| 25 |         { | 
| 26 |         } | 
| 27 |          | 
| 28 |         static public boolean        isOpenBoardAreaView(String id) | 
| 29 |         { | 
| 30 |                 return id.startsWith(Views.BOARD_AREA.name()); | 
| 31 |         } | 
| 32 |          | 
| 33 |         static public String        getBoardAreaViewId(int idBoard) | 
| 34 |         { | 
| 35 |                 return Views.BOARD_AREA.name() + idBoard; | 
| 36 |         } | 
| 37 |          | 
| 38 |         static public String        getBoardAreaViewId(Board board) | 
| 39 |         { | 
| 40 |                 return Views.BOARD_AREA.name() + board.getId(); | 
| 41 |         } | 
| 42 |   | 
| 43 |         static public View                findDrawingArea(int idBoard) | 
| 44 |         { | 
| 45 |                 return (View) DockingManager.getDockable(getBoardAreaViewId(idBoard)); | 
| 46 |         } | 
| 47 |   | 
| 48 |         static public View                findDrawingArea(Board board) | 
| 49 |         { | 
| 50 |                 return (View) DockingManager.getDockable(getBoardAreaViewId(board)); | 
| 51 |         } | 
| 52 | } |