Beispiel #1
0
 /** Method for ok action. */
 private void okAction() {
   try {
     java.lang.String oldPassword = java.lang.String.valueOf(oldPasswordField.getPassword());
     java.lang.String newPassword = java.lang.String.valueOf(newPasswordField.getPassword());
     java.lang.String confirmedPassword =
         java.lang.String.valueOf(confirmedPasswordField.getPassword());
     if (!password.equals(oldPassword)) {
       javax.swing.JOptionPane.showMessageDialog(
           this,
           elv.util.Util.translate(elv.util.Util.OLD_STATEMENT),
           new elv.util.State(elv.util.State.ERROR).toString(),
           javax.swing.JOptionPane.ERROR_MESSAGE);
       oldPasswordField.setText(null);
       oldPasswordField.requestFocusInWindow();
       newPasswordField.setText(null);
       confirmedPasswordField.setText(null);
     } else if (!newPassword.equals(confirmedPassword)) {
       javax.swing.JOptionPane.showMessageDialog(
           this,
           elv.util.Util.translate(elv.util.Util.CONFIRMED_STATEMENT),
           new elv.util.State(elv.util.State.ERROR).toString(),
           javax.swing.JOptionPane.ERROR_MESSAGE);
       oldPasswordField.setText(null);
       oldPasswordField.requestFocusInWindow();
       newPasswordField.setText(null);
       confirmedPasswordField.setText(null);
     } else {
       password = newPassword;
       setVisible(false);
       dispose();
     }
   } catch (java.lang.Exception exc) {
     elv.util.Error.showErrorMessage(this, exc);
   }
 }
Beispiel #2
0
 /**
  * Constructor.
  *
  * @param title the title of this wizard dialog.
  * @param password the actual password.
  */
 public PasswordsDialog(java.lang.String title, java.lang.String password) {
   super(elv.util.Util.getMainFrame(), title, true);
   this.password = password;
   try {
     initComponents();
     java.awt.Dimension windowSize = elv.util.Util.getMainFrame().getSize();
     java.awt.Point windowLocation = elv.util.Util.getMainFrame().getLocation();
     java.awt.Dimension dialogSize = getSize();
     java.awt.Point dialogLocation =
         new java.awt.Point(
             windowLocation.x + (windowSize.width - dialogSize.width) / 2,
             windowLocation.y + (windowSize.height - dialogSize.height) / 2);
     setLocation(
         (dialogLocation.x >= 0 ? dialogLocation.x : 0),
         (dialogLocation.y >= 0 ? dialogLocation.y : 0));
   } catch (java.lang.Exception exc) {
     elv.util.Error.showErrorMessage(this, exc);
   }
 }
Beispiel #3
0
 /** Implemented method from <CODE>elv.util.Saveable</CODE>. */
 public void save() {
   if (isChanged()) {
     try {
       elv.util.client.ClientStub.storeParameters(
           task.getPropertyFolderPath() + elv.util.Util.getFS() + parameterType.getFile(),
           diagnosises);
       if (task != null) {
         elv.util.Property.get(elv.task.Task.MODIFIED_NAME, task.getProperties())
             .setValue(new java.util.Date());
         java.lang.String pathName =
             task.getPropertyFolderPath() + elv.util.Util.getFS() + task.getPropertyFile();
         elv.util.client.ClientStub.storeProperties(pathName, task.getProperties());
         // Fire property change for reload the task properties.
         task.getChangeSupport().firePropertyChange(elv.task.Task.MODIFIED_NAME, null, state);
       }
       setChanged(false);
     } catch (java.lang.Exception exc) {
       elv.util.Error.showErrorMessage(this, exc);
     }
   }
 }
