Esempio n. 1
0
  private void onOriginal() {
    final JFileChooser fc = new JFileChooser();
    fc.setCurrentDirectory(filePath);

    fc.setMultiSelectionEnabled(false);
    final int returnVal = fc.showOpenDialog(panel);
    filePath = fc.getCurrentDirectory();

    if (returnVal == JFileChooser.APPROVE_OPTION) {
      originalFilepath = fc.getSelectedFile();

      if (fc.getName(originalFilepath).endsWith(".txt")) {
        if (originalFilepath.exists()) {
          originalDocFilename = fc.getName(originalFilepath);
          fieldOriginal.setText(originalFilepath.getPath());
          labelTranslation.setEnabled(true);
          buttonTranslation.setEnabled(true);
          comboTranslationEncoding.setEnabled(true);
          labelTranslationLang.setEnabled(true);
          comboTranslationLang.setEnabled(true);
        } else {
          JOptionPane.showMessageDialog(
              panel,
              getString("MSG.ERROR.FILE_NOTFOUND"),
              getString("MSG.ERROR"),
              JOptionPane.ERROR_MESSAGE);
          fieldOriginal.setText("");
        }
      }
      //  ToDo: remember filename by preferences
    }
  }
        @NotNull
        @Override
        public Component getTreeCellRendererComponent(
            @NotNull JTree tree,
            Object value,
            boolean selected,
            boolean expanded,
            boolean leaf,
            int row,
            boolean hasFocus) {
          if (value instanceof MyTreeNode) {
            MyTreeNode node = (MyTreeNode) value;
            myLabel.setText(getRenamedTitle(node.getKey().field.getName(), node.getText()));
            myLabel.setFont(
                myLabel
                    .getFont()
                    .deriveFont(node.getKey().groupName == null ? Font.BOLD : Font.PLAIN));
            myLabel.setEnabled(node.isEnabled());
          } else {
            myLabel.setText(getRenamedTitle(value.toString(), value.toString()));
            myLabel.setFont(myLabel.getFont().deriveFont(Font.BOLD));
            myLabel.setEnabled(true);
          }

          Color foreground =
              selected ? UIUtil.getTableSelectionForeground() : UIUtil.getTableForeground();
          myLabel.setForeground(foreground);

          return myLabel;
        }
