@Override public void close() { GuiExecutor.instance().execute(() -> { UIManager.VIEWER_PLUGINS.remove(ViewerPlugin.this); UIManager.DOCKING_CONTROL.removeDockable(dockable); }); }
private void removeDocks(CControl control, Map<SingleCDockable, ViewDockWindow> docks) { for (DockWindow dock : docks.values()) { String id = dock.getId(); control.removeDockable(control.getSingleDockable(id)); } }
/** * Removes the {@link SingleCDockable} with the identifier <code>id</code>. * @param id the id of the element to remove * @return <code>true</code> if the element was removed, <code>false</code> * otherwise */ public boolean removeSingleDockable( String id ){ for( SingleCDockable dockable : register.getSingleDockables() ){ if( dockable.getUniqueId().equals( id )){ return removeDockable( dockable ); } } return false; }
/** * Removes the {@link SingleCDockable} with the identifier <code>id</code>. * This has the same effect as calling {@link #remove(SingleCDockable)}. * @param id the id of the element to remove * @return <code>true</code> if the element was removed, <code>false</code> * otherwise */ public boolean removeSingleDockable( String id ){ for( SingleCDockable dockable : register.getSingleDockables() ){ if( dockable.getUniqueId().equals( id )){ return removeDockable( dockable ); } } return false; }
@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 ); } } } } });
@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); }); }
@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 ); } } } } });
/** * Removes the {@link MultipleCDockableFactory} with identifier <code>id</code> * from this control. As a side effect all {@link MultipleCDockable}s which * use that factory are removed as well. Nothing happens if there is no * factory registered with <code>id</code>. * @param id the identifier of the factory to remove */ public void removeMultipleDockableFactory( String id ){ CommonMultipleDockableFactory factory = register.removeCommonMultipleDockableFactory( id ); if( factory != null ){ frontend.unregisterFactory( factory ); List<MultipleCDockable> toRemove = new ArrayList<MultipleCDockable>(); for( MultipleCDockable dockable : register.getMultipleDockables() ){ if( dockable.getFactory() == factory.getFactory() ){ toRemove.add( dockable ); } } for( MultipleCDockable dockable : toRemove ){ removeDockable( dockable ); } } }
/** * Removes the {@link MultipleCDockableFactory} with identifier <code>id</code> * from this control. As a side effect all {@link MultipleCDockable}s which * use that factory are removed as well. Nothing happens if there is no * factory registered with <code>id</code>. * @param id the identifier of the factory to remove */ public void removeMultipleDockableFactory( String id ){ CommonMultipleDockableFactory factory = register.removeCommonMultipleDockableFactory( id ); if( factory != null ){ frontend.unregisterFactory( factory ); List<MultipleCDockable> toRemove = new ArrayList<MultipleCDockable>(); for( MultipleCDockable dockable : register.getMultipleDockables() ){ if( dockable.getFactory() == factory.getFactory() ){ toRemove.add( dockable ); } } for( MultipleCDockable dockable : toRemove ){ removeDockable( dockable ); } } }
removeDockable( oldDockable ); addDockable( id, newDockable );
removeDockable( oldDockable ); addDockable( id, newDockable );
/** * 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 ); } } } }
/** * 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 ); } } } }