Example usage for java.awt Window setVisible

List of usage examples for java.awt Window setVisible

Introduction

In this page you can find the example usage for java.awt Window setVisible.

Prototype

public void setVisible(boolean b) 

Source Link

Document

Shows or hides this Window depending on the value of parameter b .

Usage

From source file:de.codesourcery.eve.skills.ui.components.impl.MarketPriceEditorComponent.java

protected void populatePopupMenuFor(int clickedColumn, List<TableEntry> entries) {

    if (log.isDebugEnabled()) {
        log.debug("populatePopupMenuFor(): clicked_col = " + clickedColumn + " , selected = " + entries);
    }//from  w ww . j  a  va  2  s  .  co m

    boolean gotOutdatedBuyPrice = false;
    boolean gotOutdatedSellPrice = false;
    boolean gotUnknownBuyPrices = false;
    boolean gotUnknownSellPrices = false;
    boolean gotUserProvidedPrices = false;

    final Map<Long, InventoryType> updateBuyPrices = new HashMap<Long, InventoryType>();
    final Map<Long, InventoryType> updateSellPrices = new HashMap<Long, InventoryType>();

    for (TableEntry e : entries) {

        boolean stale = isStale(e.getBuyPrice()); // method is NULL-safe

        if (!e.hasBuyPrice() || stale) {

            if (stale) {
                if (log.isDebugEnabled()) {
                    log.debug("populatePopupMenuFor(): stale buy price > " + e);
                }
                gotOutdatedBuyPrice = true;
            }

            if (!e.hasBuyPrice()) {
                if (log.isDebugEnabled()) {
                    log.debug("populatePopupMenuFor(): Lacking buy price for " + e.getItemName());
                }
                gotUnknownBuyPrices = true;
            }

            updateBuyPrices.put(e.getItem().getId(), e.getItem());
        } else if (e.getBuyPrice().isUserProvided()) {
            updateBuyPrices.put(e.getItem().getId(), e.getItem());
            gotUserProvidedPrices = true;
        }

        stale = isStale(e.getSellPrice()); // method is NULL-safe

        if (!e.hasSellPrice() || stale) {

            if (stale) {
                if (log.isDebugEnabled()) {
                    log.debug("populatePopupMenuFor(): stale sell price > " + e);
                }
                gotOutdatedSellPrice = true;
            }

            if (!e.hasSellPrice()) {
                if (log.isDebugEnabled()) {
                    log.debug("populatePopupMenuFor(): Lacking sell price for " + e.getItemName());
                }
                gotUnknownSellPrices = true;
            }

            updateSellPrices.put(e.getItem().getId(), e.getItem());
        } else if (e.getSellPrice().isUserProvided()) {
            updateSellPrices.put(e.getItem().getId(), e.getItem());
            gotUserProvidedPrices = true;
        }

    }

    if (log.isDebugEnabled()) {
        log.debug("populatePopupMenuFor(): gotOutdatedBuyPrice=" + gotOutdatedBuyPrice
                + " , gotOutdatedSellPrice = " + gotOutdatedSellPrice + " , gotUnknownBuyPrices = "
                + gotUnknownBuyPrices + " , gotUnknownSellPrices = " + gotUnknownSellPrices);
    }

    /*
     * Create and join update request entries.
     */

    final Map<Long, PriceInfoUpdateRequest> requests = new HashMap<Long, PriceInfoUpdateRequest>();

    for (InventoryType item : updateBuyPrices.values()) {

        PriceInfoUpdateRequest existing = requests.get(item.getId());

        if (existing == null) {
            existing = new PriceInfoUpdateRequest();
            existing.item = item;
            existing.type = PriceInfo.Type.BUY;
            requests.put(item.getId(), existing);
        }
    }

    for (InventoryType item : updateSellPrices.values()) {

        PriceInfoUpdateRequest existing = requests.get(item.getId());

        if (existing == null) {
            existing = new PriceInfoUpdateRequest();
            existing.item = item;
            existing.type = PriceInfo.Type.SELL;
            requests.put(item.getId(), existing);
        } else {
            if (existing.type == PriceInfo.Type.BUY) {
                existing.type = PriceInfo.Type.ANY;
            }
        }
    }

    log.debug("populatePopupMenuFor(): " + " buy prices requiring update: " + updateBuyPrices.size()
            + " , sell prices requiring update: " + updateSellPrices.size());

    final IMenuAction updateOutdatedBuyPrices = new IMenuAction() {

        @Override
        public void run() throws PriceInfoUnavailableException {
            updateMultiplePrices(requests, PriceInfo.Type.BUY, UpdateMode.UPDATE_OUTDATED);
        }
    };

    final IMenuAction updateMissingBuyPrices = new IMenuAction() {

        @Override
        public void run() throws Exception {
            updateMultiplePrices(requests, PriceInfo.Type.BUY, UpdateMode.UPDATE_MISSING);
        }
    };

    final IMenuAction updateMissingOrStaleBuyPrices = new IMenuAction() {

        @Override
        public void run() throws PriceInfoUnavailableException {
            updateMultiplePrices(requests, PriceInfo.Type.BUY, UpdateMode.UPDATE_OUTDATED);
        }
    };

    final IMenuAction updateMissingOrStaleSellPrices = new IMenuAction() {

        @Override
        public void run() throws PriceInfoUnavailableException {
            updateMultiplePrices(requests, PriceInfo.Type.SELL, UpdateMode.UPDATE_MISSING_OR_OUTDATED);
        }
    };

    final IMenuAction updateOutdatedSellPrices = new IMenuAction() {

        @Override
        public void run() throws PriceInfoUnavailableException {
            updateMultiplePrices(requests, PriceInfo.Type.SELL, UpdateMode.UPDATE_OUTDATED);
        }
    };

    final IMenuAction updateMissingSellPrices = new IMenuAction() {

        @Override
        public void run() throws PriceInfoUnavailableException {
            updateMultiplePrices(requests, PriceInfo.Type.SELL, UpdateMode.UPDATE_MISSING);
        }
    };

    final IMenuAction updateUserPricesAction = new IMenuAction() {

        @Override
        public void run() throws PriceInfoUnavailableException {
            updateMultiplePrices(requests, PriceInfo.Type.ANY, UpdateMode.UPDATE_USERPROVIDED);
        }
    };

    final InventoryType singleItem = entries.size() == 1 ? entries.get(0).getItem() : null;

    if (!updateBuyPrices.isEmpty()) {

        String label;
        if (singleItem != null) {
            label = "Fetch missing buy price for " + singleItem.getName();
        } else {
            label = "Fetch missing buy prices";
        }

        popupMenu.add(createMenuItem(label, updateMissingBuyPrices, gotUnknownBuyPrices));

        if (singleItem != null) {
            label = "Update outdated buy price for " + singleItem.getName();
        } else {
            label = "Update outdated buy prices";
        }
        popupMenu.add(createMenuItem(label, updateOutdatedBuyPrices, gotOutdatedBuyPrice));

        if (singleItem == null) {
            popupMenu.add(createMenuItem("Update all missing/outdated buy prices",
                    updateMissingOrStaleBuyPrices, gotUnknownBuyPrices | gotOutdatedBuyPrice));
        }
    }

    if (!updateSellPrices.isEmpty()) {

        String label;
        if (singleItem != null) {
            label = "Fetch missing sell price for " + singleItem.getName();
        } else {
            label = "Fetch missing sell prices";
        }

        popupMenu.add(createMenuItem(label, updateMissingSellPrices, gotUnknownSellPrices));

        if (singleItem != null) {
            label = "Update outdated sell price for " + singleItem.getName();
        } else {
            label = "Update outdated sell prices";
        }
        popupMenu.add(createMenuItem(label, updateOutdatedSellPrices, gotOutdatedSellPrice));

        if (singleItem == null) {
            popupMenu.add(createMenuItem("Update all missing/outdated sell prices",
                    updateMissingOrStaleSellPrices, gotUnknownSellPrices | gotOutdatedSellPrice));
        }
    }

    if (gotUserProvidedPrices) {

        if (popupMenu.getComponentCount() > 0) {
            popupMenu.addSeparator();
        }

        final String label = "Update user-provided prices from EVE-central";
        popupMenu.add(createMenuItem(label, updateUserPricesAction, true));

    }

    if (singleItem != null) {
        if (popupMenu.getComponentCount() > 0) {
            popupMenu.addSeparator();
        }

        final IMenuAction action = new IMenuAction() {

            @Override
            public void run() {

                final PriceHistoryComponent comp = new PriceHistoryComponent(singleItem, getDefaultRegion(),
                        PriceInfo.Type.ANY);

                comp.setModal(true);

                final Window window = ComponentWrapper.wrapComponent("Price history of " + singleItem.getName(),
                        comp);

                window.setVisible(true);
            }
        };

        final String label = "Plot price history";
        popupMenu.add(createMenuItem(label, action, true));
    }
}

