Ejemplo n.º 1
0
  /*
   * (non-Javadoc)
   *
   * @see
   * com.intel.hpc.stl.ui.common.JCard#addControlButtons(javax.swing.JToolBar)
   */
  @Override
  protected void addControlButtons(JToolBar toolBar) {
    styleBtn = ComponentFactory.getImageButton(UIImages.BAR_ICON.getImageIcon());
    styleBtn.setToolTipText(UILabels.STL40002_TO_BAR.getDescription());
    toolBar.add(styleBtn);

    super.addControlButtons(toolBar);
  }
Ejemplo n.º 2
0
  /**
   * <i>Description:</i>
   *
   * <p>see <a href=https://en.wikipedia.org/wiki/Hostname>https://en.wikipedia.org
   * /wiki/Hostname</a> for valid hostname
   *
   * @return
   */
  @SuppressWarnings("unchecked")
  protected JPanel getHostEntryPanel() {
    if (pnlHostEntry == null) {
      pnlHostEntry = new JPanel(new BorderLayout(5, 5));
      pnlHostEntry.setOpaque(false);

      JPanel panel = new JPanel(new GridLayout(1, 2, 10, 5));
      panel.setOpaque(false);
      String hostNameChars = UIConstants.DIGITS + UIConstants.LETTERS + "-.";
      txtFldHostName = new SafeTextField(false, 253);
      ((SafeTextField) txtFldHostName).setValidChars(hostNameChars);
      for (DocumentListener listener : hostInfoListener.getDocumentListeners()) {
        txtFldHostName.getDocument().addDocumentListener(listener);
      }
      FieldPair<JFormattedTextField> fp =
          new FieldPair<JFormattedTextField>(STLConstants.K0051_HOST.getValue(), txtFldHostName);
      panel.add(fp);

      txtFldPortNum =
          new SafeNumberField<Integer>(new DecimalFormat("###"), 0, false, 65535, false);
      // only positive integer
      ((SafeNumberField<Integer>) txtFldPortNum).setValidChars(UIConstants.DIGITS);
      for (DocumentListener listener : hostInfoListener.getDocumentListeners()) {
        txtFldPortNum.getDocument().addDocumentListener(listener);
      }
      txtFldPortNum.setText(STLConstants.K3015_DEFAULT_PORT.getValue());
      fp =
          new FieldPair<JFormattedTextField>(
              STLConstants.K1035_CONFIGURATION_PORT.getValue(), txtFldPortNum);
      panel.add(fp);
      pnlHostEntry.add(panel, BorderLayout.CENTER);

      chkboxSecureConnect =
          ComponentFactory.getIntelCheckBox(STLConstants.K2003_SECURE_CONNECT.getValue());
      chkboxSecureConnect.setFont(UIConstants.H5_FONT.deriveFont(Font.BOLD));
      chkboxSecureConnect.setForeground(UIConstants.INTEL_DARK_GRAY);
      chkboxSecureConnect.setHorizontalAlignment(JLabel.TRAILING);
      chkboxSecureConnect.setSelected(false);
      chkboxSecureConnect.addItemListener(
          new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
              hostInfoListener.setDirty();
              boolean isSecureConnect = chkboxSecureConnect.isSelected();
              enableCerts(isSecureConnect);
            }
          });
      pnlHostEntry.add(chkboxSecureConnect, BorderLayout.EAST);
    }
    return pnlHostEntry;
  }
Ejemplo n.º 3
0
  protected JPanel getHostPanel() {
    if (hostPanel == null) {
      hostPanel = new JPanel(new GridBagLayout());
      hostPanel.setBackground(UIConstants.INTEL_WHITE);
      hostPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 2, 5));

      GridBagConstraints gc = new GridBagConstraints();
      gc.fill = GridBagConstraints.BOTH;

      gc.gridwidth = 1;
      gc.insets = new Insets(7, 2, 3, 2);
      JLabel label =
          ComponentFactory.getH5Label(STLConstants.K3037_FE_CONNECTION.getValue(), Font.BOLD);
      label.setHorizontalAlignment(JLabel.TRAILING);
      label.setVerticalAlignment(JLabel.TOP);
      hostPanel.add(label, gc);

      gc.weightx = 1;
      gc.gridwidth = GridBagConstraints.REMAINDER;
      gc.insets = widthInsets;
      JPanel panel = getConnectionPanel();
      hostPanel.add(panel, gc);

      gc.weightx = 0;
      gc.gridwidth = 1;
      gc.insets = insets;
      label = ComponentFactory.getH5Label(STLConstants.K3033_CONNECTION_TEST.getValue(), Font.BOLD);
      label.setHorizontalAlignment(JLabel.TRAILING);
      hostPanel.add(label, gc);

      gc.weightx = 1;
      gc.gridwidth = GridBagConstraints.REMAINDER;
      gc.insets = widthInsets;
      panel = getConnTestPanel();
      hostPanel.add(panel, gc);
    }
    return hostPanel;
  }
