use of cbit.vcell.client.desktop.TopLevelWindow in project vcell by virtualcell.
the class ClientMDIManager method updateDocumentID.
/**
* Insert the method's description here.
* Creation date: (5/28/2004 3:17:39 AM)
* @param oldID java.lang.String
* @param newID java.lang.String
*/
public void updateDocumentID(java.lang.String oldID, java.lang.String newID) {
Objects.requireNonNull(oldID);
Objects.requireNonNull(newID);
TopLevelWindow window = windowsHash.get(oldID);
TopLevelWindowManager manager = managersHash.get(oldID);
Objects.requireNonNull(window);
Objects.requireNonNull(manager);
windowsHash.remove(oldID);
managersHash.remove(oldID);
// Null pointer exception on VCellSupport 4/27/2016 -- added requireNonNull statements for localization of problem
windowsHash.put(newID, window);
managersHash.put(newID, manager);
setCanonicalTitle(newID);
}
use of cbit.vcell.client.desktop.TopLevelWindow in project vcell by virtualcell.
the class ClientMDIManager method getWindow.
/**
* lazily get window from hash; build recyclable window on demand
* @param key not null
* @return existing window, or new recyclable window, or null
*/
public TopLevelWindow getWindow(String key) {
TopLevelWindow w = windowsHash.get(key);
if (w != null) {
return w;
}
Creator c = creators.get(key);
if (c != null) {
c.create();
}
return windowsHash.get(key);
}
use of cbit.vcell.client.desktop.TopLevelWindow in project vcell by virtualcell.
the class ChildWindowManager method findChildWindowManager.
/**
* @param component not null
* @return ChildWindowManager
* @throws ProgrammingException if unable to find ChildWindowManager
*/
public static ChildWindowManager findChildWindowManager(Component component) {
ManagedChild mc = LWNamespace.findOwnerOfType(ManagedChild.class, component);
if (mc != null) {
return mc.getChildWindowManager();
}
if (LG.isDebugEnabled()) {
LG.debug(ExecutionTrace.justClassName(component) + " does not have ManagedChild parent");
}
TopLevelWindow dw = LWNamespace.findOwnerOfType(TopLevelWindow.class, component);
if (dw != null) {
return dw.getChildWindowManager();
}
throw new ProgrammingException("ChildWindowManager.findChildWindowManager(Component) could not find a ChildWindowManager for component: " + component.getName() + " which is a " + component.getClass().getCanonicalName());
}
use of cbit.vcell.client.desktop.TopLevelWindow in project vcell by virtualcell.
the class DocumentEditorSubPanel method addFieldDataMenuItem.
public static void addFieldDataMenuItem(Component parent, /*JTable*/
JPopupMenu addToThisPopup, int position) {
do {
System.out.println(parent.getClass().getName());
if (parent instanceof TopLevelWindow) {
ArrayList<Component> comps = new ArrayList<Component>();
BeanUtils.findComponent((Container) parent, GeometryViewer.class, comps);
TopLevelWindowManager topLevelWindowManager = ((TopLevelWindow) parent).getTopLevelWindowManager();
if (topLevelWindowManager instanceof BioModelWindowManager) {
final BioModelWindowManager bmwm = ((BioModelWindowManager) topLevelWindowManager);
JMenuItem fdJMenuItem = new JMenuItem("Add FieldData...");
fdJMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
bmwm.actionPerformed(new ActionEvent(comps.get(0), 0, GuiConstants.ACTIONCMD_EDITCURRENTSPATIAL_GEOMETRY) {
@Override
public String toString() {
return BioModelWindowManager.FIELD_DATA_FLAG;
}
});
}
});
addToThisPopup.insert(fdJMenuItem, position);
break;
}
}
parent = parent.getParent();
} while (parent != null);
}
use of cbit.vcell.client.desktop.TopLevelWindow in project vcell by virtualcell.
the class ClientMDIManager method getFocusedWindowManager.
public TopLevelWindowManager getFocusedWindowManager() {
Set<Entry<String, TopLevelWindow>> entrySet = getWindowsHash().entrySet();
Iterator<Entry<String, TopLevelWindow>> iter = entrySet.iterator();
TopLevelWindowManager showingTopLevelWindowManager = null;
TopLevelWindowManager firstTopLevelWindowManager = null;
while (iter.hasNext()) {
Entry<String, TopLevelWindow> entry = iter.next();
JFrame window = (JFrame) entry.getValue();
TopLevelWindowManager topLevelWindowManager = getManagersHash().get(entry.getKey());
if (window == KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow()) {
return topLevelWindowManager;
}
if (firstTopLevelWindowManager == null) {
firstTopLevelWindowManager = topLevelWindowManager;
}
if (window.isShowing() && showingTopLevelWindowManager == null) {
showingTopLevelWindowManager = topLevelWindowManager;
}
}
// if none has focus, pick one that are showing
if (showingTopLevelWindowManager != null) {
return showingTopLevelWindowManager;
}
// pick anything
return firstTopLevelWindowManager;
}
Aggregations