Beispiel #4
0
 /** Method for Remove button action. */
 private void removeButtonActionPerformed(
     java.awt.event.ActionEvent evt) // GEN-FIRST:event_removeButtonActionPerformed
     { // GEN-HEADEREND:event_removeButtonActionPerformed
   try {
     javax.swing.tree.TreePath[] removedPaths = diagnosisesTree.getSelectionPaths();
     if (removedPaths != null) {
       javax.swing.tree.DefaultTreeModel treeModel =
           (javax.swing.tree.DefaultTreeModel) diagnosisesTree.getModel();
       javax.swing.tree.DefaultMutableTreeNode rootNode =
           (javax.swing.tree.DefaultMutableTreeNode) diagnosisesTree.getModel().getRoot();
       javax.swing.tree.DefaultMutableTreeNode node;
       javax.swing.tree.TreeNode[] parentNodes;
       elv.util.parameters.Diagnosis diagnosis;
       for (int i = 0; i < removedPaths.length; i++) {
         node = (javax.swing.tree.DefaultMutableTreeNode) removedPaths[i].getLastPathComponent();
         if (!node.isRoot()) {
           if (!isNodeAncestor(node, removedPaths, i)) {
             setChanged(true);
             elv.util.Util.getMainFrame().setChanged(true);
             treeModel.removeNodeFromParent(node);
             for (java.util.Enumeration e = node.preorderEnumeration(); e.hasMoreElements(); ) {
               node = (javax.swing.tree.DefaultMutableTreeNode) e.nextElement();
               diagnosis = (elv.util.parameters.Diagnosis) node.getUserObject();
               diagnosises.remove(diagnosis);
             }
           }
         }
       }
       node = rootNode;
       java.util.Enumeration e = node.preorderEnumeration();
       node = (javax.swing.tree.DefaultMutableTreeNode) e.nextElement();
       while (e.hasMoreElements()) {
         node = (javax.swing.tree.DefaultMutableTreeNode) e.nextElement();
         diagnosis = (elv.util.parameters.Diagnosis) node.getUserObject();
         parentNodes = node.getPath();
         for (int j = 1; j < parentNodes.length; j++) {
           node = (javax.swing.tree.DefaultMutableTreeNode) parentNodes[j];
           java.lang.String level = Integer.toString(node.getParent().getIndex(node) + 1);
           if (j == 1) {
             diagnosis.setParagraph(level);
           } else {
             diagnosis.setParagraph(diagnosis.getParagraph() + "." + level);
           }
         }
       }
     }
     setEnabled(isEnabled);
   } catch (java.lang.Exception exc) {
     elv.util.Error.showErrorMessage(this, exc);
   }
 } // GEN-LAST:event_removeButtonActionPerformed
Beispiel #5
0
  /**
   * Constructor.
   *
   * @param task the task which is executed.
   * @throws java.lang.Exception if there is any problem with execution.
   */
  public Execution(elv.task.Task task) throws java.lang.Exception {
    this.task = task;
    progresses = new java.util.Stack<elv.util.Progress>();
    timer = new java.util.Timer();
    // Create the execution state indicator file.
    java.lang.String fileName =
        task.getExecutionFolderPath() + elv.util.Util.getFS() + elv.task.Execution.FILE_NAME;
    java.io.PrintWriter fileWriter =
        new java.io.PrintWriter(
            new java.io.OutputStreamWriter(
                new java.io.FileOutputStream(fileName), elv.util.Util.FILE_ENCODING));
    fileWriter.close();

    loadParameters();
  }
Beispiel #6
0
 /**
  * Implemented method from <CODE>elv.util.parameters.Diagnosis</CODE>.
  *
  * @return a vector of diagnosises.
  * @throws java.lang.Exception if there is any problem with getting.
  */
 public synchronized <D extends Diagnosis> java.util.Vector<D> getAllDiagnosises()
     throws java.lang.Exception {
   java.util.Vector<D> diagnosises = new java.util.Vector<D>();
   java.lang.String line;
   java.io.BufferedReader fileReader =
       new java.io.BufferedReader(
           new java.io.InputStreamReader(
               new elv.util.Util()
                   .getClass()
                   .getResource(
                       "/resources/diagnosises/"
                           + FILE_BASE
                           + "_"
                           + elv.util.Util.getActualLocale().getLanguage()
                           + ".properties")
                   .openStream(),
               elv.util.Util.FILE_ENCODING));
   while ((line = fileReader.readLine()) != null) {
     diagnosises.add((D) parse(line));
   }
   fileReader.close();
   return diagnosises;
 }
