private JPanel createForm() {
    JCheckBox enabledCheckBox = new JCheckBox(Finder.getString("vhost.ssl.edit.enable"));

    new CheckBoxPropertySynchronizer(enabledProperty, enabledCheckBox);
    ChangeIndicator enabledChange = new ChangeIndicator();
    enabledProperty.addChangeListener(enabledChange);

    JLabel iPLabel = new JLabel(Finder.getString("vhost.ssl.edit.ip"));
    JTextField iPField = GUIUtil.createTextField();
    new TextComponentPropertySynchronizer<String, JTextComponent>(ipProperty, iPField);
    ChangeIndicator iPChange = new ChangeIndicator();
    ipProperty.addChangeListener(iPChange);

    JLabel portLabel = new JLabel(Finder.getString("vhost.ssl.edit.port"));

    SpinnerNumberModel portModel = new SpinnerNumberModel(0, 0, Short.MAX_VALUE, 1);
    JSpinner portSpinner = new JSpinner(portModel);

    JComponent editor = portSpinner.getEditor();
    if (editor instanceof JSpinner.DefaultEditor) {
      JTextField field = ((JSpinner.DefaultEditor) editor).getTextField();
      field.setColumns(5);
      field.setHorizontalAlignment(JTextField.RIGHT);
    }

    new SpinnerNumberModelPropertySynchronizer(portProperty, portModel, false);
    portProperty.save();

    ChangeIndicator portChange = new ChangeIndicator();
    portProperty.addChangeListener(portChange);

    JLabel certLabel = new JLabel(Finder.getString("vhost.ssl.edit.certificate"));

    BrowsableFilePanel certPanel = new BrowsableFilePanel();
    certPanel.setOpaque(false);
    fileChoosers.add(certPanel.getFileChooser());

    new TextComponentPropertySynchronizer<String, JTextComponent>(
        certProperty, certPanel.getField());
    ChangeIndicator certChange = new ChangeIndicator();
    certProperty.addChangeListener(certChange);

    JLabel keyLabel = new JLabel(Finder.getString("vhost.ssl.edit.key"));

    BrowsableFilePanel keyPanel = new BrowsableFilePanel();
    keyPanel.setOpaque(false);
    fileChoosers.add(keyPanel.getFileChooser());

    new TextComponentPropertySynchronizer<String, JTextComponent>(keyProperty, keyPanel.getField());
    ChangeIndicator keyChange = new ChangeIndicator();
    keyProperty.addChangeListener(keyChange);

    JPanel formPanel = new JPanel();
    formPanel.setOpaque(false);

    Form form = new Form(formPanel, VerticalAnchor.TOP);

    int hGap = GUIUtil.getHalfGap();
    int sGap = 3 * hGap;
    int indent = GUIUtil.getTextXOffset(enabledCheckBox);

    ColumnLayoutConstraint c = new ColumnLayoutConstraint(HorizontalAnchor.FILL, hGap);

    RowLayoutConstraint r = new RowLayoutConstraint(VerticalAnchor.CENTER, hGap);

    HasAnchors a = new SimpleHasAnchors(HorizontalAnchor.LEFT, VerticalAnchor.CENTER);

    form.addRow(HorizontalAnchor.LEFT, c);
    form.add(enabledCheckBox, r);
    form.add(enabledChange, r);

    form.addTable(2, hGap, hGap, HorizontalAnchor.LEFT, c.setGap(sGap));
    form.add(iPLabel, a);
    form.add(getRow(hGap, iPField, iPChange), a);
    form.add(portLabel, a);
    form.add(getRow(hGap, portSpinner, portChange), a);
    form.add(certLabel, a);
    form.add(getRow(hGap, certPanel, certChange), a);
    form.add(keyLabel, a);
    form.add(getRow(hGap, keyPanel, keyChange), a);

    return formPanel;
  }
