/** * Removes a dockable from this control. The dockable is made invisible. * @param dockable the element to remove */ public void removeDockable( MultipleCDockable dockable ){ if( dockable == null ) throw new NullPointerException( "dockable must not be null" ); if( dockable.getControl() == this ){ dockable.setVisible( false ); frontend.remove( dockable.intern() ); register.removeMultipleDockable( dockable ); dockable.setControlAccess( null ); for( CControlListener listener : listeners() ) listener.removed( CControl.this, dockable ); } }
/** * Gets a list of all {@link MultipleCDockable}s that are registered at this * control and whose {@link MultipleCDockable#getFactory()} method returns * <code>factory</code>. * @param factory the factory to look out for * @return the list of dockables, never <code>null</code> but might be empty */ public List<MultipleCDockable> listMultipleDockables( MultipleCDockableFactory<?, ?> factory ){ List<MultipleCDockable> result = new ArrayList<MultipleCDockable>(); for( MultipleCDockable dockable : multiDockables ){ if( dockable.getFactory() == factory ){ result.add( dockable ); } } return result; }
/** * First {@link #add(MultipleCDockable) adds} <code>dockable</code> to the * {@link CControl} of this {@link CWorkingArea}, then makes it visible at a good position. A good position * is {@link CLocation#aside()} the latest focused {@link Dockable} that is child of this station. <br> * This method does <b>not</b> force a focus transfer, clients need to call {@link AbstractCDockable#toFront()} * if the require a focus switch to <code>dockable</code>. * @param dockable the element to show * @return <code>dockable</code> */ public <F extends MultipleCDockable> F show( F dockable ){ add( dockable ); dockable.setLocationsAsideFocused(); dockable.setVisible( true ); return dockable; }
String factory = access.getFactoryId( dockable.getFactory() ); if( factory == null ){ throw new IllegalStateException( "the factory for a MultipleCDockable is not registered: " + dockable.getFactory() ); if( dockable.getControl() != null ) throw new IllegalStateException( "dockable is already part of a control" ); dockable.setControlAccess( access ); accesses.get( dockable ).setUniqueId( uniqueId ); frontend.addDockable( uniqueId, dockable.intern() ); frontend.setHideable( dockable.intern(), true );
if( station != null ){ if( station.isWorkingArea() ){ dockable.setWorkingArea( station ); if( checkStation.getUniqueId().equals( areaId )){ dockable.setWorkingArea( checkStation ); break; return dockable.intern();
public CommonDockable layout( MultipleCDockable layout, PlaceholderStrategy placeholders ){ return layout.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 MultipleCDockable> F add( F dockable ){ dockable.setWorkingArea( this ); CControlAccess access = control(); if( access != null ){ access.getOwner().addDockable( dockable ); } return dockable; }
@Override public void dockableUnregistered( DockController controller, Dockable dockable ) { if( dockable instanceof CommonDockable ){ CDockable cdock = ((CommonDockable)dockable).getDockable(); CDockableAccess access = accesses.get( cdock ); if( access != null ){ access.informVisibility( false ); } for( CControlListener listener : listeners() ) listener.closed( CControl.this, cdock ); if( cdock instanceof MultipleCDockable ){ MultipleCDockable multiple = (MultipleCDockable)cdock; if( multiple.isRemoveOnClose() ){ removeDockable( multiple ); } } } } });
throw new IllegalArgumentException( "new dockable must not be null" ); if( oldDockable.getControl() != this ) throw new IllegalArgumentException( "old dockable not registered at this CControl" ); if( newDockable.getControl() != null ) throw new IllegalArgumentException( "new dockable alread registered at some CControl" );
@Override @OnAwt public void addEditorDock(EditorDockWindow dock) { MultipleCDockable dockable = currentLayout.addEditor(workingArea, dock); dock.setDockable(dockable); editorDocks.put(dockable, dock); dockable.addFocusListener(editorsFocusListener); }
/** * Fetch the ccontrol panel list to find the provided panelName * @param ccontrol * @param panelName * @return The panel location */ private static CLocation getPanelLocation(CControl ccontrol, String panelName) { SingleCDockable dockable = ccontrol.getSingleDockable(panelName); if(dockable!=null) { return dockable.getBaseLocation(); } MultipleCDockable mDockable = ccontrol.getMultipleDockable(panelName); if(mDockable!=null) { return mDockable.getBaseLocation(); } return CLocation.base(); } /**
String factory = access.getFactoryId( dockable.getFactory() ); if( factory == null ){ throw new IllegalStateException( "the factory for a MultipleCDockable is not registered: " + dockable.getFactory() ); if( dockable.getControl() != null ) throw new IllegalStateException( "dockable is already part of a control" ); dockable.setControlAccess( access ); accesses.get( dockable ).setUniqueId( uniqueId ); frontend.addDockable( uniqueId, dockable.intern() ); frontend.setHideable( dockable.intern(), true );
if( station != null ){ if( station.isWorkingArea() ){ dockable.setWorkingArea( station ); if( checkStation.getUniqueId().equals( areaId )){ dockable.setWorkingArea( checkStation ); break; return dockable.intern();
public CommonDockable layout( MultipleCDockable layout, PlaceholderStrategy placeholders ){ return layout.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 MultipleCDockable> F add( F dockable ){ dockable.setWorkingArea( this ); CControlAccess access = control(); if( access != null ){ access.getOwner().addDockable( dockable ); } return dockable; }
@Override public void dockableUnregistered( DockController controller, Dockable dockable ) { if( dockable instanceof CommonDockable ){ CDockable cdock = ((CommonDockable)dockable).getDockable(); CDockableAccess access = accesses.get( cdock ); if( access != null ){ access.informVisibility( false ); } for( CControlListener listener : listeners() ) listener.closed( CControl.this, cdock ); if( cdock instanceof MultipleCDockable ){ MultipleCDockable multiple = (MultipleCDockable)cdock; if( multiple.isRemoveOnClose() ){ removeDockable( multiple ); } } } } });
throw new IllegalArgumentException( "new dockable must not be null" ); if( oldDockable.getControl() != this ) throw new IllegalArgumentException( "old dockable not registered at this CControl" ); if( newDockable.getControl() != null ) throw new IllegalArgumentException( "new dockable alread registered at some CControl" );
/** * Removes a dockable from this control. The dockable is made invisible. * @param dockable the element to remove */ public void removeDockable( MultipleCDockable dockable ){ if( dockable == null ) throw new NullPointerException( "dockable must not be null" ); if( dockable.getControl() == this ){ dockable.setVisible( false ); frontend.remove( dockable.intern() ); register.removeMultipleDockable( dockable ); dockable.setControlAccess( null ); for( CControlListener listener : listeners() ) listener.removed( CControl.this, dockable ); } }
/** * First {@link #add(MultipleCDockable) adds} <code>dockable</code> to the * {@link CControl} of this {@link CWorkingArea}, then makes it visible at a good position. A good position * is {@link CLocation#aside()} the latest focused {@link Dockable} that is child of this station. <br> * This method does <b>not</b> force a focus transfer, clients need to call {@link AbstractCDockable#toFront()} * if the require a focus switch to <code>dockable</code>. * @param dockable the element to show * @return <code>dockable</code> */ public <F extends MultipleCDockable> F show( F dockable ){ add( dockable ); dockable.setLocationsAsideFocused(); dockable.setVisible( true ); return dockable; }
/** * Gets a list of all {@link MultipleCDockable}s that are registered at this * control and whose {@link MultipleCDockable#getFactory()} method returns * <code>factory</code>. * @param factory the factory to look out for * @return the list of dockables, never <code>null</code> but might be empty */ public List<MultipleCDockable> listMultipleDockables( MultipleCDockableFactory<?, ?> factory ){ List<MultipleCDockable> result = new ArrayList<MultipleCDockable>(); for( MultipleCDockable dockable : multiDockables ){ if( dockable.getFactory() == factory ){ result.add( dockable ); } } return result; }