From source file:edu.ku.brc.specify.BackupAndRestoreApp.java

/**
 * Restarts the app with a new or old database and user name and creates the core app UI.
 * @param window the login window/*from   w  w w  .  ja  v a  2s  . c o  m*/
 * @param databaseNameArg the database name
 * @param userNameArg the user name
 * @param startOver tells the AppContext to start over
 * @param firstTime indicates this is the first time in the application and it should create all the UI for the core app
 */
public void restartApp(final Window window, final String databaseNameArg, final String userNameArg,
        final boolean startOver, final boolean firstTime) {
    log.debug("restartApp"); //$NON-NLS-1$
    if (dbLoginPanel != null) {
        dbLoginPanel.getStatusBar().setText(getResourceString("Specify.INITIALIZING_APP")); //$NON-NLS-1$
    }

    if (firstTime) {
        GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()
                .getDefaultConfiguration();

        initialize(gc);

        topFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
        UIRegistry.register(UIRegistry.FRAME, topFrame);

    }

    if (window != null) {
        window.setVisible(false);
    }

    showApp();

    statusField.setText(DBConnection.getInstance().getDatabaseName());

    if (dbLoginPanel != null) {
        dbLoginPanel.getWindow().setVisible(false);
    }
}

From source file:de.codesourcery.eve.skills.ui.components.impl.MarketPriceEditorComponent.java