Esempio n. 3
0
 private void updateTotals() {
   boolean used = processAssignmentList.size() > 0;
   machineLabel.setEnabled(used);
   for (MrResource resource : resourceList) {
     JTextField resourceField = resourceFieldMap.get(resource);
     long maximumCapacity;
     long safetyCapacity;
     if (machine != null) {
       MrMachineCapacity machineCapacity = machine.getMachineCapacity(resource);
       maximumCapacity = machineCapacity.getMaximumCapacity();
       safetyCapacity = machineCapacity.getSafetyCapacity();
     } else {
       maximumCapacity = 0L;
       safetyCapacity = 0L;
     }
     long usedTotal = 0L;
     for (MrProcessAssignment processAssignment : processAssignmentList) {
       usedTotal += processAssignment.getProcess().getProcessRequirement(resource).getUsage();
     }
     resourceField.setText(usedTotal + " / " + maximumCapacity);
     resourceField.setForeground(
         usedTotal > maximumCapacity
             ? TangoColorFactory.SCARLET_3
             : (usedTotal > safetyCapacity ? TangoColorFactory.ORANGE_3 : Color.BLACK));
     resourceField.setEnabled(used);
   }
   numberOfProcessesLabel.setText(processAssignmentList.size() + " processes ");
   numberOfProcessesLabel.setEnabled(used);
 }
  /*
   * The state of one of the following items has changed:
   * 1. bUseFTPCheckB check box: Enable or disable FTP setting fields given the state of the "Use FTP" checkbox
   * 2. autoFlushRB radio button: Enable or disable the Flush interval combo box
   */
  @Override
  public void itemStateChanged(ItemEvent eventI) {

    Object source = eventI.getSource();

    if (source == null) {
      return;
    } else if (source == bUseFTPCheckB) {
      boolean bChecked = bUseFTPCheckB.isSelected();
      ftpHostLabel.setEnabled(bChecked);
      ftpHostTF.setEnabled(bChecked);
      ftpUserLabel.setEnabled(bChecked);
      ftpUserTF.setEnabled(bChecked);
      ftpPasswordLabel.setEnabled(bChecked);
      ftpPasswordTF.setEnabled(bChecked);
    } else if (source == autoFlushRB) {
      if (autoFlushRB.isSelected()) {
        flushIntervalLabel.setEnabled(true);
        flushIntervalComboB.setEnabled(true);
      } else {
        flushIntervalLabel.setEnabled(false);
        flushIntervalComboB.setEnabled(false);
      }
    }
  }
  /** algorithm performed */
  public void algorithmPerformed(AlgorithmBase algorithm) {
    if (alg.isCompleted()) {
      alg = null;
      // if OKButton is not null, then the rest are not null
      // we don't want to do these if this algoritm was done via a script
      if (OKButton != null) {
        OKButton.setEnabled(true);
        dwiPathBrowseButton.setEnabled(true);
        gradFileRadio.setEnabled(true);
        bmtxtFileRadio.setEnabled(true);
        performRegistrationCheckbox.setEnabled(true);
        registrationSettingsButton.setEnabled(true);
        dwiLabel.setEnabled(true);
        dicomB0VolumeLabel.setEnabled(true);
        // interleavedCheckbox.setEnabled(true);
        if (gradFileRadio.isSelected()) {
          gradientFileBrowseButton.setEnabled(true);
        } else {
          bmtxtFileBrowseButton.setEnabled(true);
        }
        setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
        outputTextArea.append("*** End DTI Sorting Process *** \n");
      }

      // insertScriptLine();
      Preferences.debug("*** End DTI Sorting Process *** \n", Preferences.DEBUG_ALGORITHM);
      // System.out.println("*** End DTI Sorting Process *** \n");
    }
  }
 protected void onPropertyChange(
     JXHeader h, String propertyName, Object oldValue, final Object newValue) {
   if ("title".equals(propertyName)) {
     titleLabel.setText(h.getTitle());
   } else if ("description".equals(propertyName)) {
     descriptionPane.setText(h.getDescription());
   } else if ("icon".equals(propertyName)) {
     imagePanel.setIcon(h.getIcon());
   } else if ("enabled".equals(propertyName)) {
     boolean enabled = h.isEnabled();
     titleLabel.setEnabled(enabled);
     descriptionPane.setEnabled(enabled);
     imagePanel.setEnabled(enabled);
   } else if ("titleFont".equals(propertyName)) {
     titleLabel.setFont((Font) newValue);
   } else if ("descriptionFont".equals(propertyName)) {
     descriptionPane.setFont((Font) newValue);
   } else if ("titleForeground".equals(propertyName)) {
     titleLabel.setForeground((Color) newValue);
   } else if ("descriptionForeground".equals(propertyName)) {
     descriptionPane.setForeground((Color) newValue);
   } else if ("iconPosition".equals(propertyName)) {
     resetLayout(h);
   }
 }
  /**
   * Closes dialog box when the OK button is pressed and calls the algorithm.
   *
   * @param event Event that triggers function.
   */
  public void actionPerformed(ActionEvent event) {
    String command = event.getActionCommand();
    Object source = event.getSource();

    if (command.equals("OK")) {

      if (setVariables()) {
        callAlgorithm();
      }
    } else if (command.equals("Script")) {
      callAlgorithm();
    } else if (command.equals("Cancel")) {
      dispose();
    } else if (source == blueSmoothBox) {
      if (blueSmoothBox.isSelected()) {
        interpolationLabel.setEnabled(true);
        interpolationText.setEnabled(true);
      } else {
        interpolationLabel.setEnabled(false);
        interpolationText.setEnabled(false);
      }
    } else {
      super.actionPerformed(event);
    }
  }
  /**
   * Closes dialog box when the OK button is pressed, sets variables and calls algorithm.
   *
   * @param event Event that triggers function.
   */
  public void actionPerformed(ActionEvent event) {
    String command = event.getActionCommand();
    Object source = event.getSource();

    if (command.equals("OK")) {

      if (setVariables()) {
        callAlgorithm();
      }
    } else if (command.equals("Cancel")) {
      dispose();
    } else if (command.equals("Help")) {
      // MipavUtil.showHelp("");
    } else if (source.equals(doRicianCheckBox)) {
      if (doRicianCheckBox.isSelected()) {
        labelDegree.setEnabled(true);
        textDegree.setEnabled(true);
      } else {
        labelDegree.setEnabled(false);
        textDegree.setEnabled(false);
      }
    } else { // else if (source == thresholdCheckbox)
      super.actionPerformed(event);
    }
  }
 private void enableNumericIterativeOptions(boolean b) {
   startLabel.setEnabled(b);
   autoIDStart.setEnabled(b);
   endLabel.setEnabled(b);
   autoIDEnd.setEnabled(b);
   saveIterativeIds.setEnabled(b);
 }
    public void updateCombo() {
      boolean enableChooser = myOverrideLAFFonts.isSelected();

      myFontCombo.setEnabled(enableChooser);
      myFontSizeCombo.setEnabled(enableChooser);
      myFontNameLabel.setEnabled(enableChooser);
      myFontSizeLabel.setEnabled(enableChooser);
    }
 private void updateCompilerSection() {
   boolean b = !myFSCRadioButton.isSelected();
   myCompilerLibraryLabel.setEnabled(b);
   myCompilerLibrary.setEnabled(b);
   myMaximumHeapSizeLabel.setEnabled(b);
   myMaximumHeapSize.setEnabled(b);
   myVmParametersLabel.setEnabled(b);
   myVmParameters.setEnabled(b);
 }