Ejemplo n.º 4
0
  protected JPanel getSecurityPanel() {
    if (pnlSecurity == null) {
      pnlSecurity = new JPanel(new GridLayout(1, 2, 10, 5));
      pnlSecurity.setOpaque(false);
      pnlSecurity.setBorder(BorderFactory.createTitledBorder(STLConstants.K3041_SSL.getValue()));

      txtFldKeyStoreFile =
          ComponentFactory.createTextField(
              null, true, 4096, hostInfoListener.getDocumentListeners());
      SecureStorage ss =
          new SecureStorage(STLConstants.K2001_KEY_STORE.getValue(), txtFldKeyStoreFile);
      btnKeyStoreBrowser = ss.getBtnStoreBrowser();
      pnlSecurity.add(ss);

      txtFldTrustStoreFile =
          ComponentFactory.createTextField(
              null, true, 4096, hostInfoListener.getDocumentListeners());
      ss = new SecureStorage(STLConstants.K2002_TRUST_STORE.getValue(), txtFldTrustStoreFile);
      btnTrustStoreBrowser = ss.getBtnStoreBrowser();
      pnlSecurity.add(ss);
    }
    return pnlSecurity;
  }
Ejemplo n.º 5
0
  protected JPanel getConnTestPanel() {
    JPanel panel = new JPanel(new GridBagLayout());
    panel.setOpaque(false);

    GridBagConstraints gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.HORIZONTAL;
    gc.insets = insets;

    gc.gridwidth = 1;
    btnConnectionTest = ComponentFactory.getImageButton(UIImages.PLAY.getImageIcon());
    btnConnectionTest.setToolTipText(STLConstants.K3027_TEST_CONNECTION.getValue());
    btnConnectionTest.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            if (!txtFldHostName.isEditValid() || !txtFldPortNum.isEditValid()) {
              // do nothing if edit is invalid
              return;
            }

            if (btnConnectionTest.isSelected()) {
              stopConnectionTest();
            } else {
              testConnection();
            }
          }
        });
    panel.add(btnConnectionTest, gc);

    gc.weightx = 1;
    gc.gridwidth = GridBagConstraints.REMAINDER;
    lblConnectionStatus =
        ComponentFactory.getH5Label(STLConstants.K3028_NOT_TESTED.getValue(), Font.PLAIN);
    panel.add(lblConnectionStatus, gc);

    return panel;
  }
Ejemplo n.º 6
0
    @Override
    protected void initComponents(String name, final JFormattedTextField textField) {
      super.initComponents(name, textField);

      btnStoreBrowser = ComponentFactory.getImageButton(UIImages.FOLDER_ICON.getImageIcon());
      btnStoreBrowser.setMargin(new Insets(2, 2, 2, 2));
      btnStoreBrowser.setToolTipText(STLConstants.K0642_BROWSE.getValue());
      btnStoreBrowser.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              String newFile = chooseFile(textField.getText());
              if (newFile != null) {
                textField.setText(newFile);
                hostInfoListener.setDirty();
              }
            }
          });
      add(btnStoreBrowser, BorderLayout.EAST);
    }
Ejemplo n.º 7
0
  protected void initComponents() {
    setLayout(new BorderLayout(10, 5));
    setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createMatteBorder(1, 1, 1, 4, UIConstants.INTEL_LIGHT_GRAY),
            BorderFactory.createEmptyBorder(2, 2, 2, 2)));

    add(getHostPanel(), BorderLayout.CENTER);

    // Remove Button
    btnRemove = ComponentFactory.getImageButton(UIImages.CLOSE_RED.getImageIcon());
    btnRemove.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            hostInfoListener.removeHost(hostInfoPanel);
          }
        });
    add(btnRemove, BorderLayout.EAST);
  }
Ejemplo n.º 8
0
  public void setSelectedResources(FVResourceNode[] resources) {
    resourcesPanel.removeAll();
    if (resources == null || resources.length == 0) {
      return;
    }

    GridBagConstraints gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.HORIZONTAL;
    gc.gridwidth = GridBagConstraints.REMAINDER;
    gc.weightx = 1;
    gc.insets = new Insets(0, 2, 0, 2);
    for (int i = 0; i < resources.length; i++) {
      FVResourceNode resource = resources[i];
      JLabel label = ComponentFactory.getH4Label(getResoureName(resource), Font.PLAIN);
      label.setIcon(resource.getType().getIcon());
      label.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.INTEL_BORDER_GRAY));
      style.decorateKey(label, i);
      resourcesPanel.add(label, gc);
    }
    gc.weighty = 1;
    gc.fill = GridBagConstraints.BOTH;
    resourcesPanel.add(Box.createGlue(), gc);
  }
Ejemplo n.º 9
0
  @Override
  public void initComponents() {
    dataset = new XYSeriesCollection();

    JFreeChart chart =
        ComponentFactory.createXYBarChart(
            K1105_SC.getValue(), K1106_SL.getValue(), dataset, (XYItemLabelGenerator) null);

    XYPlot plot = chart.getXYPlot();
    plot.setDomainPannable(true);
    plot.setRangePannable(true);
    final String scLabel = "<html>" + K1105_SC.getValue() + ": ";
    final String slLabel = "<br>" + K1106_SL.getValue() + ": ";

    XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setBarAlignmentFactor(0);
    renderer.setMargin(0.2);

    renderer.setSeriesToolTipGenerator(
        0,
        new XYToolTipGenerator() {
          @Override
          public String generateToolTip(XYDataset dataset, int arg1, int arg2) {
            int scNum = (int) dataset.getXValue(arg1, arg2);
            int slCount = (int) dataset.getYValue(arg1, arg2);
            return scLabel + scNum + slLabel + slCount + "</html>";
          }
        });
    NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    NumberAxis xAxis = (NumberAxis) plot.getDomainAxis();
    xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    chartPanel = new ChartPanel(chart);
    chartPanel.setMouseWheelEnabled(true);
    chartPanel.setPreferredSize(PREFERRED_CHART_SIZE);
    propsPanel.add(chartPanel);
  }