private void importMarketLogs(File[] inputFiles) {
    if (ArrayUtils.isEmpty(inputFiles)) {
        return;/*from w w  w  .j  a v  a2s  .c om*/
    }

    for (final File current : inputFiles) {
        final MarketLogFile logFile;
        try {
            logFile = new EveMarketLogParser(dataModelProvider.getStaticDataModel(), systemClock)
                    .parseFile(current);
        } catch (Exception e) {
            log.error("importMarketLogs(): Failed to parse " + current, e);
            displayError("Failed to parse logfile " + current.getAbsolutePath() + ": " + e.getMessage());
            continue;
        }

        // make sure the user is aware when importing data from a file
        // other than the current default region /
        // is warned when importing data that conflicts
        // with already existing data.
        if (!reallyImportFile(logFile) || logFile.isEmpty()) {
            log.debug("importMarketLogs(): Skipping file " + current.getAbsoluteFile()
                    + " [ empty / user choice ]");
            continue;
        }

        final ImportMarketLogFileComponent comp = new ImportMarketLogFileComponent(logFile);

        comp.setModal(true);

        final Window window = ComponentWrapper.wrapComponent(current.getName(), comp);

        if (window == null) { // component may refuse to display
                              // because the file holds data for a region other
                              // from the current default region and the
                              // user chose to cancel the operation
            continue;
        }

        window.setVisible(true);

        if (comp.wasCancelled()) {
            continue; // user skipped this file
        }

        log.info("importMarketLogs(): Importing data from file " + current.getAbsolutePath());
        this.marketDataProvider.store(comp.getPriceInfosForImport());
    }
}