Esempio n. 12
0
 public void enableRunAndImport(boolean enable) {
   chkExec.setEnabled(enable);
   lblFileRpt.setEnabled(enable);
   txtFileRpt.setEnabled(enable);
   btnFileRpt.setEnabled(enable);
   chkImport.setEnabled(enable);
   lblResultName.setEnabled(enable);
   txtResultName.setEnabled(enable);
 }
  private void enableProxyAuthentication(boolean enabled) {
    myProxyPasswordLabel.setEnabled(enabled);
    myProxyLoginLabel.setEnabled(enabled);

    myProxyLoginTextField.setEnabled(enabled);
    myProxyPasswordTextField.setEnabled(enabled);

    myRememberProxyPasswordCheckBox.setEnabled(enabled);
  }
Esempio n. 14
0
  public boolean close() {
    closeLabel.setEnabled(false); // provide feedback to the user that we received their click

    boolean result = super.close();
    if (result) {
      closeLabel.setEnabled(true);
    }

    return result;
  }
Esempio n. 15
0
 /** Update button enable/disable state according enableCheckBox. */
 private void updateButtonsState() {
   sipProtocolCheckBox.setEnabled(enableCheckBox.isSelected());
   jabberProtocolCheckBox.setEnabled(enableCheckBox.isSelected());
   rtpProtocolCheckBox.setEnabled(enableCheckBox.isSelected());
   ice4jProtocolCheckBox.setEnabled(enableCheckBox.isSelected());
   fileCountField.setEnabled(enableCheckBox.isSelected());
   fileSizeField.setEnabled(enableCheckBox.isSelected());
   fileSizeLabel.setEnabled(enableCheckBox.isSelected());
   fileCountLabel.setEnabled(enableCheckBox.isSelected());
 }
Esempio n. 16
0
 public void setEnabled(boolean enabled) {
   productNameLabel.setEnabled(enabled);
   productNameTextField.setEnabled(enabled);
   saveToFileCheckBox.setEnabled(enabled);
   productDirLabel.setEnabled(enabled);
   productDirTextField.setEnabled(enabled);
   productDirChooserButton.setEnabled(enabled);
   formatNameComboBox.setEnabled(enabled);
   openInAppCheckBox.setEnabled(enabled);
 }
  public void guardar_lista_raya() {
    if (JOptionPane.showConfirmDialog(null, "¿Desea Guardar la Lista de Raya?") == 0) {
      new Progress_Bar_Generar().setVisible(true);
      lblAuditoria.setEnabled(false);
      lblFinanzas.setEnabled(false);
      btnGenerarLista.setEnabled(false);

    } else {
      return;
    }
  }
Esempio n. 18
0
 protected void setBrowsePanelVisable() {
   if (selectButtonGroup.getSelection() == fromRadioButton.getModel()) {
     dirLabel.setEnabled(true);
     dirTextField.setEnabled(true);
     browseButton.setEnabled(true);
   } else {
     dirLabel.setEnabled(false);
     dirTextField.setEnabled(false);
     browseButton.setEnabled(false);
   }
 }
 private void setToDefault(JTextField lFunction, JLabel edit, JLabel cancel, boolean isToDefault) {
   if (!isToDefault) {
     lFunction.requestFocus();
     lFunction.setOpaque(true);
     lFunction.setEnabled(true);
     edit.setText("Update");
     cancel.setEnabled(true);
   } else {
     lFunction.setOpaque(false);
     lFunction.setEnabled(false);
     edit.setText("Edit");
     cancel.setEnabled(false);
   }
 }
Esempio n. 20
0
 @Override
 public void setEnabled(boolean b) {
   populationLabel.setEnabled(b);
   populationSpinner.setEnabled(b);
   elitismLabel.setEnabled(b);
   elitismSpinner.setEnabled(b);
   generationsLabel.setEnabled(b);
   generationsSpinner.setEnabled(b);
   selectionLabel.setEnabled(b);
   selectionCombo.setEnabled(b);
   crossoverCheckbox.setEnabled(b);
   mutationCheckbox.setEnabled(b);
   distributedCheckbox.setEnabled(b);
   super.setEnabled(b);
 }
