private void ButtonAceptActionPerformed(
     java.awt.event.ActionEvent evt) // GEN-FIRST:event_ButtonAceptActionPerformed
     { // GEN-HEADEREND:event_ButtonAceptActionPerformed
   try {
     Attribute Attr;
     if (ModeGrp) {
       Attr = Perm.getAttr(PDACL.fGROUPNAME);
     } else {
       Attr = Perm.getAttr(PDACL.fUSERNAME);
     }
     Attr.setValue(UserComboBox.getSelectedItem());
     Attr = Perm.getAttr(PDACL.fPERMISION);
     Attr.setValue(PermisionComboBox.getSelectedIndex() + 1);
     Cancel = false;
     this.dispose();
   } catch (PDException ex) {
     MainWin.Message(MainWin.DrvTT(ex.getLocalizedMessage()));
   }
 } // GEN-LAST:event_ButtonAceptActionPerformed
示例#2
0
  public StringBuilder prepareImages(StringBuilder s) {
    int start = 0;

    // StringBuilder lower_case = new StringBuilder( s.toString().toLowerCase() );
    List<FileAttachment> attached_images = new ArrayList();

    for (Attachment att : attachments) {
      // System.out.println(att.getClass().getName());
      if (att instanceof FileAttachment) {
        FileAttachment fatt = (FileAttachment) att;

        String mime_type = fatt.getMimeTag();

        logger.info(fatt.toString() + " " + mime_type);

        if (mime_type != null && MainWin.is_image_mime_type(mime_type)) {
          attached_images.add(fatt);
        }
      }
    }

    Collections.sort(
        attached_images,
        new Comparator<FileAttachment>() {

          @Override
          public int compare(FileAttachment o1, FileAttachment o2) {
            if (o1.getSubDir() != null && o2.getSubDir() != null) {
              return o1.getSubDir().compareTo(o2.getSubDir());
            }

            return o1.getFilename().compareTo(o2.getFilename());
          }
        });

    while ((start = findImgTag(s, start)) >= 0) {
      // System.out.println("HERE");

      int end = s.indexOf(">", start);

      if (end < 0) {
        break;
      }

      String res = replace_src(new StringBuilder(s.subSequence(start, end)), attached_images);

      s.replace(start, end, res);

      if (res.length() == 0) start++;
      else start += res.length();
    }

    return s;
  }
 /** @param pPerm */
 public void setRecord(Record pPerm) {
   Perm = pPerm;
   Attribute Attr;
   if (ModeGrp) Attr = Perm.getAttr(PDACL.fGROUPNAME);
   else Attr = Perm.getAttr(PDACL.fUSERNAME);
   UserNameLabel.setText(MainWin.DrvTT(Attr.getUserName()));
   if (Attr.getValue() != null) UserComboBox.setSelectedItem((String) Attr.getValue());
   else UserComboBox.setSelectedItem("");
   UserComboBox.setToolTipText(MainWin.DrvTT(Attr.getDescription()));
   Attr = Perm.getAttr(PDACL.fPERMISION);
   PermisionLabel.setText(MainWin.DrvTT(Attr.getUserName()));
   if (Attr.getValue() != null) {
     int Level = (Integer) Attr.getValue();
     if (Level == PDACL.pCATALOG) PermisionComboBox.setSelectedItem("CATALOG");
     else if (Level == PDACL.pVERSION) PermisionComboBox.setSelectedItem("VERSION");
     else if (Level == PDACL.pUPDATE) PermisionComboBox.setSelectedItem("UPDATE");
     else if (Level == PDACL.pDELETE) PermisionComboBox.setSelectedItem("DELETE");
     else PermisionComboBox.setSelectedItem("READ");
   } else PermisionComboBox.setSelectedItem("READ");
   PermisionComboBox.setToolTipText(MainWin.DrvTT(Attr.getDescription()));
 }
  /**
   * 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.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    LabelOperation = new javax.swing.JLabel();
    UserNameLabel = new javax.swing.JLabel();
    PermisionLabel = new javax.swing.JLabel();
    UserComboBox = new javax.swing.JComboBox();
    PermisionComboBox = new javax.swing.JComboBox();
    ButtonAcept = new javax.swing.JButton();
    ButtonCancel = new javax.swing.JButton();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle(MainWin.TT("Permissions_Maintenance"));
    setResizable(false);
    addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosing(java.awt.event.WindowEvent evt) {
            formWindowClosing(evt);
          }
        });

    LabelOperation.setFont(new java.awt.Font("DejaVu Sans", 1, 14));
    LabelOperation.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    LabelOperation.setText("jLabel1");

    UserNameLabel.setFont(MainWin.getFontDialog());
    UserNameLabel.setText("jLabel1");

    PermisionLabel.setFont(MainWin.getFontDialog());
    PermisionLabel.setText("jLabel1");

    UserComboBox.setFont(MainWin.getFontDialog());
    UserComboBox.setModel(getComboModel());

    PermisionComboBox.setFont(MainWin.getFontDialog());
    PermisionComboBox.setModel(
        new javax.swing.DefaultComboBoxModel(
            new String[] {"READ", "CATALOG", "VERSION", "UPDATE", "DELETE"}));

    ButtonAcept.setFont(MainWin.getFontDialog());
    ButtonAcept.setText(MainWin.TT("Ok"));
    ButtonAcept.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            ButtonAceptActionPerformed(evt);
          }
        });

    ButtonCancel.setFont(MainWin.getFontDialog());
    ButtonCancel.setText(MainWin.TT("Cancel"));
    ButtonCancel.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            ButtonCancelActionPerformed(evt);
          }
        });

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(
                                        UserNameLabel,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        89,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(UserComboBox, 0, 316, Short.MAX_VALUE))
                            .addComponent(
                                LabelOperation,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                417,
                                Short.MAX_VALUE)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(
                                        PermisionLabel,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        89,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(PermisionComboBox, 0, 316, Short.MAX_VALUE))
                            .addGroup(
                                javax.swing.GroupLayout.Alignment.TRAILING,
                                layout
                                    .createSequentialGroup()
                                    .addComponent(ButtonAcept)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(ButtonCancel)))
                    .addContainerGap()));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(LabelOperation)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(UserNameLabel)
                            .addComponent(
                                UserComboBox,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(PermisionLabel)
                            .addComponent(
                                PermisionComboBox,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(ButtonCancel)
                            .addComponent(ButtonAcept))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    pack();
  } // </editor-fold>//GEN-END:initComponents
 public void EditMode() {
   LabelOperation.setText(MainWin.TT("Update_Permission"));
   UserComboBox.setEnabled(false);
 }
 public void DelMode() {
   LabelOperation.setText(MainWin.TT("Delete_Permission"));
   PermisionComboBox.setEnabled(false);
   UserComboBox.setEnabled(false);
 }
 public void AddMode() {
   LabelOperation.setText(MainWin.TT("Add_Permission"));
 }
  /**
   * 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.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    LabelOperation = new javax.swing.JLabel();
    SubTypesCheckB = new javax.swing.JCheckBox();
    ParamLabel2 = new javax.swing.JLabel();
    FirstDateTextField = new javax.swing.JTextField();
    ParamLabel3 = new javax.swing.JLabel();
    LastDateTextField = new javax.swing.JTextField();
    GroupLabel = new javax.swing.JLabel();
    GroupComboBox = new javax.swing.JComboBox();
    ParamLabel4 = new javax.swing.JLabel();
    OPDPathTextField = new javax.swing.JTextField();
    ButtonAcept = new javax.swing.JButton();
    ButtonCancel = new javax.swing.JButton();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle(MainWin.TT("Programed_Task_Maintenance"));
    setResizable(false);
    addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosing(java.awt.event.WindowEvent evt) {
            formWindowClosing(evt);
          }
        });

    LabelOperation.setFont(new java.awt.Font("DejaVu Sans", 1, 14)); // NOI18N
    LabelOperation.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    LabelOperation.setText(MainWin.TT("Param_Report_Folders"));

    SubTypesCheckB.setFont(MainWin.getFontDialog());
    SubTypesCheckB.setText(MainWin.TT("Subtypes"));
    SubTypesCheckB.setToolTipText(
        MainWin.TT("When_checked_includes_subtypes_of_folders_in_results"));

    ParamLabel2.setFont(MainWin.getFontDialog());
    ParamLabel2.setText(MainWin.TT("From_Number_of_days"));

    FirstDateTextField.setFont(MainWin.getFontDialog());

    ParamLabel3.setFont(MainWin.getFontDialog());
    ParamLabel3.setText(MainWin.TT("To_Number_of_days"));

    LastDateTextField.setFont(MainWin.getFontDialog());

    GroupLabel.setFont(MainWin.getFontDialog());
    GroupLabel.setText(MainWin.TT("Group"));

    GroupComboBox.setFont(MainWin.getFontDialog());
    GroupComboBox.setModel(GetGroups());

    ParamLabel4.setFont(MainWin.getFontDialog());
    ParamLabel4.setText(MainWin.TT("Parent_Folder"));

    OPDPathTextField.setFont(MainWin.getFontDialog());

    ButtonAcept.setFont(MainWin.getFontDialog());
    ButtonAcept.setText(MainWin.TT("Ok"));
    ButtonAcept.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            ButtonAceptActionPerformed(evt);
          }
        });

    ButtonCancel.setFont(MainWin.getFontDialog());
    ButtonCancel.setText(MainWin.TT("Cancel"));
    ButtonCancel.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            ButtonCancelActionPerformed(evt);
          }
        });

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addGap(12, 12, 12)
                    .addComponent(
                        LabelOperation,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        Short.MAX_VALUE)
                    .addGap(12, 12, 12))
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(ButtonAcept)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(ButtonCancel))
                            .addGroup(
                                layout
                                    .createParallelGroup(
                                        javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addGroup(
                                        javax.swing.GroupLayout.Alignment.LEADING,
                                        layout
                                            .createSequentialGroup()
                                            .addComponent(
                                                ParamLabel4,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                152,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(
                                                javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(OPDPathTextField))
                                    .addGroup(
                                        javax.swing.GroupLayout.Alignment.LEADING,
                                        layout
                                            .createSequentialGroup()
                                            .addGroup(
                                                layout
                                                    .createParallelGroup(
                                                        javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(SubTypesCheckB)
                                                    .addComponent(
                                                        ParamLabel2,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        152,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addPreferredGap(
                                                javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(
                                                FirstDateTextField,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                85,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(32, 32, 32)
                                            .addComponent(
                                                ParamLabel3,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                152,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(
                                                javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(
                                                LastDateTextField,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                85,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(
                                        javax.swing.GroupLayout.Alignment.LEADING,
                                        layout
                                            .createSequentialGroup()
                                            .addComponent(
                                                GroupLabel,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                152,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(
                                                javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(
                                                GroupComboBox,
                                                0,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE))))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(LabelOperation)
                    .addGap(18, 18, 18)
                    .addComponent(SubTypesCheckB)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(ParamLabel2)
                            .addComponent(
                                FirstDateTextField,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(ParamLabel3)
                            .addComponent(
                                LastDateTextField,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(GroupLabel)
                            .addComponent(
                                GroupComboBox,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(
                        javax.swing.LayoutStyle.ComponentPlacement.RELATED, 14, Short.MAX_VALUE)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(ParamLabel4)
                            .addComponent(
                                OPDPathTextField,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(ButtonCancel)
                            .addComponent(ButtonAcept))
                    .addGap(24, 24, 24)));

    pack();
  } // </editor-fold>//GEN-END:initComponents