From source file:corelyzer.ui.CorelyzerApp.java

@Override
public void windowIconified(final WindowEvent e) {
    // minimize the GL windows
    for (int i = 0; i < windowVec.size(); i++) {
        Window jf;
        jf = windowVec.elementAt(i);//from w  w  w .j  a v  a  2  s.com
        if (jf != null) {
            jf.setVisible(false);
        }
    }

    // minimize the tool window
    toolFrame.setVisible(false);

    // iconify all plugin frames
    controller.iconifyAllPlugins();

    // 2/28/2012 brg: Unclear why this works, but it does. Possibly because
    // plug-in frame is associated with another thread?
    // to avoid missing application in taskbar under Windows
    if (!MAC_OS_X && usePluginUI) {
        getDefaultMainFrame().setVisible(true);
        getDefaultMainFrame().setExtendedState(Frame.ICONIFIED);
    }
}

From source file:corelyzer.ui.CorelyzerApp.java

@Override
public void windowDeiconified(final WindowEvent e) {
    // resume the GL windows
    for (int i = 0; i < windowVec.size(); i++) {
        Window jf;
        jf = windowVec.elementAt(i);//  www. java 2s .co m
        if (jf != null) {
            jf.setVisible(true);
        }
    }

    // resume the tool window
    toolFrame.setVisible(true);

    // resume all plugin frame
    controller.deiconifyAllPlugins();

    // 2/28/2012 brg: Unclear why this works, but it does. Possibly because
    // plug-in mainFrame is associated with another thread?
    // to restore workaround in iconifying window
    if (!MAC_OS_X && usePluginUI) {
        getDefaultMainFrame().setVisible(false);
        getMainFrame().setExtendedState(Frame.NORMAL);
    }

    getMainFrame().setVisible(toolFrame.isAppFrameSelected());

    CorelyzerApp.getApp().suspendPaletteVisibilityManager(false);
}

From source file:edu.ku.brc.ui.UIHelper.java

/**
 * Center and make the window visible//from  ww w .  j  a  v  a  2s .c  o m
 * @param window the window to center
 * @param width sets the dialog to this width (can be null)
 * @param height sets the dialog to this height (can be null)
 */
public static void centerAndShow(java.awt.Window window, final Integer width, final Integer height) {
    centerWindow(window, width, height);

    window.setVisible(true);
}

From source file:edu.ku.brc.ui.UIHelper.java

/**
 * Center and make the window visible//from   www .  j a v a  2  s . com
 * @param window the window to center
 */
public static void positionAndShow(java.awt.Window window) {
    if (System.getProperty("os.name").equals("Mac OS X")) {
        window.setLocation(0, 0);
        window.setVisible(true);

    } else {
        centerAndShow(window);
    }

}

From source file:corelyzer.ui.CorelyzerApp.java

/**
 * Called by the DisplayConfiguration dialog class to begin the creation of
 * the OpenGL windows given previously set parameters of rows and columns of
 * monitors, and the properties of each monitor
 *///from   w w  w  .  java 2 s .  c o  m
