/** * Creates and adds a new {@link CWorkingArea} to this control. The area * is not made visible by this method. * @param uniqueId the unique id of the area * @return the new area */ public CWorkingArea createWorkingArea( String uniqueId ){ CWorkingArea area = new CWorkingArea( this, uniqueId ); addDockable( area ); addStation( area, true ); return area; }
/** * Creates and adds a new {@link CWorkingArea} to this control. The area * is not made visible by this method. * @param uniqueId the unique id of the area * @return the new area */ public CWorkingArea createWorkingArea( String uniqueId ){ CWorkingArea area = new CWorkingArea( this, uniqueId ); addDockable( area ); addStation( area, true ); return area; }
/** * Adds a new set of {@link CDockable}s to this grid. The {@link CDockable}s * are also added to the {@link CControl} of this <code>CGrid</code>. * @param x the x-coordinate of the dockables * @param y the y-coordinate of the dockables * @param width the width of the dockables * @param height the height of the dockables * @param dockables a list of {@link SingleCDockable}s and {@link MultipleCDockable}s. */ public void add( double x, double y, double width, double height, CDockable... dockables ){ Dockable[] intern = new Dockable[ dockables.length ]; for( int i = 0; i < intern.length; i++ ){ CDockable dockable = dockables[i]; if( control != null ){ if( dockable instanceof SingleCDockable ){ control.addDockable( (SingleCDockable)dockable ); } else if( dockable instanceof MultipleCDockable ){ if( dockable.getControl() == null ){ control.addDockable( (MultipleCDockable)dockable ); } } } intern[i] = dockable.intern(); } grid.addDockable( x, y, width, height, intern ); }
/** * Adds a new set of {@link CDockable}s to this grid. The {@link CDockable}s * are also added to the {@link CControl} of this <code>CGrid</code>. * @param x the x-coordinate of the dockables * @param y the y-coordinate of the dockables * @param width the width of the dockables * @param height the height of the dockables * @param dockables a list of {@link SingleCDockable}s and {@link MultipleCDockable}s. */ public void add( double x, double y, double width, double height, CDockable... dockables ){ Dockable[] intern = new Dockable[ dockables.length ]; for( int i = 0; i < intern.length; i++ ){ CDockable dockable = dockables[i]; if( control != null ){ if( dockable instanceof SingleCDockable ){ control.addDockable( (SingleCDockable)dockable ); } else if( dockable instanceof MultipleCDockable ){ if( dockable.getControl() == null ){ control.addDockable( (MultipleCDockable)dockable ); } } } intern[i] = dockable.intern(); } grid.addDockable( x, y, width, height, intern ); }
/** * Ensures that <code>this</code> is the parent of <code>dockable</code> * and adds <code>dockable</code> to the {@link CControl} which is associated * with this {@link CWorkingArea}. If there is no <code>CControl</code>, then * the <code>dockable</code> is added nowhere. * @param <F> the type of element to add * @param dockable the new element * @return <code>dockable</code> */ public <F extends SingleCDockable> F add( F dockable ){ dockable.setWorkingArea( this ); CControlAccess access = control(); if( access != null ){ access.getOwner().addDockable( dockable ); } return dockable; }
/** * Ensures that <code>this</code> is the parent of <code>dockable</code> * and adds <code>dockable</code> to the {@link CControl} which is associated * with this {@link CWorkingArea}. If there is no <code>CControl</code>, then * the <code>dockable</code> is added nowhere. * @param <F> the type of element to add * @param dockable the new element * @return <code>dockable</code> */ public <F extends MultipleCDockable> F add( F dockable ){ dockable.setWorkingArea( this ); CControlAccess access = control(); if( access != null ){ access.getOwner().addDockable( dockable ); } return dockable; }
/** * Create a new dockable corresponding to this layout * @param factoryId The factory id registerPanelFactory:factoryName * @param panelLayout */ @Override public void show(String factoryId, DockingPanelLayout panelLayout) { MultipleCDockableFactory<?, ?> factory = commonControl.getMultipleDockableFactory(factoryId); if (factory != null && factory instanceof InternalCommonFactory) { InternalCommonFactory iFactory = (InternalCommonFactory) factory; CustomMultipleCDockable dockItem = iFactory.read(new DockingPanelLayoutDecorator(panelLayout)); if (dockItem != null) { commonControl.addDockable(dockItem); } } } @Override
/** * Ensures that <code>this</code> is the parent of <code>dockable</code> * and adds <code>dockable</code> to the {@link CControl} which is associated * with this {@link CWorkingArea}. If there is no <code>CControl</code>, then * the <code>dockable</code> is added nowhere. * @param <F> the type of element to add * @param dockable the new element * @return <code>dockable</code> */ public <F extends MultipleCDockable> F add( F dockable ){ dockable.setWorkingArea( this ); CControlAccess access = control(); if( access != null ){ access.getOwner().addDockable( dockable ); } return dockable; }
/** * Ensures that <code>this</code> is the parent of <code>dockable</code> * and adds <code>dockable</code> to the {@link CControl} which is associated * with this {@link CWorkingArea}. If there is no <code>CControl</code>, then * the <code>dockable</code> is added nowhere. * @param <F> the type of element to add * @param dockable the new element * @return <code>dockable</code> */ public <F extends SingleCDockable> F add( F dockable ){ dockable.setWorkingArea( this ); CControlAccess access = control(); if( access != null ){ access.getOwner().addDockable( dockable ); } return dockable; }
addDockable( id, newDockable );
/** * Shows a view at the given location as child * of <code>root</code>. * @param frame the <code>DockingPanel</code> for which a view should be opened * @return Dockable unique ID */ private String show(DockingPanel frame){ //Create the DockingFrame item if(frame.getDockingParameters().getName().isEmpty()) { //If the dev doesn't define a name on the panel //We set the name as the name of the class frame.getDockingParameters().setName(frame.getClass().getCanonicalName()); } SingleCDockable dockItem = OrbisGISView.createSingle( frame, commonControl ); //Place the item in a dockstation String restrictedAreaName = frame.getDockingParameters().getDockingArea(); if(!restrictedAreaName.isEmpty()) { //This item is restricted to an area DockingArea dockArea = dockingAreas.get(restrictedAreaName); if(dockArea==null) { dockArea = new DockingArea(commonControl.createWorkingArea(restrictedAreaName)); dockArea.getWorkingArea().setVisible(true); dockingAreas.put(restrictedAreaName,dockArea); } dockItem.setWorkingArea(dockArea.getWorkingArea()); dockArea.getWorkingArea().add(dockItem); } commonControl.addDockable(dockItem); return dockItem.getUniqueId(); }
/** * Register <code>station</code> at the {@link CControl} in whose realm this factory works. * @param station the station to register * @param root whether to set the root flag or not */ protected void registerStation( CStation<?> station, boolean root ){ if( control.getStation( station.getUniqueId() ) != station ){ control.addStation( station, root ); } CDockable dockable = station.asDockable(); if( dockable != null ){ if( dockable instanceof SingleCDockable ){ SingleCDockable single = (SingleCDockable)dockable; if( control.getSingleDockable( single.getUniqueId() ) != single ){ control.addDockable( single ); } } } }
/** * Register <code>station</code> at the {@link CControl} in whose realm this factory works. * @param station the station to register * @param root whether to set the root flag or not */ protected void registerStation( CStation<?> station, boolean root ){ if( control.getStation( station.getUniqueId() ) != station ){ control.addStation( station, root ); } CDockable dockable = station.asDockable(); if( dockable != null ){ if( dockable instanceof SingleCDockable ){ SingleCDockable single = (SingleCDockable)dockable; if( control.getSingleDockable( single.getUniqueId() ) != single ){ control.addDockable( single ); } } } }
private ToolBarItem addToolbarItem(CAction cAction,Action action, CLocation defaultLocation) { String id = ActionTools.getMenuId(action); if(id==null || commonControl.getSingleDockable(id)!=null) { // Create a unique ID int inc=1; id = "action-"+inc; while(commonControl.getSingleDockable(id)!=null) { inc++; } String oldId=""; if(ActionTools.getMenuId(action)!=null) { oldId = ActionTools.getMenuId(action); } LOGGER.warn(I18N.tr("ToolBar item {0} is not unique, it has been renamed to {1}",oldId,id)); action.putValue(ActionTools.MENU_ID,id); } ToolBarItem toolbar = new ToolBarItem(id,cAction); commonControl.addDockable(toolbar); try { setLocation(toolbar,defaultLocation); } catch (RuntimeException ex) { LOGGER.error(ex.getLocalizedMessage(),ex); } return toolbar; }
private void checkAndReplace( Dockable dockable ){ DockStation station = dockable.getDockParent(); if( !(station instanceof ScreenDockStation) ) { return; } DockController controller = control.getController(); try { controller.freezeLayout(); ScreenDockStation screenDockStation = (ScreenDockStation)station; Dimension oldSize = dockable.getComponent().getSize(); ExternalizingCGridArea split = createGridArea(); control.addDockable( split ); station.replace( dockable, split.getStation() ); split.getStation().drop( dockable ); resizeDelayed( screenDockStation, split.getStation(), dockable, oldSize ); } finally { controller.meltLayout(); } }
private void checkAndReplace( Dockable dockable ){ DockStation station = dockable.getDockParent(); if( !(station instanceof ScreenDockStation) ) { return; } DockController controller = control.getController(); try { controller.freezeLayout(); ScreenDockStation screenDockStation = (ScreenDockStation)station; Dimension oldSize = dockable.getComponent().getSize(); ExternalizingCGridArea split = createGridArea(); control.addDockable( split ); station.replace( dockable, split.getStation() ); split.getStation().drop( dockable ); resizeDelayed( screenDockStation, split.getStation(), dockable, oldSize ); } finally { controller.meltLayout(); } }
control.addDockable( dockable ); if( layout.isAreaSet()){ if( layout.getArea() != null ){
control.addDockable( dockable ); if( layout.isAreaSet()){ if( layout.getArea() != null ){
@Override public SingleCDockable addView(CControl control, ViewDockWindow dock) { DefaultSingleCDockable dockable = createSingleDock(dock); CGridArea center = control.getContentArea().getCenterArea(); double x = getPerspectiveX(dock.getPosition()) / 200.0; double y = getPerspectiveY(dock.getPosition()) / 200.0; double w = getPerspectiveW(dock.getPosition()) / 200.0; double h = getPerspectiveH(dock.getPosition()) / 200.0; setupDefaultMinizedLocation(dockable, dock.getPosition()); dockable.setLocation(normalized(center).rectangle(x, y, w, h)); control.addDockable(dockable); dockable.setVisible(true); return dockable; }
SingleCDockable dockable = factory.createBackup( id ); if( dockable != null ){ addDockable( dockable ); if( entry.isShown() || !dockable.isCloseable() ){ dockable.setVisible( true );