Beispiel #7
0
  /** Method for Add button action. */
  private void addButtonActionPerformed(
      java.awt.event.ActionEvent evt) // GEN-FIRST:event_addButtonActionPerformed
      { // GEN-HEADEREND:event_addButtonActionPerformed
    try {
      javax.swing.JTree allDiagnosisesTree = new javax.swing.JTree();
      allDiagnosisesTree.setRootVisible(false);
      allDiagnosisesTree.setShowsRootHandles(true);
      allDiagnosisesTree.setCellRenderer(new elv.util.Util.DefaultTreeCellRenderer());
      allDiagnosisesTree.setModel(
          new javax.swing.tree.DefaultTreeModel(new javax.swing.tree.DefaultMutableTreeNode()) {

            /** Overridden constructor. */
            {
              javax.swing.tree.DefaultMutableTreeNode nodeLevels[] =
                  new javax.swing.tree.DefaultMutableTreeNode[10];
              javax.swing.tree.DefaultMutableTreeNode node = null;
              nodeLevels[0] =
                  new javax.swing.tree.DefaultMutableTreeNode(parameterType.getDefault());
              java.util.Vector<elv.util.parameters.Diagnosis> diagnosises =
                  parameterType.getAllDiagnosises();
              for (elv.util.parameters.Diagnosis iteratorDiagnosis : diagnosises) {
                node = new javax.swing.tree.DefaultMutableTreeNode(iteratorDiagnosis);
                nodeLevels[iteratorDiagnosis.getParagraphLevel()] = node;
                nodeLevels[iteratorDiagnosis.getParagraphLevel() - 1].add(node);
              }
              setRoot(nodeLevels[0]);
            }
          });
      javax.swing.JScrollPane allDiagnosisesScrollPane = new javax.swing.JScrollPane();
      allDiagnosisesScrollPane.setViewportView(allDiagnosisesTree);
      int returnOption =
          elv.util.Option.okCancel(allDiagnosisesScrollPane, parameterType.getTitle());
      if (returnOption == javax.swing.JOptionPane.OK_OPTION
          && allDiagnosisesTree.getSelectionPaths() != null) {
        javax.swing.tree.DefaultTreeModel treeModel =
            (javax.swing.tree.DefaultTreeModel) diagnosisesTree.getModel();
        javax.swing.tree.DefaultMutableTreeNode rootNode =
            (javax.swing.tree.DefaultMutableTreeNode) diagnosisesTree.getModel().getRoot();
        javax.swing.tree.DefaultMutableTreeNode node;
        javax.swing.tree.TreeNode[] parentNodes;
        elv.util.parameters.Diagnosis diagnosis;
        for (int i = 0; i < allDiagnosisesTree.getSelectionPaths().length; i++) {
          node =
              (javax.swing.tree.DefaultMutableTreeNode)
                  allDiagnosisesTree.getSelectionPaths()[i].getLastPathComponent();
          if (!isNodeChild(node, rootNode)) {
            setChanged(true);
            elv.util.Util.getMainFrame().setChanged(true);
            treeModel.insertNodeInto(node, rootNode, rootNode.getChildCount());
            if (i == 0) {
              diagnosisesTree.scrollPathToVisible(new javax.swing.tree.TreePath(node.getPath()));
            }
            for (java.util.Enumeration e = node.preorderEnumeration(); e.hasMoreElements(); ) {
              node = (javax.swing.tree.DefaultMutableTreeNode) e.nextElement();
              diagnosis = (elv.util.parameters.Diagnosis) node.getUserObject();
              parentNodes = node.getPath();
              for (int j = 1; j < parentNodes.length; j++) {
                node = (javax.swing.tree.DefaultMutableTreeNode) parentNodes[j];
                java.lang.String level = Integer.toString(node.getParent().getIndex(node) + 1);
                if (j == 1) {
                  diagnosis.setParagraph(level);
                } else {
                  diagnosis.setParagraph(diagnosis.getParagraph() + "." + level);
                }
              }
              diagnosises.add(diagnosis);
            }
          }
        }
      }
    } catch (java.lang.Exception exc) {
      elv.util.Error.showErrorMessage(this, exc);
    }
  } // GEN-LAST:event_addButtonActionPerformed
