Exemplo n.º 1
0
  /*
   * Initialise Components
   */
  private void initComponents() {
    selectionCheckBox = new JCheckBox();

    selectionCheckBox.setText(settop.getHostMacAddress());

    selectionCheckBox.setFocusable(false);

    // selectionCheckBox.setEnabled( false );

    selectionCheckBox.setName("selectionCheckBox");

    closeButton = new IconButton(CLOSE_ICON);

    closeButton.setToolTipText("Close Video");

    playStopButton = new IconButton(STOP_ICON);

    showStopStreamingButton();

    lockUnlockButton = new IconButton(UNLOCK_ICON);

    lockUnlockButton.setSize(new Dimension(25, 25));

    showUnLockButton();

    closeButton.setBorder(BorderFactory.createRaisedBevelBorder());

    setToolTipText(getSettopInfoToolTipText((SettopInfo) settop));
  }
Exemplo n.º 2
0
  private JPanel createResetPanel() {
    resetInterpreter =
        new JCheckBox(JMeterUtils.getResString("bsh_script_reset_interpreter")); // $NON-NLS-1$
    resetInterpreter.setName(BeanShellAssertion.PARAMETERS);

    JPanel resetInterpreterPanel = new JPanel(new BorderLayout());
    resetInterpreterPanel.add(resetInterpreter, BorderLayout.WEST);
    return resetInterpreterPanel;
  }
  public void test_checkbox() {
    JCheckBox field = new JCheckBox();
    field.setName("myfield");

    list.addEvent(newGuiEvent(GuiEventType.CHECKBOX_CLICK, field, Boolean.TRUE));

    setValueGesture.receive(list, result);

    assertEquals("<setValue name=\"myfield\" value=\"true\"/>", result.toXml());
  }
  public void addCheckBox(String checkBoxName, int gridx, int gridy) {

    JCheckBox checkbox = new JCheckBox();
    checkbox.setName(checkBoxName);
    this.constraints.fill = GridBagConstraints.HORIZONTAL;
    this.constraints.gridx = gridx;
    this.constraints.gridy = gridy;
    this.componentsPanel.add(checkbox, this.constraints);
    checkBox.add(checkbox);

    // this.rows.add(new
    // MmAccordionPanelRows(button,gridx,gridy,this.componentsPanel.getComponentCount()));
  }
Exemplo n.º 5
0
 /* WARNING: THIS METHOD WILL BE REGENERATED. */
 private javax.swing.JCheckBox getDebug() {
   if (ivjDebug == null) {
     try {
       ivjDebug = new javax.swing.JCheckBox();
       ivjDebug.setName("Debug");
       ivjDebug.setText("ORB debug");
       // user code begin {1}
       // user code end
     } catch (java.lang.Throwable ivjExc) {
       // user code begin {2}
       // user code end
       handleException(ivjExc);
     }
   }
   return ivjDebug;
 }
Exemplo n.º 6
0
 /* WARNING: THIS METHOD WILL BE REGENERATED. */
 private javax.swing.JCheckBox getDecompCheck() {
   if (ivjDecompCheck == null) {
     try {
       ivjDecompCheck = new javax.swing.JCheckBox();
       ivjDecompCheck.setName("DecompCheck");
       ivjDecompCheck.setSelected(true);
       ivjDecompCheck.setPreferredSize(new java.awt.Dimension(150, 20));
       ivjDecompCheck.setText("Use decomposition of residual correlation matrix");
       // user code begin {1}
       // user code end
     } catch (Throwable ivjExc) {
       // user code begin {2}
       // user code end
       handleException(ivjExc);
     }
   }
   return ivjDecompCheck;
 }
Exemplo n.º 7
0
  public void init() {

    keyboard = new Keyboard();
    CheckBoxChange checkBoxChange = new CheckBoxChange();
    // build input begin ------------------
    sendStringsCheckBox = new JCheckBox();
    sendStringsCheckBox.setName("send strings");

    JButton keyboardButton =
        new JButton(
            "<html><body><table><tr><td align=\"center\">click here</td></tr><tr><td align=\"center\">for keyboard</td></tr><tr><td align=\"center\">control.</td></tr></table></body></html>");

    display.add(keyboardButton, gc);
    keyboardButton.addKeyListener(keyboard);

    ++gc.gridx;
    display.add(sendStringsCheckBox, gc);
    ++gc.gridx;
    display.add(new JLabel("send strings"), gc);

    currentLog = new JList(logModel);
    currentLog.setFixedCellWidth(400);
    currentLog.addListSelectionListener(this);
    currentLog.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    currentLog.setVisibleRowCount(10);

    TitledBorder title;
    JPanel logPanel = new JPanel();
    JScrollPane logScrollPane = new JScrollPane(currentPlayers);
    title = BorderFactory.createTitledBorder("key log");
    logPanel.setBorder(title);
    logPanel.add(logScrollPane);

    gc.gridx = 0;
    gc.gridwidth = 3;
    ++gc.gridy;
    display.add(logPanel, gc);

    JScrollPane currentFiltersScrollPane2 = new JScrollPane(currentLog);
    logPanel.add(currentFiltersScrollPane2);

    sendStringsCheckBox.addChangeListener(checkBoxChange);
  }
