Ejemplo n.º 1
0
 /**
  * Returns the advanced preferences panel. Differs from the {@link #buildAdvancedPanel()} in that
  * a panel isn't created, unless {@code forceBuild} is {@code true}.
  *
  * @param forceBuild Always rebuilds the advanced panel if {@code true}.
  * @return Panel containing the startup options.
  */
 public JPanel getAdvancedPanel(final boolean forceBuild) {
   if (forceBuild || ADVANCED_PANEL == null) {
     OptionMaster.getInstance().readStartup();
     ADVANCED_PANEL = buildAdvancedPanel();
   }
   return ADVANCED_PANEL;
 }
Ejemplo n.º 2
0
 /** Saves the preference changes. */
 protected void handleOk() {
   OptionMaster.getInstance().writeStartup();
   System.exit(0);
 }
Ejemplo n.º 3
0
  /**
   * Creates and returns the advanced preferences panel.
   *
   * @return Panel with all of the various startup options.
   */
  private JPanel buildAdvancedPanel() {
    OptionMaster optMaster = OptionMaster.getInstance();
    MemoryOption heapSize = optMaster.getMemoryOption("HEAP_SIZE");
    BooleanOption jogl = optMaster.getBooleanOption("JOGL_TOGL");
    BooleanOption use3d = optMaster.getBooleanOption("USE_3DSTUFF");
    BooleanOption defaultBundle = optMaster.getBooleanOption("DEFAULT_LAYOUT");
    BooleanOption useDirect3d = optMaster.getBooleanOption("D3DREND");
    BooleanOption useCmsCollector = optMaster.getBooleanOption("USE_CMSGC");
    BooleanOption useNpot = optMaster.getBooleanOption("USE_NPOT");
    BooleanOption useGeometryByRef = optMaster.getBooleanOption("USE_GEOBYREF");
    BooleanOption useImageByRef = optMaster.getBooleanOption("USE_IMAGEBYREF");
    DirectoryOption startupBundle = optMaster.getDirectoryOption("STARTUP_BUNDLE");
    //        TextOption jvmArgs = optMaster.getTextOption("JVM_ARGS");
    LoggerLevelOption logLevel = optMaster.getLoggerLevelOption("LOG_LEVEL");

    JPanel startupPanel = new JPanel();
    startupPanel.setBorder(BorderFactory.createTitledBorder("Startup Options"));

    // Build the memory panel
    JPanel heapPanel =
        McVGuiUtils.makeLabeledComponent(heapSize.getLabel() + ":", heapSize.getComponent());

    // Build the 3D panel
    JCheckBox use3dCheckBox = use3d.getComponent();
    use3dCheckBox.setText(use3d.getLabel());
    final JCheckBox joglCheckBox = jogl.getComponent();
    joglCheckBox.setText(jogl.getLabel());
    final JCheckBox direct3dBox = useDirect3d.getComponent();
    direct3dBox.setText(useDirect3d.getLabel());

    JPanel internalPanel = McVGuiUtils.topCenterBottom(use3dCheckBox, joglCheckBox, direct3dBox);
    JPanel j3dPanel = McVGuiUtils.makeLabeledComponent("3D:", internalPanel);

    // Build the bundle panel
    JPanel startupBundlePanel = startupBundle.getComponent();
    JCheckBox defaultBundleCheckBox = defaultBundle.getComponent();
    defaultBundleCheckBox.setText(defaultBundle.getLabel());
    JPanel bundlePanel =
        McVGuiUtils.makeLabeledComponent(
            startupBundle.getLabel() + ":",
            McVGuiUtils.topBottom(
                startupBundlePanel, defaultBundleCheckBox, McVGuiUtils.Prefer.TOP));

    JCheckBox useCmsCollectorCheckBox = useCmsCollector.getComponent();
    useCmsCollectorCheckBox.setText(useCmsCollector.getLabel());

    JCheckBox useGeometryByRefCheckBox = useGeometryByRef.getComponent();
    useGeometryByRefCheckBox.setText(useGeometryByRef.getLabel());

    JCheckBox useImageByRefCheckBox = useImageByRef.getComponent();
    useImageByRefCheckBox.setText(useImageByRef.getLabel());

    JCheckBox useNpotCheckBox = useNpot.getComponent();
    useNpotCheckBox.setText(useNpot.getLabel());

    JComboBox logLevelComboBox = logLevel.getComponent();

    JPanel logLevelPanel =
        McVGuiUtils.makeLabeledComponent(logLevel.getLabel() + ":", logLevelComboBox);

    JPanel miscPanel = McVGuiUtils.makeLabeledComponent("Misc:", useCmsCollectorCheckBox);

    Component[] visadComponents =
        new Component[] {useGeometryByRefCheckBox, useImageByRefCheckBox, useNpotCheckBox};

    JPanel visadPanel =
        McVGuiUtils.makeLabeledComponent("VisAD:", McVGuiUtils.vertical(visadComponents));

    javax.swing.GroupLayout panelLayout = new javax.swing.GroupLayout(startupPanel);
    startupPanel.setLayout(panelLayout);
    panelLayout.setHorizontalGroup(
        panelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(heapPanel)
            .addComponent(j3dPanel)
            .addComponent(bundlePanel)
            .addComponent(visadPanel)
            .addComponent(miscPanel)
            .addComponent(logLevelPanel));
    panelLayout.setVerticalGroup(
        panelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                panelLayout
                    .createSequentialGroup()
                    .addComponent(
                        heapPanel,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(
                        bundlePanel,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(
                        j3dPanel,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(
                        visadPanel,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(
                        logLevelPanel,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(
                        miscPanel,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)));
    return startupPanel;
  }
Ejemplo n.º 4
0
 /**
  * Saves the changes to the preferences and quits. Unlike the other button handling methods, this
  * one is public. This was done so that the advanced preferences (within McIDAS-V) can force an
  * update to the startup prefs.
  */
 public void handleApply() {
   OptionMaster.getInstance().writeStartup();
 }