private static String createUniqueIdentifier( CControl control ){ int count = 0; String id; do{ id = UNIQUE_ID_PREFIX + System.currentTimeMillis() + "." + count; count++; }while( control.getSingleDockable( id ) != null ); return id; }
if( control.getSingleDockable( id ) != null ){ return true;
private static String createUniqueIdentifier( CControl control ){ int count = 0; String id; do{ id = UNIQUE_ID_PREFIX + System.currentTimeMillis() + "." + count; count++; }while( control.getSingleDockable( id ) != null ); return id; }
if( control.getSingleDockable( id ) != null ){ return true;
private void removeDocks(CControl control, Map<SingleCDockable, ViewDockWindow> docks) { for (DockWindow dock : docks.values()) { String id = dock.getId(); control.removeDockable(control.getSingleDockable(id)); } }
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; }
/** * 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(); } /**
/** * 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 ); } } } }