Exemplo n.º 8
0
  /** Read property file, XUL file and create user controls. */
  private void createGUI() {
    radiobuttons = new HashMap<String, ButtonGroup>();
    // read property file with settings
    Properties prop = readProperties();
    File fXmlFile = new File(configFile);
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    try {
      DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
      DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
      Document doc = dBuilder.parse(fXmlFile);

      NodeList controls = doc.getElementsByTagName("box").item(0).getChildNodes();

      for (int i = 0; i < controls.getLength(); i++) {
        NamedNodeMap attrib = controls.item(i).getAttributes();
        if (controls.item(i).getNodeName().toLowerCase().equals("textbox")) {
          // textbox
          String text =
              prop.getProperty(
                  attrib.getNamedItem("id").getNodeValue(),
                  attrib.getNamedItem("value").getNodeValue());
          JTextField textfield = new JTextField(text);
          textfield.setName(attrib.getNamedItem("id").getNodeValue());
          textfield.addActionListener(this);
          add(textfield);
        } else if (controls.item(i).getNodeName().toLowerCase().equals("label")) {
          // label
          JLabel label = new JLabel(attrib.getNamedItem("value").getNodeValue());
          add(label);
        } else if (controls.item(i).getNodeName().toLowerCase().equals("checkbox")) {
          // checkbox
          if (attrib.getNamedItem("label") != null && attrib.getNamedItem("id") != null) {
            boolean checked = false;
            if (attrib.getNamedItem("checked") != null)
              checked = Boolean.parseBoolean(attrib.getNamedItem("checked").getNodeValue());
            checked =
                Boolean.parseBoolean(
                    prop.getProperty(
                        attrib.getNamedItem("id").getNodeValue(), Boolean.toString(checked)));
            JCheckBox checkbox =
                new JCheckBox(attrib.getNamedItem("label").getNodeValue(), checked);
            checkbox.setName(attrib.getNamedItem("id").getNodeValue());
            checkbox.addActionListener(this);
            add(checkbox);
          } else {
            System.err.println(
                String.format(
                    "invalid checkbox definition (%s, %s)",
                    attrib.getNamedItem("label"), attrib.getNamedItem("id")));
          }
        } else if (controls.item(i).getNodeName().toLowerCase().equals("radiogroup")) {
          // radiogroup
          ButtonGroup group = new ButtonGroup();
          NodeList nodes = controls.item(i).getChildNodes();
          String key = null;
          for (int j = 0; j < nodes.getLength(); j++) {
            if (nodes.item(j).getNodeName().toLowerCase().equals("radio")) {
              // id of radiogroup as key
              key = attrib.getNamedItem("id").getNodeValue();
              NamedNodeMap radioAttributes = nodes.item(j).getAttributes();
              boolean selected = false;
              if (radioAttributes.getNamedItem("selected") != null && !prop.containsKey(key))
                selected =
                    Boolean.parseBoolean(radioAttributes.getNamedItem("selected").getNodeValue());
              if (radioAttributes.getNamedItem("label") != null) {
                if (prop.containsKey(key)
                    && radioAttributes.getNamedItem("label").getNodeValue().equals(prop.get(key)))
                  selected = true;
                JRadioButton radioButton =
                    new JRadioButton(
                        radioAttributes.getNamedItem("label").getNodeValue(), selected);
                // radioButton.setName(attrib.getNamedItem("group").getNodeValue());
                radioButton.addActionListener(this);
                group.add(radioButton);
                add(radioButton);
              }
            }
          }
          if (key != null) radiobuttons.put(key, group);
        }
      }
    } catch (Exception ex) {
      System.err.println(ex.toString());
    }
  }
  public ConfigurationPanel(final Project project) {

    serverUrl.setName("serverUrl");
    buildDelay.setName("buildDelay");
    jobRefreshPeriod.setName("jobRefreshPeriod");
    rssRefreshPeriod.setName("rssRefreshPeriod");
    username.setName("_username_");

    passwordField.setName("passwordFile");
    crumbDataField.setName("crumbDataFile");

    testConnexionButton.setName("testConnexionButton");
    connectionStatusLabel.setName("connectionStatusLabel");

    successOrStableCheckBox.setName("successOrStableCheckBox");
    unstableOrFailCheckBox.setName("unstableOrFailCheckBox");
    abortedCheckBox.setName("abortedCheckBox");

    rssStatusFilterPanel.setBorder(IdeBorderFactory.createTitledBorder("Event Log Settings", true));

    debugPanel.setVisible(false);

    initDebugTextPane();

    buildDelay.setDocument(new NumberDocument());
    jobRefreshPeriod.setDocument(new NumberDocument());
    rssRefreshPeriod.setDocument(new NumberDocument());

    uploadPatchSettingsPanel.setBorder(
        IdeBorderFactory.createTitledBorder("Upload a Patch Settings", true));

    passwordField
        .getDocument()
        .addDocumentListener(
            new DocumentListener() {
              @Override
              public void insertUpdate(DocumentEvent e) {
                myPasswordModified = true;
              }

              @Override
              public void removeUpdate(DocumentEvent e) {
                myPasswordModified = true;
              }

              @Override
              public void changedUpdate(DocumentEvent e) {
                myPasswordModified = true;
              }
            });

    testConnexionButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            try {
              debugPanel.setVisible(false);

              new NotNullValidator().validate(serverUrl);
              new UrlValidator().validate(serverUrl);

              JenkinsSettings jenkinsSettings = JenkinsSettings.getSafeInstance(project);

              String password =
                  isPasswordModified() ? getPassword() : jenkinsSettings.getPassword();

              RequestManager.getInstance(project)
                  .authenticate(
                      serverUrl.getText(), username.getText(), password, crumbDataField.getText());
              setConnectionFeedbackLabel(CONNECTION_TEST_SUCCESSFUL_COLOR, "Successful");
              setPassword(password);
            } catch (Exception ex) {
              setConnectionFeedbackLabel(CONNECTION_TEST_FAILED_COLOR, "[Fail] " + ex.getMessage());
              if (ex instanceof AuthenticationException) {
                AuthenticationException authenticationException = (AuthenticationException) ex;
                String responseBody = authenticationException.getResponseBody();
                if (StringUtils.isNotBlank(responseBody)) {
                  debugPanel.setVisible(true);
                  debugTextPane.setText(responseBody);
                }
              }
            }
          }
        });

    formValidator =
        FormValidator.init(this)
            .addValidator(
                username,
                new UIValidator<JTextField>() {
                  public void validate(JTextField component) throws ConfigurationException {
                    if (StringUtils.isNotBlank(component.getText())) {
                      String password = getPassword();
                      if (StringUtils.isBlank(password)) {
                        throw new ConfigurationException(
                            String.format("'%s' must be set", passwordField.getName()));
                      }
                    }
                  }
                });
  }
Exemplo n.º 10
0
  private void initConfig() throws MissingResourceException {

    setLayout(new MigLayout("", "[::523.00px]", "[][5px:n][][5px:n][]"));

    panelPreprocess = new JPanel();
    panelPreprocess.setBorder(
        new TitledBorder(
            null,
            BUNDLE.getString("EpaSoftPanel.panelPreprocess.borderTitle"),
            TitledBorder.LEADING,
            TitledBorder.TOP,
            FONT_PANEL_TITLE,
            null));
    add(panelPreprocess, "cell 0 0,grow");
    panelPreprocess.setLayout(new MigLayout("", "[118px:n][118px:n][118px:n][118px:n]", "[]"));

    btnSectorSelection =
        new JButton(BUNDLE.getString("EpaSoftPanel.btnSectorSelection.text")); // $NON-NLS-1$
    btnSectorSelection.setEnabled(false);
    btnSectorSelection.setActionCommand("showSectorSelection");
    panelPreprocess.add(btnSectorSelection, "cell 0 0,growx");

    btnStateSelection = new JButton(BUNDLE.getString("EpaSoftPanel.btnStateSelection.text"));
    btnStateSelection.setEnabled(false);
    btnStateSelection.setActionCommand(
        BUNDLE.getString("EpaSoftPanel.btnStateSelection.actionCommand")); // $NON-NLS-1$
    panelPreprocess.add(btnStateSelection, "cell 1 0,growx");

    btnOptions = new JButton(BUNDLE.getString("EpaSoftPanel.btnDesign.text")); // $NON-NLS-1$
    btnOptions.setEnabled(false);
    btnOptions.setActionCommand("showOptions");
    panelPreprocess.add(btnOptions, "flowx,cell 2 0,growx");

    btnDesign = new JButton(BUNDLE.getString("EpaSoftPanel.btnRaingage.text")); // $NON-NLS-1$
    btnDesign.setEnabled(false);
    btnDesign.setActionCommand("showRaingage");
    panelPreprocess.add(btnDesign, "cell 3 0,growx");

    panelFileManager = new JPanel();
    panelFileManager.setBorder(
        new TitledBorder(
            null,
            BUNDLE.getString("EpaSoftPanel.panelFileManager.borderTitle"),
            TitledBorder.LEADING,
            TitledBorder.TOP,
            FONT_PANEL_TITLE,
            null));
    add(panelFileManager, "cell 0 2,grow");
    panelFileManager.setLayout(
        new MigLayout(
            "",
            "[][108.00][::3px][:238.00px:250px][::3px][:65px:65px]",
            "[::22px][34px:n][20][34px:n][20][][]"));

    chkExport = new JCheckBox();
    chkExport.setToolTipText(BUNDLE.getString("EpaSoftPanel.chkExport.toolTipText")); // $NON-NLS-1$
    chkExport.setActionCommand("exportSelected");
    chkExport.setText(BUNDLE.getString("EpaSoftPanel.chkExport.text"));
    panelFileManager.add(chkExport, "cell 0 0 2 1,aligny bottom");

    chkSubcatchments = new JCheckBox();
    chkSubcatchments.setToolTipText(
        BUNDLE.getString("EpaSoftPanel.chkSubcatchments.toolTipText")); // $NON-NLS-1$
    chkSubcatchments.setVisible(false);
    chkSubcatchments.setText(BUNDLE.getString("EpaSoftPanel.chkSubcatchments.text")); // $NON-NLS-1$
    panelFileManager.add(chkSubcatchments, "cell 3 0");

    JLabel label = new JLabel();
    label.setText(BUNDLE.getString("Form.label.text"));
    panelFileManager.add(label, "cell 1 1,alignx right");

    scrollPane_2 = new JScrollPane();
    panelFileManager.add(scrollPane_2, "cell 3 1,grow");

    txtFileInp = new JTextArea();
    scrollPane_2.setViewportView(txtFileInp);
    txtFileInp.setFont(new Font("Tahoma", Font.PLAIN, 11));
    txtFileInp.setLineWrap(true);

    btnFileInp = new JButton();
    btnFileInp.setMinimumSize(new Dimension(65, 9));
    btnFileInp.setActionCommand("chooseFileInp");
    btnFileInp.setText("...");
    btnFileInp.setFont(new Font("Tahoma", Font.BOLD, 12));
    panelFileManager.add(btnFileInp, "cell 5 1,growx");

    chkExec = new JCheckBox();
    chkExec.setToolTipText(BUNDLE.getString("EpaSoftPanel.chkExec.toolTipText")); // $NON-NLS-1$
    chkExec.setText(BUNDLE.getString("EpaSoftPanel.chkExec.text")); // $NON-NLS-1$
    chkExec.setName("chk_exec");
    panelFileManager.add(chkExec, "cell 0 2 3 1,alignx left,aligny bottom");

    lblFileRpt = new JLabel();
    lblFileRpt.setText(BUNDLE.getString("Form.label_1.text"));
    panelFileManager.add(lblFileRpt, "cell 1 3,alignx right");

    scrollPane_3 = new JScrollPane();
    panelFileManager.add(scrollPane_3, "cell 3 3,grow");

    txtFileRpt = new JTextArea();
    scrollPane_3.setViewportView(txtFileRpt);
    txtFileRpt.setFont(new Font("Tahoma", Font.PLAIN, 11));
    txtFileRpt.setLineWrap(true);

    btnFileRpt = new JButton();
    btnFileRpt.setMinimumSize(new Dimension(65, 9));
    btnFileRpt.setActionCommand("chooseFileRpt");
    btnFileRpt.setText("...");
    btnFileRpt.setFont(new Font("Tahoma", Font.BOLD, 12));
    panelFileManager.add(btnFileRpt, "cell 5 3,growx");

    chkImport = new JCheckBox();
    chkImport.setToolTipText(BUNDLE.getString("EpaSoftPanel.chkImport.toolTipText")); // $NON-NLS-1$
    chkImport.setText(BUNDLE.getString("EpaSoftPanel.chkImport.text"));
    chkImport.setName("chk_import");
    panelFileManager.add(chkImport, "cell 0 4 2 1,aligny bottom");

    lblResultName = new JLabel();
    lblResultName.setText(BUNDLE.getString("Form.label_2.text"));
    lblResultName.setName("lbl_project");
    panelFileManager.add(lblResultName, "cell 1 5,alignx right");

    txtResultName = new JTextField();
    txtResultName.setName("txt_project");
    MaxLengthTextDocument maxLength = new MaxLengthTextDocument(16);
    txtResultName.setDocument(maxLength);
    panelFileManager.add(txtResultName, "cell 3 5,growx,aligny top");

    btnAccept = new JButton();
    btnAccept.setMinimumSize(new Dimension(65, 23));
    btnAccept.setEnabled(false);
    btnAccept.setText(BUNDLE.getString("Generic.btnAccept.text"));
    btnAccept.setName("btn_accept_postgis");
    btnAccept.setActionCommand("execute");
    panelFileManager.add(btnAccept, "flowx,cell 5 6,alignx right");

    btnProjectPreferences = new JButton("Project Preferences");
    btnProjectPreferences.setMinimumSize(new Dimension(130, 23));
    btnProjectPreferences.setPreferredSize(new Dimension(115, 23));
    btnProjectPreferences.setActionCommand("openProjectPreferences");
    add(btnProjectPreferences, "flowx,cell 0 4,alignx right");

    setupListeners();
  }