public void createGLWindows() {
    int nrows = preferences.numberOfRows;
    int ncols = preferences.numberOfColumns;
    int tileWidth = preferences.screenWidth;
    int tileHeight = preferences.screenHeight;

    float borderLeft = preferences.borderLeft;
    float borderRight = preferences.borderRight;
    float borderDown = preferences.borderDown;
    float borderUp = preferences.borderUp;

    float screenDpiX = preferences.dpix;
    float screenDpiY = preferences.dpiy;

    int row_offset, column_offset;

    try {
        row_offset = Integer.parseInt(preferences.getProperty("display.row_offset"));
        column_offset = Integer.parseInt(preferences.getProperty("display.column_offset"));
    } catch (NumberFormatException e) {
        row_offset = 0;
        column_offset = 0;
    }

    // brg 1/17/2012: In Windows Vista and 7, Z-order issues with tool windows and the main canvas
    // are abundant and beyond my abilities to fix. We discovered a workaround - reduce the
    // canvas size by a single row/column of pixels, and everything will work properly. Enforce
    // this programatically until we find a fix.
    final String osName = System.getProperty("os.name").toLowerCase();
    final boolean isWindowsCompositingOS = (osName.equals("windows 7") || osName.equals("windows vista"));
    if (isWindowsCompositingOS)
        tileHeight--; // remove one row

    SceneGraph.setCanvasRowcAndColumn(nrows, ncols);

    sharedContext = null;
    int r, c, canvasNum = 0;
    for (r = 0; r < nrows; r++) {
        for (c = 0; c < ncols; c++) {
            // Allow alpha GL context
            GLProfile profile = GLProfile.getDefault();
            GLCapabilities cap = new GLCapabilities(profile);//GLProfile.getDefault() );
            cap.setAlphaBits(8);
            // System.out.println("---> GL " + cap.toString());

            /*
             * if(MAC_OS_X) { win = new JFrame(); ((JFrame)
             * win).setUndecorated(true); } else { win = new JWindow(); }
             */

            Window win = new JFrame();
            ((JFrame) win).setUndecorated(true);

            win.setLocation(c * tileWidth + column_offset, r * tileHeight + row_offset);

            // brg 3/16/2012: Once we have a shared context, it must be passed in the constructor.
            // The setContext() method doesn't work. (JOGL bug?)
            GLCanvas cvs = null;
            if (sharedContext != null)
                cvs = new GLCanvas(cap, null, sharedContext, null);
            else
                cvs = new GLCanvas(cap);

            win.add(cvs);
            win.addWindowFocusListener(new WindowFocusListener() {
                public void windowGainedFocus(final WindowEvent event) {
                    // do nothing
                }

                public void windowLostFocus(final WindowEvent event) {
                    String isCanvasAlwaysBelow = preferences.getProperty("ui.canvas.alwaysBelow");

                    boolean b;
                    try {
                        b = Boolean.parseBoolean(isCanvasAlwaysBelow);
                    } catch (Exception e) {
                        b = true;
                    }

                    if (b) {
                        GLWindowsToBack();
                    }
                }
            });

            canvasNum++;

            windowVec.add(win);

            final float px = tileWidth * c + (borderLeft + borderRight) * screenDpiX * c;
            final float py = tileHeight * r + (borderUp + borderDown) * screenDpiY * r;
            final int id = SceneGraph.genCanvas(px, py, tileWidth, tileHeight, screenDpiX, screenDpiY);

            CorelyzerGLCanvas cglc = new CorelyzerGLCanvas(cvs, tileWidth, tileHeight, px, py, id);
            canvasVec.add(cglc);

            // if it's the bottom most screen or the first column,
            // then mark to draw depth scale
            if (c == 0) {
                SceneGraph.setCanvasFirstColumn(cglc.getCanvasID(), true);
            }

            if (r == nrows - 1) {
                SceneGraph.setCanvasBottomRow(cglc.getCanvasID(), true);
            }

            win.pack();
            win.setVisible(true);

            // brg 3/16/2012: In JOGL2, a GLCanvas's context is only usable after the
            // canvas has been made visible. Grab the context from the first canvas
            // and share with subsequent canvases at construction-time.
            if (sharedContext == null)
                sharedContext = cvs.getContext();

            win.toBack();
        }
    }

    createTrackMenuItem.setEnabled(true);
    loadDataMenuItem.setEnabled(true);
    loadStateFileMenuItem.setEnabled(true);

    isGLInited = true;
}

From source file:com.xilinx.ultrascale.gui.MainScreen_video.java