예제 #2
0
  private Element makeForm() {
    Composite comp = new Composite();
    Form frm = new Form(srvURL(myServletDescr()));
    frm.method("POST");

    frm.add("<br><center>");
    Input reload = new Input(Input.Submit, KEY_ACTION, ACTION_RELOAD_CONFIG);
    setTabOrder(reload);
    frm.add(reload);
    frm.add(" ");
    Input backup = new Input(Input.Submit, KEY_ACTION, ACTION_MAIL_BACKUP);
    setTabOrder(backup);
    frm.add(backup);
    frm.add(" ");
    Input crawlplug = new Input(Input.Submit, KEY_ACTION, ACTION_CRAWL_PLUGINS);
    setTabOrder(crawlplug);
    frm.add(crawlplug);
    frm.add("</center>");
    ServletDescr d1 = AdminServletManager.SERVLET_HASH_CUS;
    if (isServletRunnable(d1)) {
      frm.add("<br><center>" + srvLink(d1, d1.heading) + "</center>");
    }
    Input findUrl = new Input(Input.Submit, KEY_ACTION, ACTION_FIND_URL);
    Input findUrlText = new Input(Input.Text, KEY_URL);
    findUrlText.setSize(50);
    setTabOrder(findUrl);
    setTabOrder(findUrlText);
    frm.add("<br><center>" + findUrl + " " + findUrlText + "</center>");

    Input thrw = new Input(Input.Submit, KEY_ACTION, ACTION_THROW_IOEXCEPTION);
    Input thmsg = new Input(Input.Text, KEY_MSG);
    setTabOrder(thrw);
    setTabOrder(thmsg);
    frm.add("<br><center>" + thrw + " " + thmsg + "</center>");

    frm.add("<br><center>AU Actions: select AU</center>");
    Composite ausel = ServletUtil.layoutSelectAu(this, KEY_AUID, formAuid);
    frm.add("<br><center>" + ausel + "</center>");
    setTabOrder(ausel);

    Input v3Poll =
        new Input(
            Input.Submit,
            KEY_ACTION,
            (showForcePoll ? ACTION_FORCE_START_V3_POLL : ACTION_START_V3_POLL));
    Input crawl =
        new Input(
            Input.Submit,
            KEY_ACTION,
            (showForceCrawl ? ACTION_FORCE_START_CRAWL : ACTION_START_CRAWL));

    frm.add("<br><center>");
    frm.add(v3Poll);
    frm.add(" ");
    frm.add(crawl);
    if (CurrentConfig.getBooleanParam(PARAM_ENABLE_DEEP_CRAWL, DEFAULT_ENABLE_DEEP_CRAWL)) {
      Input deepCrawl =
          new Input(
              Input.Submit,
              KEY_ACTION,
              (showForceCrawl ? ACTION_FORCE_START_DEEP_CRAWL : ACTION_START_DEEP_CRAWL));
      Input depthText = new Input(Input.Text, KEY_REFETCH_DEPTH, formDepth);
      depthText.setSize(4);
      setTabOrder(depthText);
      frm.add(" ");
      frm.add(deepCrawl);
      frm.add(depthText);
    }
    Input checkSubstance = new Input(Input.Submit, KEY_ACTION, ACTION_CHECK_SUBSTANCE);
    frm.add("<br>");
    frm.add(checkSubstance);
    if (metadataMgr != null) {
      Input reindex =
          new Input(
              Input.Submit,
              KEY_ACTION,
              (showForceReindexMetadata ? ACTION_FORCE_REINDEX_METADATA : ACTION_REINDEX_METADATA));
      frm.add(" ");
      frm.add(reindex);
      Input disableIndexing = new Input(Input.Submit, KEY_ACTION, ACTION_DISABLE_METADATA_INDEXING);
      frm.add(" ");
      frm.add(disableIndexing);
    }
    frm.add("</center>");

    comp.add(frm);
    return comp;
  }