Beispiel #8
0
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  private void initComponents() // GEN-BEGIN:initComponents
      {
    mainPanel = new javax.swing.JPanel();
    passwordsContentPanel = new javax.swing.JPanel();
    labelsPanel = new javax.swing.JPanel();
    oldLabel = new javax.swing.JLabel();
    newLabel = new javax.swing.JLabel();
    confirmedLabel = new javax.swing.JLabel();
    inputsPanel = new javax.swing.JPanel();
    oldPasswordField = new javax.swing.JPasswordField();
    newPasswordField = new javax.swing.JPasswordField();
    confirmedPasswordField = new javax.swing.JPasswordField();
    buttonsOrientationPanel = new javax.swing.JPanel();
    mainSeparator = new javax.swing.JSeparator();
    buttonsPanel = new javax.swing.JPanel();
    okButton = new javax.swing.JButton();
    cancelButton = new javax.swing.JButton();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setModal(true);
    addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosing(java.awt.event.WindowEvent evt) {
            closeDialog(evt);
          }
        });

    mainPanel.setLayout(new java.awt.BorderLayout());

    passwordsContentPanel.setLayout(new java.awt.BorderLayout());

    labelsPanel.setLayout(new java.awt.GridLayout(0, 1, 0, 10));

    labelsPanel.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(10, 10, 10, 10)));
    oldLabel.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    oldLabel.setLabelFor(oldPasswordField);
    oldLabel.setText(elv.util.Util.translate(elv.util.Util.OLD_VALUE) + ":");
    labelsPanel.add(oldLabel);

    newLabel.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    newLabel.setLabelFor(newPasswordField);
    newLabel.setText(elv.util.Util.translate(elv.util.Util.NEW_VALUE) + ":");
    labelsPanel.add(newLabel);

    confirmedLabel.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    confirmedLabel.setLabelFor(confirmedPasswordField);
    confirmedLabel.setText(elv.util.Util.translate(elv.util.Util.CONFIRMED_VALUE) + ":");
    labelsPanel.add(confirmedLabel);

    passwordsContentPanel.add(labelsPanel, java.awt.BorderLayout.WEST);

    inputsPanel.setLayout(new java.awt.GridLayout(0, 1, 0, 10));

    inputsPanel.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(10, 1, 10, 10)));
    oldPasswordField.setFont(new java.awt.Font("DialogInput", 0, 12));
    oldPasswordField.setEchoChar(elv.util.Util.PASSWORD_ECHO_CHAR);
    oldPasswordField.setPreferredSize(new java.awt.Dimension(150, 18));
    inputsPanel.add(oldPasswordField);

    newPasswordField.setFont(new java.awt.Font("DialogInput", 0, 12));
    newPasswordField.setEchoChar(elv.util.Util.PASSWORD_ECHO_CHAR);
    inputsPanel.add(newPasswordField);

    confirmedPasswordField.setFont(new java.awt.Font("DialogInput", 0, 12));
    confirmedPasswordField.setEchoChar(elv.util.Util.PASSWORD_ECHO_CHAR);
    inputsPanel.add(confirmedPasswordField);

    passwordsContentPanel.add(inputsPanel, java.awt.BorderLayout.CENTER);

    mainPanel.add(passwordsContentPanel, java.awt.BorderLayout.CENTER);

    getContentPane().add(mainPanel, java.awt.BorderLayout.CENTER);

    buttonsOrientationPanel.setLayout(new java.awt.BorderLayout());

    buttonsOrientationPanel.add(mainSeparator, java.awt.BorderLayout.NORTH);

    buttonsPanel.setLayout(new java.awt.GridLayout(1, 0, 5, 0));

    buttonsPanel.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(10, 10, 10, 10)));
    okButton.setText(new elv.util.Action(elv.util.Action.OK).toString());
    okButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            okButtonActionPerformed(evt);
          }
        });

    buttonsPanel.add(okButton);

    cancelButton.setText(new elv.util.Action(elv.util.Action.CANCEL).toString());
    cancelButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            cancelButtonActionPerformed(evt);
          }
        });

    buttonsPanel.add(cancelButton);

    buttonsOrientationPanel.add(buttonsPanel, java.awt.BorderLayout.EAST);

    getContentPane().add(buttonsOrientationPanel, java.awt.BorderLayout.SOUTH);

    pack();
  } // GEN-END:initComponents
Beispiel #9
0
 /**
  * Implemented method from <CODE>elv.util.parameters.Parameter</CODE>.
  *
  * @return the title of parameter.
  */
 public java.lang.String getTitle() {
   return elv.util.Util.translate(TITLE);
 }