private EmbeddedMediaPlayerComponent create(final Window frame, final int i) {

    final EmbeddedMediaPlayerComponent mediaPlayerComponent = new EmbeddedMediaPlayerComponent() {
        protected String[] onGetMediaPlayerFactoryArgs() {
            if (i == 1) {
                return VLC_ARGS;
            } else {
                return null;
            }//ww w.j  a  v a  2  s  .com
        }

    };

    // You *must* do this...
    mediaPlayerComponent.getMediaPlayer().setEnableKeyInputHandling(false);
    mediaPlayerComponent.getMediaPlayer().setEnableMouseInputHandling(false);

    /*mediaPlayerComponent.getVideoSurface().addMouseListener(new MouseAdapter() {
     @Override
     public void mouseClicked(MouseEvent event) {
     if (event.getClickCount() == 2) {
     if (screen.getFullScreenWindow() == null) {
     screen.setFullScreenWindow(frame);
     mediaPlayerComponent.getMediaPlayer().setAspectRatio("16:10");
                        
     } else {
     screen.setFullScreenWindow(null);
     mediaPlayerComponent.getMediaPlayer().setAspectRatio(aspectRatio);
     }
     }
     }
     });*/
    frame.add(mediaPlayerComponent);

    frame.setVisible(false);
    mediaPlayerComponent.getMediaPlayer().setAspectRatio(aspectRatio);
    return mediaPlayerComponent;
}

From source file:edu.ku.brc.specify.Specify.java

/**
 * Restarts the app with a new or old database and user name and creates the core app UI.
 * @param window the login window// w  w w  . j  a  v a2  s  .c om
 * @param databaseNameArg the database name
 * @param userNameArg the user name
 * @param startOver tells the AppContext to start over
 * @param firstTime indicates this is the first time in the app and it should create all the UI for the core app
 */