Exemplo n.º 11
0
  public BiblioSearchLimitPanel(
      DatabankSchema schema, MarcQueryBuilder queryBuilder, int language, SearchUI utils) {
    super(new GridBagLayout(), queryBuilder);
    this.schema = schema;
    this.language = language;
    ButtonGroup g;

    props = PropertyUtils.loadProperties(getClass().getName(), LocaleUtils.getLocale(language));
    GuiUtils.setActionName(dateRangeAction, props.getProperty("date_range.name"));
    GuiUtils.setActionName(yearAction, props.getProperty("year.name"));
    this.utils = utils;

    lblCodingLevel = new JLabel(props.getProperty("coding_level.name"));
    cmCodingLevel = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_17);
    cmCodingLevel.setName("biblioCodingLevel");
    lblCodingLevel.setLabelFor(cmCodingLevel);

    lblCataloguingForm = new JLabel(props.getProperty("cataloguing_form.name"));
    cmCataloguingForm = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_18);
    cmCataloguingForm.setName("biblioCataloguingForm");
    lblCataloguingForm.setLabelFor(cmCataloguingForm);

    rBetween = new JRadioButton(props.getProperty("between.name"));
    rBetween.setName("biblioBetweenYears");
    rLt = new JRadioButton(props.getProperty("lt.name"));
    rLt.setName("biblioLessThanYear");
    rGt = new JRadioButton(props.getProperty("gt.name"));
    rGt.setName("biblioGreaterThanYear");
    txfYear = utils.queryTextField(4);
    txfYear.setName("biblioYearEquals");
    rYear = new JRadioButton(yearAction);
    rYear.setName("biblioYear");
    rDateRange = new JRadioButton(dateRangeAction);
    rDateRange.setName("biblioDateRange");
    lblDoctype = new JLabel(props.getProperty("biblio_doctype.name"));
    lblFrom = new JLabel(props.getProperty("from.name"));
    lblTo = new JLabel(props.getProperty("to.name"));
    lblLanguage = new JLabel(props.getProperty("language.name"));
    lblLocation = new JLabel(props.getProperty("location.name"));
    lblRetriveNo = new JLabel(props.getProperty("retriveNo.name"));
    lblRecType = new JLabel(props.getProperty("rectype.name"));
    lblRecStatus = new JLabel(props.getProperty("recstatus.name"));
    lblCalendar = new JLabel(props.getProperty("calendar.name"));
    lblBiblevel = new JLabel(props.getProperty("biblevel.name"));
    lblHierarchicalLevel = new JLabel(props.getProperty("hierarchical_level.name"));
    cmDoctype = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_DOC_TYPE);
    cmDoctype.setName("biblioDocType");
    cmLocation = utils.constantTableLookup(SearchEngineDocumentModel.LOCATION);
    cmLocation.setName("biblioLocation");
    cmLanguage = utils.constantTableLookup(SearchEngineDocumentModel.LANGUAGE);
    cmLanguage.setName("biblioLanguage");
    cmBiblevel = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_7);
    cmBiblevel.setName("biblioLevel");
    cmHierarchicalLevel = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_8);
    cmHierarchicalLevel.setName("biblioHierarchicalLevel");
    cmRecType = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_6);
    cmRecType.setName("biblioRecType");
    cmRecStatus = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_5);
    cmRecStatus.setName("biblioRecStatus");
    cmCalendar = utils.constantTableLookup(SearchEngineDocumentModel.CALENDAR);
    cmCalendar.setName("biblioCalendar");
    txfFrom = utils.queryTextField(10);
    txfFrom.setName("biblioFromYear");
    txfTo = utils.queryTextField(10);
    txfTo.setName("biblioToYear");
    txfRetriveNo = utils.queryTextField(10);
    txfRetriveNo.setName("retriveNo");
    lblDoctype.setLabelFor(cmDoctype);
    lblLocation.setLabelFor(cmLocation);
    lblLanguage.setLabelFor(cmLanguage);
    lblFrom.setLabelFor(txfFrom);
    lblTo.setLabelFor(txfTo);
    lblRetriveNo.setLabelFor(txfRetriveNo);
    lblTo.setVerticalTextPosition(JLabel.BOTTOM);
    lblCalendar.setHorizontalAlignment(JLabel.TRAILING);
    lblLanguage.setHorizontalAlignment(JLabel.TRAILING);
    lblRecType.setHorizontalAlignment(JLabel.TRAILING);
    lblDoctype.setHorizontalAlignment(JLabel.TRAILING);
    lblLocation.setHorizontalAlignment(JLabel.TRAILING);
    cbHasAttachment = new JCheckBox(props.getProperty("attachment.name"));
    cbIsOpenShelf = new JCheckBox(props.getProperty("openShelf.name"));
    cbIsLendable = new JCheckBox(props.getProperty("lendable.name"));
    rWithAttachment = new JRadioButton(props.getProperty("attachment-present.name"));
    rWithoutAttachment = new JRadioButton(props.getProperty("attachment-notpresent.name"));
    cbHasAttachment.setName("biblioAttachment");
    cbIsOpenShelf.setName("holdingIsOpenShelf");
    cbIsLendable.setName("holdingIsLendable");
    rWithAttachment.setName("biblioAttachmentPresent");
    rWithoutAttachment.setName("biblioAttachmentNotPresent");
    cbHasAttachment.addChangeListener(attachmentChangedListener);
    rWithAttachment.setEnabled(false);
    rWithoutAttachment.setEnabled(false);
    cbHasAttachment.setSelected(false);
    cbIsOpenShelf.setSelected(false);
    cbIsLendable.setSelected(false);
    g = new ButtonGroup();
    g.add(rWithAttachment);
    g.add(rWithoutAttachment);

    g = new ButtonGroup();
    g.add(rBetween);
    g.add(rLt);
    g.add(rGt);
    g = new ButtonGroup();
    g.add(rDateRange);
    g.add(rYear);
    rYear.setSelected(true);
    dateCriteriaChanged();

    lblDescriptionLevel = new JLabel(props.getProperty("level-of-description.name"));
    cmDescriptionLevel =
        utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_ISAD_LEVEL_OF_DESCRIPTION);
    cmDescriptionLevel.setName("biblioDescriptionLevel");
    lblDescriptionLevel.setLabelFor(cmDescriptionLevel);

    lblGMD = new JLabel(props.getProperty("general-material.name"));
    cmGMD = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_GMD_LIST);
    cmGMD.setName("biblioGMD");
    lblGMD.setLabelFor(cmGMD);

    lblLCClass = new JLabel(props.getProperty("lcclass.name"));
    txfLCClass = new JTextField(20);
    GuiUtils.localeSupport(txfLCClass);
    GuiUtils.setComponentOrientation(txfLCClass, ComponentOrientation.LEFT_TO_RIGHT);
    lblLCClass.setLabelFor(txfLCClass);

    LayoutFacility lf = new LayoutFacility(this);
    /*
            lf.add(lblCodingLevel,
                    new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0));
            lf.add(cmCodingLevel,
                    new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
    */
    int y = 0;
    lf.add(
        lblDoctype,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmDoctype,
        new GridBagConstraints(
            1,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblRecType,
        new GridBagConstraints(
            2,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_END,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmRecType,
        new GridBagConstraints(
            3,
            y++,
            GridBagConstraints.REMAINDER,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblGMD,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_END,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmGMD,
        new GridBagConstraints(
            1,
            y++,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    lf.add(
        lblLocation,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmLocation,
        new GridBagConstraints(
            1,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblLanguage,
        new GridBagConstraints(
            2,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmLanguage,
        new GridBagConstraints(
            3,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblBiblevel,
        new GridBagConstraints(
            4,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmBiblevel,
        new GridBagConstraints(
            5,
            y++,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    ////
    lf.add(
        lblCataloguingForm,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmCataloguingForm,
        new GridBagConstraints(
            1,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblHierarchicalLevel,
        new GridBagConstraints(
            2,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmHierarchicalLevel,
        new GridBagConstraints(
            3,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblRecStatus,
        new GridBagConstraints(
            4,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmRecStatus,
        new GridBagConstraints(
            5,
            y++,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    ////
    lf.add(
        lblCodingLevel,
        new GridBagConstraints(
            4,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmCodingLevel,
        new GridBagConstraints(
            5,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        rYear,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        txfYear,
        new GridBagConstraints(
            1,
            y,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblCalendar,
        new GridBagConstraints(
            2,
            y,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmCalendar,
        new GridBagConstraints(
            3,
            y++,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    lf.add(
        rDateRange,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    LayoutFacility datelf = new LayoutFacility(new JPanel());
    datelf.add(
        lblFrom,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 5, 2, 5),
            0,
            0));
    datelf.add(
        txfFrom,
        new GridBagConstraints(
            2,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    datelf.add(
        rGt,
        new GridBagConstraints(
            3,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    datelf.add(
        rBetween,
        new GridBagConstraints(
            4,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    datelf.add(
        rLt,
        new GridBagConstraints(
            5,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    datelf.add(
        lblTo,
        new GridBagConstraints(
            6,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 5, 2, 5),
            0,
            0));
    datelf.add(
        txfTo,
        new GridBagConstraints(
            7,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    datelf.add(
        Box.createHorizontalGlue(),
        new GridBagConstraints(
            8,
            1,
            GridBagConstraints.REMAINDER,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_END,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    lf.add(
        datelf.container,
        new GridBagConstraints(
            1,
            y++,
            GridBagConstraints.REMAINDER,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    LayoutFacility lcClasslf = new LayoutFacility(new JPanel());
    lcClasslf.add(
        lblLCClass,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 5, 2, 5),
            0,
            0));
    lcClasslf.add(
        txfLCClass,
        new GridBagConstraints(
            2,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    lf.add(
        lcClasslf.container,
        new GridBagConstraints(
            0,
            y++,
            2,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    LayoutFacility attLf = LayoutFacility.createLayoutFacility();
    int x = 0;
    attLf.add(
        cbHasAttachment,
        new GridBagConstraints(
            x++,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    attLf.add(
        cbIsOpenShelf,
        new GridBagConstraints(
            x++,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    //        attLf.add(cbIsLendable,
    //        		new GridBagConstraints(x++, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START,
    // GridBagConstraints.NONE, new Insets(2, 2, 2, 10), 0, 0));
    attLf.add(
        lblRetriveNo,
        new GridBagConstraints(
            x++,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 20, 2, 2),
            0,
            0));
    attLf.add(
        txfRetriveNo,
        new GridBagConstraints(
            x++,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            25,
            0));

    if (SystemUtils.isISADAvailable()) {
      attLf.add(
          lblDescriptionLevel,
          new GridBagConstraints(
              x++,
              0,
              1,
              1,
              0.0,
              0.0,
              GridBagConstraints.LINE_START,
              GridBagConstraints.HORIZONTAL,
              new Insets(2, 20, 2, 2),
              0,
              0));
      attLf.add(
          cmDescriptionLevel,
          new GridBagConstraints(
              x++,
              0,
              1,
              1,
              0.0,
              0.0,
              GridBagConstraints.LINE_START,
              GridBagConstraints.NONE,
              new Insets(2, 2, 2, 2),
              0,
              0));
    }

    /*
            attLf.add(rWithAttachment,
                    new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
            attLf.add(rWithoutAttachment,
                    new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
    */

    lf.add(
        attLf.container,
        new GridBagConstraints(
            0,
            y,
            GridBagConstraints.REMAINDER,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    //        lf.add(Box.createHorizontalGlue(),
    //                new GridBagConstraints(1, 4, 0, 1, 0.0, 0.0, GridBagConstraints.LINE_START,
    // GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0));

    ChangeListener limitChangeListener =
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            txfFrom.setEditable(!rLt.isSelected() && rDateRange.isSelected());
            txfTo.setEditable(!rGt.isSelected() && rDateRange.isSelected());
          }
        };
    rGt.addChangeListener(limitChangeListener);
    rLt.addChangeListener(limitChangeListener);
    rBetween.addChangeListener(limitChangeListener);
    rGt.setSelected(true);
  }
Exemplo n.º 12
0
    private void createUI() {

      ActionListener productNodeCheckListener =
          new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
              updateUIState();
            }
          };

      checkers = new ArrayList<JCheckBox>(10);
      JPanel checkersPane = GridBagUtils.createPanel();
      setComponentName(checkersPane, "CheckersPane");

      GridBagConstraints gbc =
          GridBagUtils.createConstraints("insets.left=4,anchor=WEST,fill=HORIZONTAL");
      for (int i = 0; i < productNodes.length; i++) {
        ProductNode productNode = (ProductNode) productNodes[i];

        String name = productNode.getName();
        JCheckBox productNodeCheck = new JCheckBox(name);
        productNodeCheck.setSelected(selected);
        productNodeCheck.setFont(SMALL_PLAIN_FONT);
        productNodeCheck.addActionListener(productNodeCheckListener);

        if (includeAlways != null && StringUtils.containsIgnoreCase(includeAlways, name)) {
          productNodeCheck.setSelected(true);
          productNodeCheck.setEnabled(false);
        } else if (givenProductSubsetDef != null) {
          productNodeCheck.setSelected(givenProductSubsetDef.containsNodeName(name));
        }
        checkers.add(productNodeCheck);

        String description = productNode.getDescription();
        JLabel productNodeLabel = new JLabel(description != null ? description : " ");
        productNodeLabel.setFont(SMALL_ITALIC_FONT);

        GridBagUtils.addToPanel(
            checkersPane, productNodeCheck, gbc, "weightx=0,gridx=0,gridy=" + i);
        GridBagUtils.addToPanel(
            checkersPane, productNodeLabel, gbc, "weightx=1,gridx=1,gridy=" + i);
      }
      // Add a last 'filler' row
      GridBagUtils.addToPanel(
          checkersPane,
          new JLabel(" "),
          gbc,
          "gridwidth=2,weightx=1,weighty=1,gridx=0,gridy=" + productNodes.length);

      ActionListener allCheckListener =
          new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
              if (e.getSource() == allCheck) {
                checkAllProductNodes(true);
              } else if (e.getSource() == noneCheck) {
                checkAllProductNodes(false);
              }
              updateUIState();
            }
          };

      allCheck = new JCheckBox("Select all");
      allCheck.setName("selectAll");
      allCheck.setMnemonic('a');
      allCheck.addActionListener(allCheckListener);

      noneCheck = new JCheckBox("Select none");
      noneCheck.setName("SelectNone");
      noneCheck.setMnemonic('n');
      noneCheck.addActionListener(allCheckListener);

      JScrollPane scrollPane = new JScrollPane(checkersPane);
      scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
      scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

      JPanel buttonRow = new JPanel(new FlowLayout(FlowLayout.LEFT, 4, 4));
      buttonRow.add(allCheck);
      buttonRow.add(noneCheck);

      setLayout(new BorderLayout());
      add(scrollPane, BorderLayout.CENTER);
      add(buttonRow, BorderLayout.SOUTH);
      setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7));

      updateUIState();
    }
Exemplo n.º 13
0
  public TechnicianPanel(MWClient mwclient) {
    super();
    /*
     * TECH PANEL CONSTRUCTION Technician (and bays from XP) options.
     */
    JPanel techsBox = new JPanel();
    techsBox.setLayout(new BoxLayout(techsBox, BoxLayout.Y_AXIS));
    JPanel techsCBoxFlow = new JPanel();
    JPanel techsSendRecPayFlow = new JPanel();
    JPanel techSpring = new JPanel(new SpringLayout());
    techsBox.add(techsCBoxFlow);
    techsBox.add(techsSendRecPayFlow);
    techsBox.add(techSpring);

    // the basic CBox flow
    BaseCheckBox = new JCheckBox("Use Techs");
    BaseCheckBox.setToolTipText("Unchecking disables technicians. Not advised.");

    BaseCheckBox.setName("UseTechnicians");
    techsCBoxFlow.add(BaseCheckBox);

    BaseCheckBox = new JCheckBox("Use XP");

    BaseCheckBox.setToolTipText("Check grants additional technicians w/ XP.");
    BaseCheckBox.setName("UseExperience");
    techsCBoxFlow.add(BaseCheckBox);

    BaseCheckBox = new JCheckBox("Decreasing Cost");

    BaseCheckBox.setToolTipText("Checking lowers tech hiring costs w/ XP.");
    BaseCheckBox.setName("DecreasingTechCost");
    techsCBoxFlow.add(BaseCheckBox);

    BaseCheckBox = new JCheckBox("Disable Tech Advancement");
    BaseCheckBox.setToolTipText("Checking disables tech advancement and retiring");
    BaseCheckBox.setName("DisableTechAdvancement");
    techsCBoxFlow.add(BaseCheckBox);

    // the sendRecPay flow.
    BaseCheckBox = new JCheckBox("Sender Pays");

    BaseCheckBox.setToolTipText("If checked, a player sending a unit will pay techs.");
    BaseCheckBox.setName("SenderPaysOnTransfer");
    techsSendRecPayFlow.add(BaseCheckBox);

    BaseCheckBox = new JCheckBox("Recipient Pays");

    BaseCheckBox.setToolTipText("If checked, a player receiving a unit will pay techs.");
    BaseCheckBox.setName("ReceiverPaysOnTransfer");
    techsSendRecPayFlow.add(BaseCheckBox);

    // set up the spring
    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Base Tech Cost:", SwingConstants.TRAILING));
    baseTextField.setToolTipText("Starting cost to hire a technician");
    baseTextField.setName("BaseTechCost");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("XP for Decrease:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        "Amount of XP required to reduce hiring cost by 1 "
            + mwclient.moneyOrFluMessage(true, true, -1));
    baseTextField.setName("XPForDecrease");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Minimum Tech Cost:", SwingConstants.TRAILING));
    baseTextField.setToolTipText("Lowest hiring price. XP cannot reduce below this level.");
    baseTextField.setName("MinimumTechCost");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Additive Per Tech:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        "<HTML>"
            + "Use additive costs -- each tech costs as much as the last one, plus the additive. EG -<br>"
            + "with .05 set, the first tech would cost .05, the second .10, the third .15, the fourth .20,<br>"
            + "such that your first 4 techs cost haf a Cbill (total) to maintain, while the 10th tech costs<br>"
            + "half a "
            + mwclient.moneyOrFluMessage(true, true, -1)
            + " all by himself. A cap on this price can be set, after which there is no further<br>"
            + "increase. The ceiling ABSOLUTELY MUST be a multiple of the additive.</HTML>");
    baseTextField.setName("AdditivePerTech");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Additive Ceiling:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        "Additive ceiling. Post-game per-tech costs don't increase past this level.");
    baseTextField.setName("AdditiveCostCeiling");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Transfer Payment:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        "Percentage of usual post-game cost charged if transfer fees are enabled.");
    baseTextField.setName("TransferPayment");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Maint Increase:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        "Amount maintainance level is increased each slice a unit is maintained");
    baseTextField.setName("MaintainanceIncrease");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Maint Decrease:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        "Amount maintainance level is lowered each slice a unit is unmaintained");
    baseTextField.setName("MaintainanceDecrease");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Base Unmaint Level:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        "Mainatainance level set when a unit is first unmaintained. Set to 100 to disable.");
    baseTextField.setName("BaseUnmaintainedLevel");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Unmaintain Penalty:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        ""
            + "<HTML>Maintainance reduction for units which are already below 100. If the BaseLevel is lower than current<br>"
            + "level minus penalty, it is used instead. Example1: A unit has a maintainance level of 90 and is set to<br>"
            + "unmaintained status. The unmaint penalty is 10 and base elvel is 75. 90-10 = 80, so the base level of 75 is<br>"
            + "set. Example2: A unit has an mlevel of 80 and is set to unmaintained. 80 - 10 = 70. 70 is set and the base<br>"
            + "level (75) is ignored.</HTML>");
    baseTextField.setName("UnmaintainedPenalty");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Transfer Scrap Level:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        "<HTML>Units @ or under this maint. level must survive a scrap check<br>to be transfered. Set to 0 to disable</HTML>");
    baseTextField.setName("TransferScrapLevel");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Techs To Proto Point Ratio:", SwingConstants.TRAILING));
    baseTextField.setToolTipText("<HTML>Ratio of Techs to 5 Protos Default 1 tech</HTML>");
    baseTextField.setName("TechsToProtoPointRatio");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Techs per Light Mek:", SwingConstants.TRAILING));
    baseTextField.setToolTipText("<HTML>Number of Techs it takes to maintain a light Mek</HTML>");
    baseTextField.setName("TechsForLightMek");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Techs per Medium Mek:", SwingConstants.TRAILING));
    baseTextField.setToolTipText("<HTML>Number of Techs it takes to maintain a medium Mek</HTML>");
    baseTextField.setName("TechsForMediumMek");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Techs per Heavy Mek:", SwingConstants.TRAILING));
    baseTextField.setToolTipText("<HTML>Number of Techs it takes to maintain a heavy Mek</HTML>");
    baseTextField.setName("TechsForHeavyMek");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Techs per Assault Mek:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        "<HTML>Number of Techs it takes to maintain an assault Mek</HTML>");
    baseTextField.setName("TechsForAssaultMek");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Techs per Light Vehicle:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        "<HTML>Number of Techs it takes to maintain a light Vehicle</HTML>");
    baseTextField.setName("TechsForLightVehicle");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Techs per Medium Vehicle:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        "<HTML>Number of Techs it takes to maintain a medium Vehicle</HTML>");
    baseTextField.setName("TechsForMediumVehicle");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Techs per Heavy Vehicle:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        "<HTML>Number of Techs it takes to maintain a heavy Vehicle</HTML>");
    baseTextField.setName("TechsForHeavyVehicle");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Techs per Assault Vehicle:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        "<HTML>Number of Techs it takes to maintain an assault Vehicle</HTML>");
    baseTextField.setName("TechsForAssaultVehicle");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Techs per Light Infantry:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        "<HTML>Number of Techs it takes to maintain a light Infantry</HTML>");
    baseTextField.setName("TechsForLightInfantry");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Techs per Medium Infantry:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        "<HTML>Number of Techs it takes to maintain a medium Infantry</HTML>");
    baseTextField.setName("TechsForMediumInfantry");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Techs per Heavy Infantry:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        "<HTML>Number of Techs it takes to maintain a heavy Infantry</HTML>");
    baseTextField.setName("TechsForHeavyInfantry");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Techs per Assault Infantry:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        "<HTML>Number of Techs it takes to maintain an assault Infantry</HTML>");
    baseTextField.setName("TechsForAssaultInfantry");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Techs per Light BattleArmor:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        "<HTML>Number of Techs it takes to maintain a light BattleArmor</HTML>");
    baseTextField.setName("TechsForLightBattleArmor");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Techs per Medium BattleArmor:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        "<HTML>Number of Techs it takes to maintain a medium BattleArmor</HTML>");
    baseTextField.setName("TechsForMediumBattleArmor");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Techs per Heavy BattleArmor:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        "<HTML>Number of Techs it takes to maintain a heavy BattleArmor</HTML>");
    baseTextField.setName("TechsForHeavyBattleArmor");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Techs per Assault BattleArmor:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        "<HTML>Number of Techs it takes to maintain an assault BattleArmor</HTML>");
    baseTextField.setName("TechsForAssaultBattleArmor");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Techs per Light Aero:", SwingConstants.TRAILING));
    baseTextField.setToolTipText("<HTML>Number of Techs it takes to maintain a light Aero</HTML>");
    baseTextField.setName("TechsForLightAero");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Techs per Medium Aero:", SwingConstants.TRAILING));
    baseTextField.setToolTipText("<HTML>Number of Techs it takes to maintain a medium Aero</HTML>");
    baseTextField.setName("TechsForMediumAero");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Techs per Heavy Aero:", SwingConstants.TRAILING));
    baseTextField.setToolTipText("<HTML>Number of Techs it takes to maintain a heavy Aero</HTML>");
    baseTextField.setName("TechsForHeavyAero");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Techs per Assault Aero:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        "<HTML>Number of Techs it takes to maintain an assault Aero</HTML>");
    baseTextField.setName("TechsForAssaultAero");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Non-House Unit Increased Techs:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        "Float field.  Multiplier to tech cost of non-house units.  Only used with Tech Repair.");
    baseTextField.setName("NonFactionUnitsIncreasedTechs");
    techSpring.add(baseTextField);

    baseTextField = new JTextField(5);
    techSpring.add(new JLabel("Max Techs to Hire:", SwingConstants.TRAILING));
    baseTextField.setToolTipText(
        "Integer field.  Max number of techs that can be hired.  Set to -1 for unlimited.  Users with more than this number of techs will lose them at next login.");
    baseTextField.setName("MaxTechsToHire");
    techSpring.add(baseTextField);

    SpringLayoutHelper.setupSpringGrid(techSpring, 4);

    // finalize the layout
    add(techsBox);
  }
  public DiameterCutOptionsTargetPanel() {
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    panel.add(GUIFactory.createLabel("Lungime:", 100));
    JFormattedTextField length = GUIFactory.createNumberInput(4100L, 0L, 1000000L, 80);
    panel.add(length);
    JComboBox<String> mCombo = new JComboBox<String>(GUIUtil.metric);
    mCombo.addItemListener(this);
    mCombo = new JComboBox<String>(GUIUtil.metric);
    mCombo.setPreferredSize(new Dimension(50, mCombo.getPreferredSize().height));
    panel.add(mCombo);
    add(panel);

    panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    panel.add(GUIFactory.createLabel("Diametru 1:", 100));
    JFormattedTextField smallRadius = GUIFactory.createNumberInput(200L, 0L, 1000000L, 80);
    panel.add(smallRadius);
    mCombo = new JComboBox<String>(GUIUtil.metric);
    mCombo.addItemListener(this);
    mCombo = new JComboBox<String>(GUIUtil.metric);
    mCombo.setPreferredSize(new Dimension(50, mCombo.getPreferredSize().height));
    panel.add(mCombo);
    add(panel);

    panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    panel.add(GUIFactory.createLabel("Diametru 2:", 100));
    JFormattedTextField bigRadius = GUIFactory.createNumberInput(600L, 0L, 1000000L, 80);
    panel.add(bigRadius);
    mCombo = new JComboBox<String>(GUIUtil.metric);
    mCombo.addItemListener(this);
    mCombo = new JComboBox<String>(GUIUtil.metric);
    mCombo.setPreferredSize(new Dimension(50, mCombo.getPreferredSize().height));
    panel.add(mCombo);
    add(panel);

    panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    label2 = GUIFactory.createLabel("Produse:", 100);
    panel.add(label2);
    products = ProductDAO.getProducts();
    JPanel productsPanel = new JPanel();
    productsPanel.setLayout(new BoxLayout(productsPanel, BoxLayout.Y_AXIS));
    for (Product product : products) {
      JPanel row = new JPanel(new FlowLayout(FlowLayout.LEFT));
      JCheckBox chk = new JCheckBox();
      row.add(chk);
      selection.add(chk);
      chk.setName("length" + (long) product.getLength());
      row.add(new JLabel(product.getName()));
      productsPanel.add(row);
    }
    JScrollPane scrollPane = new JScrollPane(productsPanel);
    scrollPane.setPreferredSize(new Dimension(productsPanel.getPreferredSize().width + 20, 215));
    panel.add(scrollPane);
    add(panel);

    JPanel filtru = new JPanel(new FlowLayout(FlowLayout.LEADING));
    filtru.add(filtru2m);
    filtru.add(filtru3m);
    filtru.add(filtru4m);
    filtru2m.setActionCommand("FILTRU2");
    filtru3m.setActionCommand("FILTRU3");
    filtru4m.setActionCommand("FILTRU4");
    filtru2m.addActionListener(this);
    filtru3m.addActionListener(this);
    filtru4m.addActionListener(this);
    panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    JLabel label1 = GUIFactory.createLabel("Filtru", 100);
    panel.add(label1);
    panel.add(filtru);
    add(panel);

    cancel.setActionCommand("CANCEL_DIALOG");
    cancel.addActionListener(GUIUtil.main);
    see.addActionListener(this);
  }
Exemplo n.º 15
0
  protected void build() {
    setLayout(new GridBagLayout());
    GridBagConstraints gc = new GridBagConstraints();

    // ------------------
    gc.gridx = 0;
    gc.gridy = 0;
    gc.gridwidth = 1;
    gc.gridheight = 1;
    gc.fill = GridBagConstraints.NONE;
    gc.anchor = GridBagConstraints.CENTER;
    gc.weightx = 0.0;
    gc.weighty = 0.0;
    gc.insets = new Insets(10, 0, 0, 0);
    lblMyVersion = new JLabel(tr("My version"));
    lblMyVersion.setToolTipText(tr("List of elements in my dataset, i.e. the local dataset"));
    add(lblMyVersion, gc);

    gc.gridx = 2;
    gc.gridy = 0;
    lblMergedVersion = new JLabel(tr("Merged version"));
    lblMergedVersion.setToolTipText(
        tr(
            "List of merged elements. They will replace the list of my elements when the merge decisions are applied."));
    add(lblMergedVersion, gc);

    gc.gridx = 4;
    gc.gridy = 0;
    lblTheirVersion = new JLabel(tr("Their version"));
    lblTheirVersion.setToolTipText(
        tr("List of elements in their dataset, i.e. the server dataset"));
    add(lblTheirVersion, gc);

    // ------------------------------
    gc.gridx = 0;
    gc.gridy = 1;
    gc.gridwidth = 1;
    gc.gridheight = 1;
    gc.fill = GridBagConstraints.HORIZONTAL;
    gc.anchor = GridBagConstraints.FIRST_LINE_START;
    gc.weightx = 0.33;
    gc.weighty = 0.0;
    gc.insets = new Insets(0, 0, 0, 0);
    JCheckBox cbLockMyScrolling = new JCheckBox();
    cbLockMyScrolling.setName("checkbox.lockmyscrolling");
    add(buildAdjustmentLockControlPanel(cbLockMyScrolling), gc);

    gc.gridx = 2;
    gc.gridy = 1;
    JCheckBox cbLockMergedScrolling = new JCheckBox();
    cbLockMergedScrolling.setName("checkbox.lockmergedscrolling");
    add(buildAdjustmentLockControlPanel(cbLockMergedScrolling), gc);

    gc.gridx = 4;
    gc.gridy = 1;
    JCheckBox cbLockTheirScrolling = new JCheckBox();
    cbLockTheirScrolling.setName("checkbox.locktheirscrolling");
    add(buildAdjustmentLockControlPanel(cbLockTheirScrolling), gc);

    // --------------------------------
    gc.gridx = 0;
    gc.gridy = 2;
    gc.gridwidth = 1;
    gc.gridheight = 1;
    gc.fill = GridBagConstraints.BOTH;
    gc.anchor = GridBagConstraints.FIRST_LINE_START;
    gc.weightx = 0.33;
    gc.weighty = 1.0;
    gc.insets = new Insets(0, 0, 0, 0);
    JScrollPane pane = buildMyElementsTable();
    adjustmentSynchronizer.adapt(cbLockMyScrolling, pane.getVerticalScrollBar());
    add(pane, gc);

    gc.gridx = 1;
    gc.gridy = 2;
    gc.fill = GridBagConstraints.NONE;
    gc.anchor = GridBagConstraints.CENTER;
    gc.weightx = 0.0;
    gc.weighty = 0.0;
    add(buildLeftButtonPanel(), gc);

    gc.gridx = 2;
    gc.gridy = 2;
    gc.fill = GridBagConstraints.BOTH;
    gc.anchor = GridBagConstraints.FIRST_LINE_START;
    gc.weightx = 0.33;
    gc.weighty = 0.0;
    pane = buildMergedElementsTable();
    adjustmentSynchronizer.adapt(cbLockMergedScrolling, pane.getVerticalScrollBar());
    add(pane, gc);

    gc.gridx = 3;
    gc.gridy = 2;
    gc.fill = GridBagConstraints.NONE;
    gc.anchor = GridBagConstraints.CENTER;
    gc.weightx = 0.0;
    gc.weighty = 0.0;
    add(buildRightButtonPanel(), gc);

    gc.gridx = 4;
    gc.gridy = 2;
    gc.fill = GridBagConstraints.BOTH;
    gc.anchor = GridBagConstraints.FIRST_LINE_START;
    gc.weightx = 0.33;
    gc.weighty = 0.0;
    pane = buildTheirElementsTable();
    adjustmentSynchronizer.adapt(cbLockTheirScrolling, pane.getVerticalScrollBar());
    add(pane, gc);

    // ----------------------------------
    gc.gridx = 2;
    gc.gridy = 3;
    gc.gridwidth = 1;
    gc.gridheight = 1;
    gc.fill = GridBagConstraints.BOTH;
    gc.anchor = GridBagConstraints.CENTER;
    gc.weightx = 0.0;
    gc.weighty = 0.0;
    add(buildMergedListControlButtons(), gc);

    // -----------------------------------
    gc.gridx = 0;
    gc.gridy = 4;
    gc.gridwidth = 2;
    gc.gridheight = 1;
    gc.fill = GridBagConstraints.HORIZONTAL;
    gc.anchor = GridBagConstraints.LINE_START;
    gc.weightx = 0.0;
    gc.weighty = 0.0;
    add(buildComparePairSelectionPanel(), gc);

    gc.gridx = 2;
    gc.gridy = 4;
    gc.gridwidth = 3;
    gc.gridheight = 1;
    gc.fill = GridBagConstraints.HORIZONTAL;
    gc.anchor = GridBagConstraints.LINE_START;
    gc.weightx = 0.0;
    gc.weighty = 0.0;
    add(buildFrozeStateControlPanel(), gc);

    wireActionsToSelectionModels();
  }
  /**
   * Creates the histogram using data accumulated thus far.
   *
   * @param oLegend Legend for this chart.
   * @param sChartTitle Title for this chart.
   * @return The new chart window.
   * @throws sortie.data.simpletypes.ModelException Passing through underlying exceptions.
   */
  ModelInternalFrame drawChart(Legend oLegend, String sChartTitle) throws ModelException {
    int i;

    ModelHistogramDataset oAdjustedDataset = updateForVisible(oLegend);

    // Make the chart
    m_oChartFrame =
        DataGrapher.drawHistogram(
            oAdjustedDataset, m_sLabel, "Total Number", sChartTitle, oLegend, this);

    // Add the extra controls to the top of the histogram window
    JPanel jLine1Controls = new JPanel(new FlowLayout(FlowLayout.LEFT));

    // Bins boxes
    JLabel jTemp = new JLabel("Number of bins:");
    jTemp.setFont(new sortie.gui.components.SortieFont());
    jLine1Controls.add(jTemp);

    JTextField jNumBins = new JTextField(String.valueOf(m_iNumBins));
    jNumBins.setFont(new SortieFont());
    jNumBins.setPreferredSize(
        new java.awt.Dimension(50, (int) jNumBins.getPreferredSize().getHeight()));
    jNumBins.setName(NUMBER_BINS_NAME);
    jLine1Controls.add(jNumBins);

    jTemp = new JLabel("Bin size:");
    jTemp.setFont(new sortie.gui.components.SortieFont());
    jLine1Controls.add(jTemp);

    JTextField jBinSize = new JTextField(m_jFormat.format(m_fBinSize));
    jBinSize.setFont(new SortieFont());
    jBinSize.setPreferredSize(
        new java.awt.Dimension(50, (int) jBinSize.getPreferredSize().getHeight()));
    jBinSize.setName(BIN_SIZE_NAME);
    jLine1Controls.add(jBinSize);

    // Button to change
    JButton jButton = new JButton("Change");
    jButton.setFont(new sortie.gui.components.SortieFont());
    jButton.setActionCommand("UpdateBins");
    jButton.addActionListener(this);
    jLine1Controls.add(jButton);

    // Checkbox for logarithmic axis
    JCheckBox jCheckBox = new JCheckBox("Use Logarithmic Axis", getUseLogarithmicAxis());
    jCheckBox.setFont(new SortieFont());
    jCheckBox.setName("log_checkbox");
    jCheckBox.addActionListener(this);
    jLine1Controls.add(jCheckBox);

    // Checkbox for showing total bars
    jCheckBox = new JCheckBox("Show Totals", m_bShowTotal);
    jCheckBox.setFont(new sortie.gui.components.SortieFont());
    jCheckBox.setName("total_checkbox");
    jCheckBox.addActionListener(this);
    jLine1Controls.add(jCheckBox);

    JPanel jLine2Controls = new JPanel(new FlowLayout(FlowLayout.LEFT));
    jTemp = new JLabel("Min value:");
    jTemp.setFont(new sortie.gui.components.SortieFont());
    jLine2Controls.add(jTemp);
    m_jMinDatasetValue.setFont(new sortie.gui.components.SortieFont());
    if (m_bIsInt) m_jMinDatasetValue.setText(String.valueOf((int) m_fDatasetMin));
    else m_jMinDatasetValue.setText(String.valueOf(m_jFormat.format(m_fDatasetMin)));
    jLine2Controls.add(m_jMinDatasetValue);
    jTemp = new JLabel("Max value:");
    jTemp.setFont(new sortie.gui.components.SortieFont());
    jLine2Controls.add(jTemp);
    m_jMaxDatasetValue.setFont(new sortie.gui.components.SortieFont());
    if (m_bIsInt) m_jMaxDatasetValue.setText(String.valueOf((int) m_fDatasetMax));
    else m_jMaxDatasetValue.setText(String.valueOf(m_jFormat.format(m_fDatasetMax)));
    jLine2Controls.add(m_jMaxDatasetValue);

    // Remove the chart, which is the content panel
    org.jfree.chart.ChartPanel jChart = null;
    for (i = 0; i < m_oChartFrame.getContentPane().getComponentCount(); i++) {
      if (m_oChartFrame.getContentPane().getComponent(i) instanceof org.jfree.chart.ChartPanel) {
        jChart = (org.jfree.chart.ChartPanel) m_oChartFrame.getContentPane().getComponent(i);
      }
    }

    JPanel jControls = new JPanel();
    jControls.setLayout(new BoxLayout(jControls, BoxLayout.PAGE_AXIS));
    jControls.add(jLine1Controls);
    jControls.add(jLine2Controls);

    // Recreate the content pane with the controls and the chart
    JPanel jContentPanel = new JPanel(new java.awt.BorderLayout());
    jContentPanel.setLayout(new java.awt.BorderLayout());
    jContentPanel.add(jControls, java.awt.BorderLayout.NORTH);
    jContentPanel.add(jChart, java.awt.BorderLayout.CENTER);

    m_oChartFrame.setContentPane(jContentPanel);

    return m_oChartFrame;
  }
  public LaenderInfos(Land[] countries) {
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // 10 JLabels erstellen
    label = new JLabel[10];

    // Panel fuer die Labels.
    panel = new JPanel();
    panel.setLayout(new GridLayout(0, 2));

    label[0] = new JLabel("Land:");
    label[1] = new JLabel();
    label[1].setName("countryName");
    label[2] = new JLabel("Hauptstadt:");
    label[3] = new JLabel();
    label[3].setName("capital");
    label[4] = new JLabel("Einwohner:");
    label[5] = new JLabel();
    label[5].setName("population");
    label[6] = new JLabel("Flaeche (in qkm):");
    label[7] = new JLabel();
    label[7].setName("area");
    label[8] = new JLabel("Bevoelkerungsdichte (in Personen pro qkm):");
    label[9] = new JLabel();
    label[9].setName("density");

    panel.add(label[0]);
    panel.add(label[1]);
    panel.add(label[2]);
    panel.add(label[3]);
    panel.add(label[4]);
    panel.add(label[5]);
    panel.add(label[6]);
    panel.add(label[7]);
    panel.add(label[8]);
    panel.add(label[9]);

    this.countries = countries;

    countrySelector = new JComboBox();
    countrySelector.setName("countrySelector");
    countrySelector.addActionListener(this);

    for (Land land : countries) {
      countrySelector.addItem(land);
    }

    exactValues = new JCheckBox("genau Angaben");
    exactValues.setName("exactValues");
    exactValues.addActionListener(this);

    add(countrySelector);
    add(exactValues);

    setLayout(new GridLayout(0, 1));

    drawLand();

    add(panel);

    setLocation(200, 200);
    setSize(530, 210);
    setVisible(true);
  }
Exemplo n.º 18
0
  /**
   * Creates the panel for a view class according to a <code>HashMap</code> of values
   *
   * @param className the full qualified class name
   * @param defaults the defaults to create the panel for
   * @return a jpanel containing ui elements for a specific set of properties
   */
  @SuppressWarnings("unchecked")
  public JPanel createParamPanel(String className, HashMap defaults) {

    JPanel panel = new JPanel(new GridBagLayout());
    panel.setBackground(Color.WHITE);
    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    GridBagConstraints constraints = new GridBagConstraints();

    constraints.gridwidth = 1;
    constraints.insets = new Insets(3, 3, 3, 3);
    constraints.anchor = GridBagConstraints.NORTHWEST;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.weightx = 1.0;

    int row = 0;

    Object[] keys = defaults.keySet().toArray();
    Arrays.sort(keys);

    for (int k = 0; k < keys.length; k++) {

      String key = (String) keys[k];

      if (key.startsWith(className) && !key.endsWith("optionValues")) {

        constraints.gridy = row;
        constraints.gridx = 0;

        JLabel label = new JLabel(resources.getResourceByKey(key));
        panel.add(label, constraints);

        if (defaults.get(key) instanceof String) {

          if (defaults.get(key + ".optionValues") != null) {

            String optionValues = (String) defaults.get(key + ".optionValues");

            JComboBox comboBox = new JComboBox();
            comboBox.setName(key);

            String value = (String) defaults.get(key);

            String[] options = optionValues.split(",");

            for (int i = 0; i < options.length; i++) {
              comboBox.addItem(options[i]);
            }

            comboBox.setSelectedItem(value);

            constraints.gridx = 1;
            panel.add(comboBox, constraints);

          } else {

            JTextField textfield = new JTextField(30);
            textfield.setName(key);
            String value = (String) defaults.get(key);
            textfield.setText(value);
            constraints.gridx = 1;
            panel.add(textfield, constraints);
          }

        } else if (defaults.get(key) instanceof Boolean) {
          JCheckBox checkBox = new JCheckBox();
          checkBox.setName(key);
          checkBox.setBackground(Color.WHITE);
          Boolean value = (Boolean) defaults.get(key);
          checkBox.setSelected(value);
          constraints.gridx = 1;
          panel.add(checkBox, constraints);
        } else if (defaults.get(key) instanceof Integer) {
          JSpinner spinner = new JSpinner();
          spinner.setName(key);
          Integer value = (Integer) defaults.get(key);
          spinner.setValue(value);
          constraints.gridx = 1;
          panel.add(spinner, constraints);
        } else if (defaults.get(key) instanceof FileObject) {
          FileBrowserTextfield textField = new FileBrowserTextfield();
          textField.setBackground(Color.WHITE);
          textField.setName(key);
          FileObject value = (FileObject) defaults.get(key);
          textField.getPathField().setText(value.getAbsolutePath());
          textField.getPathField().setBackground(Color.WHITE);
          constraints.gridx = 1;
          panel.add(textField, constraints);
        }

        row++;
      }
    }

    /** Add fill label for GridBagLayout */
    constraints.weighty = 1.0;
    constraints.fill = GridBagConstraints.BOTH;
    panel.add(new JLabel(), constraints);

    return panel;
  }