Search in sources :

Example 1 with TopLevelWindow

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);
}
Also used : TopLevelWindow(cbit.vcell.client.desktop.TopLevelWindow)

Example 2 with TopLevelWindow

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);
}
Also used : TopLevelWindow(cbit.vcell.client.desktop.TopLevelWindow)

Example 3 with TopLevelWindow

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());
}
Also used : ProgrammingException(org.vcell.util.ProgrammingException) TopLevelWindow(cbit.vcell.client.desktop.TopLevelWindow)

Example 4 with TopLevelWindow

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);
}
Also used : BioModelWindowManager(cbit.vcell.client.BioModelWindowManager) ActionListener(java.awt.event.ActionListener) TopLevelWindowManager(cbit.vcell.client.TopLevelWindowManager) ActionEvent(java.awt.event.ActionEvent) ArrayList(java.util.ArrayList) Component(java.awt.Component) JMenuItem(javax.swing.JMenuItem) TopLevelWindow(cbit.vcell.client.desktop.TopLevelWindow)

Example 5 with TopLevelWindow

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;
}
Also used : Entry(java.util.Map.Entry) JFrame(javax.swing.JFrame) TopLevelWindow(cbit.vcell.client.desktop.TopLevelWindow)

Aggregations

TopLevelWindow (cbit.vcell.client.desktop.TopLevelWindow)5 BioModelWindowManager (cbit.vcell.client.BioModelWindowManager)1 TopLevelWindowManager (cbit.vcell.client.TopLevelWindowManager)1 Component (java.awt.Component)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 ArrayList (java.util.ArrayList)1 Entry (java.util.Map.Entry)1 JFrame (javax.swing.JFrame)1 JMenuItem (javax.swing.JMenuItem)1 ProgrammingException (org.vcell.util.ProgrammingException)1