コード例 #1
0
  private void closeButtonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_closeButtonActionPerformed
    attachmentHandlerProperties.setClassName(classNameField.getText());
    attachmentHandlerProperties.getProperties().clear();

    DefaultTableModel model = (DefaultTableModel) propertiesTable.getModel();

    for (int i = 0; i < model.getRowCount(); i++) {
      attachmentHandlerProperties
          .getProperties()
          .put((String) model.getValueAt(i, 0), (String) model.getValueAt(i, 1));
    }

    attachmentHandlerProperties = null;
    this.dispose();
  } // GEN-LAST:event_closeButtonActionPerformed
コード例 #2
0
  public CustomAttachmentDialog(AttachmentHandlerProperties properties) {
    super(PlatformUI.MIRTH_FRAME);
    this.parent = PlatformUI.MIRTH_FRAME;
    initComponents();
    initPropertiesTable();

    attachmentHandlerProperties = properties;

    classNameField.setText(attachmentHandlerProperties.getClassName());
    classNameField.requestFocus();
    classNameField.addFocusListener(
        new FocusAdapter() {

          @Override
          public void focusGained(FocusEvent e) {
            if (initialFocus) {
              classNameField.setCaretPosition(0);
              initialFocus = false;
            }
          }
        });
    updatePropertiesTable(attachmentHandlerProperties.getProperties());

    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setModal(true);
    Dimension dlgSize = getPreferredSize();
    Dimension frmSize = parent.getSize();
    Point loc = parent.getLocation();

    if ((frmSize.width == 0 && frmSize.height == 0) || (loc.x == 0 && loc.y == 0)) {
      setLocationRelativeTo(null);
    } else {
      setLocation(
          (frmSize.width - dlgSize.width) / 2 + loc.x,
          (frmSize.height - dlgSize.height) / 2 + loc.y);
    }

    setVisible(true);
  }