Esempio n. 21
0
  public SizeScaleDialog(
      final JFrame frame,
      final String dimensionName,
      boolean autoRange,
      double fromValue,
      double toValue,
      final double fromWidth,
      final double toWidth) {
    this.frame = frame;

    this.dimensionName = dimensionName;

    autoScaleCheck = new JCheckBox("Auto-scale range");
    autoScaleCheck.setSelected(autoRange);

    fromLabel = new JLabel("Range from:");
    fromNumberField = new RealNumberField();
    fromNumberField.setColumns(10);
    fromNumberField.setValue(fromValue);

    toLabel = new JLabel("to:");
    toNumberField = new RealNumberField();
    toNumberField.setColumns(10);
    toNumberField.setValue(toValue);

    fromLabel.setEnabled(false);
    fromNumberField.setEnabled(false);
    toLabel.setEnabled(false);
    toNumberField.setEnabled(false);

    fromSizeField = new RealNumberField();
    fromSizeField.setColumns(4);
    fromSizeField.setValue(fromWidth);
    toSizeField = new RealNumberField();
    toSizeField.setColumns(4);
    toSizeField.setValue(toWidth);

    autoScaleCheck.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            boolean enabled = !autoScaleCheck.isSelected();
            fromLabel.setEnabled(enabled);
            fromNumberField.setEnabled(enabled);
            toLabel.setEnabled(enabled);
            toNumberField.setEnabled(enabled);
          }
        });
  }
Esempio n. 22
0
  private JPanel initComponents() {
    // pane with null layout
    JPanel contentPane = new JPanel(null);
    contentPane.setBackground(new Color(200, 200, 200));

    initButton1();
    initButton2();
    initButton3();
    initButton4();
    initButton5();
    initButton6();
    initButton7();
    initButton8();
    // initButton9();

    JLabel label1 = new JLabel();
    label1.setBounds(115, 45, 200, 50);
    label1.setBackground(new Color(214, 217, 223));
    label1.setForeground(new Color(0, 0, 0));
    label1.setEnabled(true);
    label1.setFont(new Font("SansSerif", 1, 20));
    label1.setText("MENU");
    label1.setVisible(true);

    JLabel label2 = new JLabel();
    label2.setBounds(125, 10, 50, 50);
    label2.setBackground(new Color(214, 217, 223));
    label2.setForeground(new Color(0, 0, 0));
    label2.setEnabled(true);
    label2.setFont(new Font("SansSerif", 1, 14));
    label2.setText("PT_SP");
    label2.setVisible(true);

    // adding components to contentPane panel
    contentPane.add(button1);
    contentPane.add(button2);
    contentPane.add(button3);
    contentPane.add(button4);
    contentPane.add(button5);
    contentPane.add(button6);
    contentPane.add(button7);
    contentPane.add(button8);
    // contentPane.add(button9);
    contentPane.add(label1);
    contentPane.add(label2);

    return contentPane;
  }
 /**
  * Resets the status of this dialog work for switch of modes between dir and file selection.
  *
  * @author Fangping, 08/23/2010
  */
 private void resetActiveAreas() {
   srcFilesDirField.setText("");
   enableOutputDirPanel(false);
   selectedFileCountLabel.setText("");
   selectedFileCountLabel.setEnabled(false);
   finishButton.setEnabled(false);
 }
  /** Loads the default settings from Preferences to set up the dialog. */
  public void legacyLoadDefaults() {
    String defaultsString = Preferences.getDialogDefaults(getDialogName());

    if ((defaultsString != null) && (newImage != null)) {

      try {
        StringTokenizer st = new StringTokenizer(defaultsString, ",");

        textSearchWindowSide.setText("" + MipavUtil.getInt(st));
        textSimilarityWindowSide.setText("" + MipavUtil.getInt(st));
        textNoiseStandardDeviation.setText("" + MipavUtil.getFloat(st));
        textDegree.setText("" + MipavUtil.getFloat(st));
        doRician = MipavUtil.getBoolean(st);
        doRicianCheckBox.setSelected(doRician);
        textDegree.setEnabled(doRician);
        labelDegree.setEnabled(doRician);
        image25DCheckBox.setSelected(MipavUtil.getBoolean(st));

        if (MipavUtil.getBoolean(st)) {
          newImage.setSelected(true);
        } else {
          replaceImage.setSelected(true);
        }

      } catch (Exception ex) {

        // since there was a problem parsing the defaults string, start over with the original
        // defaults
        Preferences.debug("Resetting defaults for dialog: " + getDialogName());
        Preferences.removeProperty(getDialogName());
      }
    }
  }
  @Override
  public void updateOptionsList() {
    myIsInSchemeChange = true;

    myLineSpacingField.setText(Float.toString(getLineSpacing()));
    FontPreferences fontPreferences = getFontPreferences();
    List<String> fontFamilies = fontPreferences.getEffectiveFontFamilies();
    myPrimaryCombo.setFontName(fontPreferences.getFontFamily());
    boolean isThereSecondaryFont = fontFamilies.size() > 1;
    myUseSecondaryFontCheckbox.setSelected(isThereSecondaryFont);
    mySecondaryCombo.setFontName(isThereSecondaryFont ? fontFamilies.get(1) : null);
    myEditorFontSizeField.setText(
        String.valueOf(fontPreferences.getSize(fontPreferences.getFontFamily())));

    boolean readOnly = ColorAndFontOptions.isReadOnly(myOptions.getSelectedScheme());
    myPrimaryCombo.setEnabled(!readOnly);
    mySecondaryCombo.setEnabled(isThereSecondaryFont && !readOnly);
    myOnlyMonospacedCheckBox.setEnabled(!readOnly);
    myLineSpacingField.setEnabled(!readOnly);
    myEditorFontSizeField.setEnabled(!readOnly);
    myUseSecondaryFontCheckbox.setEnabled(!readOnly);

    myEnableLigaturesCheckbox.setEnabled(!readOnly);
    myLigaturesInfoLinkLabel.setEnabled(!readOnly);
    myEnableLigaturesCheckbox.setSelected(fontPreferences.useLigatures());

    myIsInSchemeChange = false;
  }
