/** * 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 ); } } } }
public DockTheme create( DockController controller ) { if( control.getController() != controller ){ throw new IllegalArgumentException( "the supplied controller does not match the CControl" ); } return create( control ); }
/** * Adds or removes all listeners from the {@link CControl}. * @param listening <code>true</code> if the listeners are to be * added, <code>false</code> if they have to be removed */ private void setListening( boolean listening ){ if( this.control != null ){ if( listening ){ control.addControlListener( listener ); for( int i = 0, n = control.getCDockableCount(); i<n; i++ ) connect( control.getCDockable( i ) ); } else{ this.control.removeControlListener( listener ); for( int i = 0, n = this.control.getCDockableCount(); i<n; i++ ) disconnect( control.getCDockable( i ) ); } } }
/** * 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; }
private void removeDocks(CControl control, Map<SingleCDockable, ViewDockWindow> docks) { for (DockWindow dock : docks.values()) { String id = dock.getId(); control.removeDockable(control.getSingleDockable(id)); } }
/** * Creates the new manager * @param owner the window used as parent for all dialogs */ public DockingManagerImpl( JFrame owner){ this.owner = owner; // Method bibliothek.gui.dock.util.DockUtilities.checkLayoutLocked(DockUtilities.java:723) // Throw a RuntimeException: java.lang.Error: Trampoline must not be defined by the bootstrap classloader DockUtilities.disableCheckLayoutLocked(); commonControl = new CControl(owner); commonControl.addControlListener(new DockingListener()); dockableMenuTracker = new SingleCDockableListMenuPiece( commonControl); //Retrieve the Docking Frames Preferencies preferences = new OrbisGISPreferenceTreeModel( commonControl,PathCombiner.APPEND); commonControl.setPreferenceModel(preferences); //DEFAULT property of a view // commonControl.getController().getProperties().set( PropertyKey.DOCK_STATION_TITLE, I18N.tr("Docked Window") ); commonControl.getController().getProperties().set( PropertyKey.DOCK_STATION_ICON, OrbisGISIcon.getIcon("orbisgis") ); commonControl.getController().getThemeManager().setBackgroundPaint(ThemeManager.BACKGROUND_PAINT + ".station.toolbar.container",new ToolBarBackGround()); commonControl.putProperty( ToolbarDockStation.SIDE_GAP, 2 ); commonControl.putProperty( ToolbarDockStation.GAP, 2 ); //StackDockStation will contain all instances of ReservedDockStation area = new CToolbarContentArea( commonControl, "base" ); commonControl.addStationContainer( area ); owner.add(area); } /**
MultipleCDockable oldDockable = controlAccess.getOwner().getMultipleDockable( id ); controlAccess.getOwner().replace( oldDockable, dockable ); controlAccess.getOwner().addDockable( id, dockable ); CStation<?> station = controlAccess.getOwner().getStation( areaId ); if( station != null ){ if( station.isWorkingArea() ){ for( int i = 0, n = controlAccess.getOwner().getCDockableCount(); i<n; i++ ){ CDockable check = controlAccess.getOwner().getCDockable( i ); CStation<?> checkStation = check.asStation();
/** * 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 ); }
/** * Creates a new model. * @param control the control whose settings this model represents */ public CLayoutPreferenceModel( CControl control ){ super( control.getController() ); add( tabPlacement = new TabPlacementPreference( control.intern().getDockProperties(), new Path( "dock.layout.tabplacement" ))); add( tabContentFilter = new TabContentFilterPreference( control.intern().getDockProperties(), new Path( "dock.layout.tabcontentfilter" ))); add( theme = new ThemePreference( control.intern().getDockProperties(), control.getThemes() )); }
control.setRootWindow(new DirectWindowProvider(frame)); destroyOnClose(control); ThemeMap themes = control.getThemes(); themes.select(ThemeMap.KEY_ECLIPSE_THEME); control.getController().getProperties().set(EclipseTheme.PAINT_ICONS_WHEN_DESELECTED, true); control.putProperty(ScreenDockStation.BOUNDARY_RESTRICTION, BoundaryRestriction.HARD); control.putProperty(EclipseTheme.THEME_CONNECTOR, new HidingEclipseThemeConnector(control)); ColorManager colors = control.getController().getColors(); control.addFocusListener(selectionListener);
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(); } }
/** * Removes this station from its parent and from the {@link CControl} if it no longer has any children, * and if the layout is not currently frozen. */ private void autoRemove(){ if( !autoRemove ){ return; } CControl control = getControl(); if( control != null ){ DockRegister register = control.getController().getRegister(); if( register.isStalled() ){ register.addDockRegisterListener( new DelayedAutoRemove() ); } else{ SplitDockStation station = getStation(); if( station.getDockableCount() == 0 ){ DockStation parent = station.getDockParent(); if( parent != null ){ parent.drag( station ); } control.removeDockable( this ); control.removeStation( this ); } } } }
if( control.getSingleDockable( id ) != null ){ return true; if( control.getSingleDockableFactory( id ) != null ){ return true; if( control.getMissingStrategy().shouldStoreSingle( id ) ){ return true; if( control.getMultipleDockable( id ) != null ){ return true; if( control.getMissingStrategy().shouldStoreMulti( id )){ return true;
removeDockable( oldDockable ); addDockable( id, newDockable );
JFrame frame = Controller.getInstance().getFrame(); control = new CControl(frame); frame.add(control.getContentArea()); ConsoleManager.getInstance().getPanel()); control.addDockable(sld); control.addDockable(legend); control.addDockable(symbol); control.addDockable(map); control.addDockable(dataSource); control.addDockable(vendorOption); control.addDockable(console); control.addDockable(dockablePlugin); grid.add(0, 0, 1, 4, dockablePlugin); CContentArea content = control.getContentArea(); content.deploy(grid);
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; }
@OnAwt @Override public Dock createDock(Window frame) { WindowProvider provider; if (frame == null) { provider = new NullWindowProvider(); } else { provider = new DirectWindowProvider(frame); } this.control = new CControl(provider); this.workingArea = control.createWorkingArea(WORK_AREA_ID); applyLayout(defaultLayoutTask); control.addControlListener(controlListener); return this; }
control.addDockable( dockable ); if( layout.isAreaSet()){ if( layout.getArea() != null ){ CStation<?> station = control.getStation( layout.getArea() ); if( station == null ){ DelayedWorkingAreaSetter setter = new DelayedWorkingAreaSetter( layout.getArea(), dockable, control );
@Override public void closeDockable() { GuiExecutor.instance().execute(() -> { UIManager.DOCKING_CONTROL.addVetoFocusListener(UIManager.DOCKING_VETO_FOCUS); UIManager.DOCKING_CONTROL.removeDockable(dockable); UIManager.DOCKING_CONTROL.removeVetoFocusListener(UIManager.DOCKING_VETO_FOCUS); }); }