public void restartApp(final Window window, final String databaseNameArg, final String userNameArg,
        final boolean startOver, final boolean firstTime) {
    log.debug("restartApp"); //$NON-NLS-1$
    if (dbLoginPanel != null) {
        dbLoginPanel.getStatusBar().setText(getResourceString("Specify.INITIALIZING_APP")); //$NON-NLS-1$
    }

    if (!firstTime) {
        checkAndSendStats();
    }

    UIRegistry.dumpPaths();

    try {
        AppPreferences.getLocalPrefs().flush();
    } catch (BackingStoreException ex) {
    }

    AppPreferences.shutdownRemotePrefs();
    AppPreferences.shutdownPrefs();
    AppPreferences.setConnectedToDB(false);

    // Moved here because context needs to be set before loading prefs, we need to know the SpecifyUser
    //
    // NOTE: AppPreferences.startup(); is called inside setContext's implementation.
    //
    AppContextMgr.reset();
    AppContextMgr.CONTEXT_STATUS status = AppContextMgr.getInstance().setContext(databaseNameArg, userNameArg,
            startOver, firstTime, !firstTime);
    if (status == AppContextMgr.CONTEXT_STATUS.OK) {
        // XXX Temporary Fix!
        SpecifyUser spUser = AppContextMgr.getInstance().getClassObject(SpecifyUser.class);

        if (spUser != null) {
            String dbPassword = spUser.getPassword();

            if (StringUtils.isNotEmpty(dbPassword) && (!StringUtils.isAlphanumeric(dbPassword)
                    || !UIHelper.isAllCaps(dbPassword) || dbPassword.length() < 25)) {
                String encryptedPassword = Encryption.encrypt(spUser.getPassword(), spUser.getPassword());
                spUser.setPassword(encryptedPassword);
                DataProviderSessionIFace session = DataProviderFactory.getInstance().createSession();
                try {
                    session.beginTransaction();
                    session.saveOrUpdate(session.merge(spUser));
                    session.commit();

                } catch (Exception ex) {
                    session.rollback();
                    ex.printStackTrace();
                } finally {
                    session.close();
                }
            }
        }
    }

    UsageTracker.setUserInfo(databaseNameArg, userNameArg);

    SpecifyAppPrefs.initialPrefs();

    // Check Stats (this is mostly for the first time in.
    AppPreferences appPrefs = AppPreferences.getRemote();
    Boolean canSendStats = appPrefs.getBoolean(sendStatsPrefName, null); //$NON-NLS-1$
    Boolean canSendISAStats = appPrefs.getBoolean(sendISAStatsPrefName, null); //$NON-NLS-1$

    // Make sure we have the proper defaults
    if (canSendStats == null) {
        canSendStats = true;
        appPrefs.putBoolean("usage_tracking.send_stats", canSendStats); //$NON-NLS-1$
    }

    if (canSendISAStats == null) {
        canSendISAStats = true;
        appPrefs.putBoolean(sendISAStatsPrefName, canSendISAStats); //$NON-NLS-1$
    }

    if (status == AppContextMgr.CONTEXT_STATUS.OK) {
        // XXX Get the current locale from prefs PREF

        if (AppContextMgr.getInstance().getClassObject(Discipline.class) == null) {
            return;
        }

        // "false" means that it should use any cached values it can find to automatically initialize itself
        if (firstTime) {
            GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment()
                    .getDefaultScreenDevice().getDefaultConfiguration();

            initialize(gc);

            topFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
            UIRegistry.register(UIRegistry.FRAME, topFrame);
        } else {
            SubPaneMgr.getInstance().closeAll();
        }

        preInitializePrefs();

        initStartUpPanels(databaseNameArg, userNameArg);

        AppPrefsCache.addChangeListener("ui.formatting.scrdateformat", UIFieldFormatterMgr.getInstance());

        if (changeCollectionMenuItem != null) {
            changeCollectionMenuItem.setEnabled(
                    ((SpecifyAppContextMgr) AppContextMgr.getInstance()).getNumOfCollectionsForUser() > 1);
        }

        if (window != null) {
            window.setVisible(false);
        }

        // General DB Fixes independent of a release.
        if (!AppPreferences.getGlobalPrefs().getBoolean("CollectingEventsAndAttrsMaint1", false)) {
            // Temp Code to Fix issues with Release 6.0.9 and below
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    CollectingEventsAndAttrsMaint dbMaint = new CollectingEventsAndAttrsMaint();
                    dbMaint.performMaint();
                }
            });
        }

        /*if (!AppPreferences.getGlobalPrefs().getBoolean("FixAgentToDisciplinesV2", false))
        {
        // Temp Code to Fix issues with Release 6.0.9 and below
        SwingUtilities.invokeLater(new Runnable() 
        {
            @Override
            public void run()
            {
                FixDBAfterLogin fixer = new FixDBAfterLogin();
                fixer.fixAgentToDisciplines();
            }
        });
        }*/

        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                performManualDBUdpatesAfterLogin();
            }
        });

        DataBuilder.mergeStandardGroups(AppContextMgr.getInstance().getClassObject(Collection.class));

    } else if (status == AppContextMgr.CONTEXT_STATUS.Error) {

        if (dbLoginPanel != null) {
            dbLoginPanel.getWindow().setVisible(false);
        }

        if (AppContextMgr.getInstance().getClassObject(Collection.class) == null) {

            // TODO This is really bad because there is a Database Login with no Specify login
            JOptionPane.showMessageDialog(null, getResourceString("Specify.LOGIN_USER_MISMATCH"), //$NON-NLS-1$
                    getResourceString("Specify.LOGIN_USER_MISMATCH_TITLE"), //$NON-NLS-1$
                    JOptionPane.ERROR_MESSAGE);
            System.exit(0);
        }

    }

    CommandDispatcher.dispatch(new CommandAction("App", firstTime ? "StartUp" : "AppRestart", null)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    TaskMgr.requestInitalContext();

    if (!UIRegistry.isRelease()) {
        DebugLoggerDialog dialog = new DebugLoggerDialog(null);
        dialog.configureLoggers();
    }

    showApp();

    if (dbLoginPanel != null) {
        dbLoginPanel.getWindow().setVisible(false);
        dbLoginPanel = null;
    }
    setDatabaseNameAndCollection();
}