Esempio n. 26
0
	/**
	 * Sets the state (enabled/disabled) of this component.
	 * @param enabled true if this panel should be enabled, false otherwise.
	 */
	@Override
	public void setEnabled(boolean enabled) {
		super.setEnabled(enabled);
		selectFileLabel.setEnabled(enabled);
		fileNameField.setEnabled(enabled);
		browseButton.setEnabled(enabled);
	}
Esempio n. 27
0
  /** {@inheritDoc} */
  public void setEnabled(boolean b) {
    if (b != isEnabled()) {
      super.setEnabled(b);

      if ((selectedComponents & DISPLAY_DATE) > 0) {
        yearDecrButton.setEnabled(b);
        monthDecrButton.setEnabled(b);
        monthYearLabel.setEnabled(b);
        monthIncrButton.setEnabled(b);
        yearIncrButton.setEnabled(b);

        for (int day = 0; day < 7; day++) {
          dayOfWeekLabels[day].setEnabled(b);
        }

        for (int row = 0; row < 6; row++) {
          for (int day = 0; day < 7; day++) {
            if (dayButtons[row][day].getText().length() > 0) {
              dayButtons[row][day].setEnabled(b);
            }
          }
        }
      }

      if ((selectedComponents & DISPLAY_TIME) > 0) {
        spinner.setEnabled(b);
      }
    }
  }
Esempio n. 28
0
 public void disableEnableComponents(boolean disable) {
   typeSelection.setEnabled(disable);
   fieldSelection.setEnabled(disable);
   fieldDrop.setEnabled(disable);
   literalEntry.setEnabled(disable);
   addRemoveMappingChoice.setEnabled(disable);
 }
Esempio n. 29
0
 /** Acción realizada al pulsar el botón "Editar Estilo" */
 private void jbEditStyleActionPerformed(ActionEvent evt) {
   jbEditStyle.setEnabled(false);
   jlStyle.setEnabled(true);
   jcbStyle.setEnabled(true);
   jbSaveStyle.setEnabled(true);
   updatejcbStyles();
 } // fin del método
 private void updateSoftWrapSettingsRepresentation() {
   boolean softWrapsEnabled = myCbUseSoftWrapsAtEditor.isSelected();
   myCbUseCustomSoftWrapIndent.setEnabled(softWrapsEnabled);
   myCustomSoftWrapIndent.setEnabled(
       myCbUseCustomSoftWrapIndent.isEnabled() && myCbUseCustomSoftWrapIndent.isSelected());
   myCustomSoftWrapIndentLabel.setEnabled(myCustomSoftWrapIndent.isEnabled());
   myCbShowSoftWrapsOnlyOnCaretLine.setEnabled(softWrapsEnabled);
 }