示例#1
2
 /**
  * This function is used to re-run the analyser, and re-create the rows corresponding the its
  * results.
  */
 private void refreshReviewTable() {
   reviewPanel.removeAll();
   rows.clear();
   GridBagLayout gbl = new GridBagLayout();
   reviewPanel.setLayout(gbl);
   GridBagConstraints gbc = new GridBagConstraints();
   gbc.fill = GridBagConstraints.HORIZONTAL;
   gbc.gridy = 0;
   try {
     Map<String, Long> sums =
         analyser.processLogFile(config.getLogFilename(), fromDate.getDate(), toDate.getDate());
     for (Entry<String, Long> entry : sums.entrySet()) {
       String project = entry.getKey();
       double hours = 1.0 * entry.getValue() / (1000 * 3600);
       addRow(gbl, gbc, project, hours);
     }
     for (String project : main.getProjectsTree().getTopLevelProjects())
       if (!rows.containsKey(project)) addRow(gbl, gbc, project, 0);
     gbc.insets = new Insets(10, 0, 0, 0);
     addLeftLabel(gbl, gbc, "TOTAL");
     gbc.gridx = 1;
     gbc.weightx = 1;
     totalLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 3));
     gbl.setConstraints(totalLabel, gbc);
     reviewPanel.add(totalLabel);
     gbc.weightx = 0;
     addRightLabel(gbl, gbc);
   } catch (IOException e) {
     e.printStackTrace();
   }
   recomputeTotal();
   pack();
 }
    protected void displayNewTxf(String strLabel, String strValue) {
      strLabel = (strLabel == null) ? "" : strLabel.trim();
      strValue = (strValue == null) ? "" : strValue.trim();

      JCheckBox chkBox1 = new JCheckBox(Util.getImageIcon("boxGray.gif"));
      DataField txf1 = new DataField(strLabel);
      DataField txf2 = new DataField(strValue);
      JPanel pnlTxf = new JPanel(m_gbl);
      m_nRow = m_nRow + 1;

      txf1.setName("label");
      txf2.setName("value");

      /* 1st line of text field*/
      m_gbc.weightx = 0;
      showComp(m_gbl, m_gbc, 0, m_nRow, 1, chkBox1);
      m_gbc.weightx = 1;
      showComp(m_gbl, m_gbc, GridBagConstraints.RELATIVE, m_nRow, 1, txf1);
      // showSpaces( gbl, gbc, 2, 6 );
      showComp(m_gbl, m_gbc, GridBagConstraints.RELATIVE, m_nRow, 1, txf2);
      m_gbc.weightx = 0;
      txf1.addFocusListener(this);
      txf2.addFocusListener(this);

      m_objTxfValue.addToLabel(txf1);
      m_objTxfValue.addToValue(txf2);
    }
  /** stellt das Datenidentifikationsauswahl-Panel zusammen */
  private void createAndShowGui() {
    GridBagConstraints gbc;

    // Zeile für Zeile hinzufügen
    // Attributgruppe
    gbc = makegbc(0, 0, 1, 1);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    _gridBagLayout.setConstraints(_atgLabel, gbc);
    add(_atgLabel);

    gbc = makegbc(1, 0, 1, 1);
    gbc.weightx = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    _gridBagLayout.setConstraints(_atgTextField, gbc);
    add(_atgTextField);

    // Aspekte
    gbc = makegbc(0, 1, 1, 1);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    _gridBagLayout.setConstraints(_aspLabel, gbc);
    add(_aspLabel);

    gbc = makegbc(1, 1, 1, 1);
    gbc.weightx = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    _gridBagLayout.setConstraints(_aspTextField, gbc);
    add(_aspTextField);

    // Simulationsvariante
    gbc = makegbc(0, 2, 1, 1);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    _gridBagLayout.setConstraints(_simLabel, gbc);
    add(_simLabel);

    gbc = makegbc(1, 2, 1, 1);
    gbc.weightx = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    _gridBagLayout.setConstraints(_simTextField, gbc);
    add(_simTextField);

    // Objekte
    gbc = makegbc(0, 3, 1, 1);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    _gridBagLayout.setConstraints(_objLabel, gbc);
    add(_objLabel);

    JScrollPane scrollPane = new JScrollPane(_objList);
    gbc = makegbc(1, 3, 1, 1);
    gbc.weightx = 1;
    gbc.weighty = 1;
    gbc.fill = GridBagConstraints.BOTH;
    _gridBagLayout.setConstraints(scrollPane, gbc);
    add(scrollPane);

    // Ändern - Button
    gbc = makegbc(2, 0, 1, 4);
    gbc.anchor = GridBagConstraints.SOUTHEAST;
    _gridBagLayout.setConstraints(_changeButton, gbc);
    add(_changeButton);
  }
示例#4
0
 /**
  * Adds an editable text field containing the hours spent on a project.
  *
  * @param gbl The layout to add the text field to.
  * @param gbc The layout constraints to use.
  * @param row The row to link against.
  * @param hours The number of hours spent on the project.
  * @see {@link #addRow(GridBagLayout, GridBagConstraints, String, double)}
  */
 private void addMiddleField(GridBagLayout gbl, GridBagConstraints gbc, Row row, double hours) {
   row.hoursTF.setText(decimalFormat.format(hours));
   gbc.gridx = 1;
   gbc.weightx = 1;
   gbl.setConstraints(row.hoursTF, gbc);
   gbc.weightx = 0;
   reviewPanel.add(row.hoursTF);
 }
  /**
   * Adds contact entry labels.
   *
   * @param nameLabelGridWidth the grid width of the contact entry name label
   */
  private void addLabels(int nameLabelGridWidth) {
    remove(nameLabel);
    remove(rightLabel);
    remove(displayDetailsLabel);

    if (treeNode != null && !(treeNode instanceof GroupNode))
      constraints.insets = new Insets(0, 0, V_GAP, H_GAP);
    else constraints.insets = new Insets(0, 0, 0, H_GAP);

    constraints.anchor = GridBagConstraints.WEST;
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 0;
    constraints.weightx = 1f;
    constraints.weighty = 0f;
    constraints.gridheight = 1;
    constraints.gridwidth = nameLabelGridWidth;
    this.add(nameLabel, constraints);

    constraints.anchor = GridBagConstraints.NORTHEAST;
    constraints.fill = GridBagConstraints.VERTICAL;
    constraints.gridx = nameLabelGridWidth + 1;
    constraints.gridy = 0;
    constraints.gridheight = 3;
    constraints.weightx = 0f;
    constraints.weighty = 1f;
    this.add(rightLabel, constraints);

    if (treeNode != null && treeNode instanceof ContactNode) {
      constraints.anchor = GridBagConstraints.WEST;
      constraints.fill = GridBagConstraints.NONE;
      constraints.gridx = 1;
      constraints.gridy = 1;
      constraints.weightx = 1f;
      constraints.weighty = 0f;
      constraints.gridwidth = nameLabelGridWidth;
      constraints.gridheight = 1;

      this.add(displayDetailsLabel, constraints);
    } else if (treeNode != null && treeNode instanceof GroupNode) {
      constraints.anchor = GridBagConstraints.WEST;
      constraints.fill = GridBagConstraints.NONE;
      constraints.gridx = 1;
      constraints.gridy = 1;
      constraints.weightx = 1f;
      constraints.weighty = 0f;
      constraints.gridwidth = nameLabelGridWidth;
      constraints.gridheight = 1;

      this.add(displayDetailsLabel, constraints);
    }
  }
示例#6
0
  // Initializing this component.
  private void jbInit() {
    callStackTable.addFocusListener(
        new FocusListener() {
          public void focusGained(FocusEvent e) {
            callStackTable_focusGained(e);
          }

          public void focusLost(FocusEvent e) {
            callStackTable_focusLost(e);
          }
        });
    callStackTable.setTableHeader(null);
    callStackTable.setDefaultRenderer(callStackTable.getColumnClass(0), getCellRenderer());
    scrollPane = new JScrollPane(callStackTable);
    setVisibleRows(DEFAULT_VISIBLE_ROWS);
    scrollPane.setLocation(0, 27);
    setBorder(BorderFactory.createEtchedBorder());
    // this.setLayout(null);
    this.setLayout(new GridBagLayout());
    nameLbl.setText("Call Stack");
    nameLbl.setBounds(new Rectangle(3, 4, 70, 23));
    nameLbl.setFont(Utilities.labelsFont);

    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 7;
    c.gridheight = 1;
    c.anchor = GridBagConstraints.PAGE_END;
    c.gridx = 0;
    c.gridy = 2;
    this.add(scrollPane, c);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 1;
    c.weighty = 0.0;
    c.gridwidth = 3;
    c.gridheight = 1;
    c.anchor = GridBagConstraints.FIRST_LINE_START;
    c.gridx = 0;
    c.gridy = 0;
    c.insets = new Insets(5, 0, 0, 0);
    this.add(nameLbl, c);
  }
示例#7
0
  /**
   * Creates the <tt>Component</tt> hierarchy of the area of status-related information such as
   * <tt>CallPeer</tt> display name, call duration, security status.
   *
   * @return the root of the <tt>Component</tt> hierarchy of the area of status-related information
   *     such as <tt>CallPeer</tt> display name, call duration, security status
   */
  private Component createStatusBar() {
    // stateLabel
    callStatusLabel.setForeground(Color.WHITE);
    dtmfLabel.setForeground(Color.WHITE);
    callStatusLabel.setText(callPeer.getState().getLocalizedStateString());

    PeerStatusPanel statusPanel = new PeerStatusPanel(new GridBagLayout());

    GridBagConstraints constraints = new GridBagConstraints();

    constraints.gridx = 0;
    constraints.gridy = 0;
    statusPanel.add(securityStatusLabel, constraints);
    initSecurityStatusLabel();

    constraints.gridx++;
    statusPanel.add(holdStatusLabel, constraints);

    constraints.gridx++;
    statusPanel.add(muteStatusLabel, constraints);

    constraints.gridx++;
    callStatusLabel.setBorder(BorderFactory.createEmptyBorder(2, 3, 2, 12));
    statusPanel.add(callStatusLabel, constraints);

    constraints.gridx++;
    constraints.weightx = 1f;
    statusPanel.add(dtmfLabel, constraints);

    return statusPanel;
  }
  private int addButton(SIPCommButton button, int gridX, int xBounds, boolean isLast) {
    lastAddedButton = button;

    constraints.insets = new Insets(0, 0, V_GAP, 0);
    constraints.anchor = GridBagConstraints.WEST;
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = gridX;
    constraints.gridy = 2;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 0f;
    constraints.weighty = 0f;
    this.add(button, constraints);

    int yBounds =
        TOP_BORDER
            + BOTTOM_BORDER
            + 2 * V_GAP
            + ComponentUtils.getStringSize(nameLabel, nameLabel.getText()).height
            + ComponentUtils.getStringSize(displayDetailsLabel, displayDetailsLabel.getText())
                .height;

    button.setBounds(xBounds, yBounds, BUTTON_WIDTH, BUTTON_HEIGHT);

    button.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));

    setButtonBg(button, gridX, isLast);

    return button.getWidth();
  }
  public static void addToGridBag(
      GridBagLayout grid,
      Container cont,
      Component comp,
      int x,
      int y,
      int gw,
      int gh,
      double wx,
      double wy,
      int fill,
      int anchor) {
    // now the constraints
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = x;
    gbc.gridy = y;
    gbc.weightx = wx;
    gbc.weighty = wy;
    gbc.fill = fill;
    gbc.gridwidth = gw;
    gbc.gridheight = gh;
    gbc.anchor = anchor;

    cont.add(comp);
    grid.setConstraints(comp, gbc);
  }
  /** Get the panel for a given form. * */
  public JPanel getPanelFor(ArrayList elements) {
    JPanel p = new JPanel(new GridBagLayout());
    int maxCols = 1;
    int elementSize = elements.size();
    for (int i = 0; i < elementSize; i++) { // count max number of cols
      // ((XmlUIElement)elements.get(i)).setEditable(true);//by jai
      int cols = ((XmlUIElement) elements.get(i)).getNumberOfColumns();
      if (cols > maxCols) {
        maxCols = cols;
      }
    }
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1.0;
    c.gridx = 0;
    c.gridy = 0;
    if (elementSize < 5) c.insets = new Insets(8, 8, 8, 14);
    else if (elementSize < 20) c.insets = new Insets(4, 4, 4, 10);
    else if ((elementSize > 40 && maxCols == 2) || (elementSize > 80 && maxCols == 4))
      c.insets = new Insets(1, 1, 1, 8);
    else c.insets = new Insets(2, 2, 2, 8);

    int rowsAdded = 0;
    for (int i = 0; i < elementSize; i++) {
      elementsAndPanels.put(elements.get(i), p);
      rowsAdded += ((XmlUIElement) elements.get(i)).addComponents(p, c, 0, rowsAdded, maxCols);
    }
    return p;
  }
    public void addForDisplay(CTalkativeTextPane pane, LabelPair<String, String> lp) {
      GridBagLayout gridbag = (GridBagLayout) getLayout();
      labelPair = lp;
      label = new JLabel(labelPair.getSingular(), JLabel.LEFT);
      pane.getDocument().addDocumentListener(this);

      GridBagConstraints c = new GridBagConstraints();
      c.gridx = 0;
      c.gridy = 0;
      c.gridwidth = 1;
      c.gridheight = 1;
      c.weightx = 0.1;
      c.weighty = 0.1;
      c.anchor = GridBagConstraints.LINE_START;
      c.insets = new Insets(0, 20, 0, 00);
      gridbag.setConstraints(pane, c);
      add(pane);

      c = new GridBagConstraints();
      c.gridx = 1;
      c.gridy = 0;
      c.gridwidth = 1;
      c.gridheight = 1;
      c.weightx = 0.1;
      c.weighty = 0.1;
      c.anchor = GridBagConstraints.LINE_START;
      c.insets = new Insets(0, 0, 0, 20);
      gridbag.setConstraints(label, c);
      add(label);

      JPanel filler = new JPanel();
      filler.setBackground(white);
      c = new GridBagConstraints();
      c.gridx = 2;
      c.gridy = 0;
      c.gridwidth = 1;
      c.gridheight = 1;
      c.weightx = 0.8;
      c.weighty = 0.8;
      c.fill = GridBagConstraints.BOTH;
      c.anchor = GridBagConstraints.LINE_END;
      gridbag.setConstraints(filler, c);
      add(filler);

      filler = null;
      c = null;
    }
    protected void displayNewTxf(String strLabel, String strValue) {
      strLabel = (strLabel != null) ? strLabel.trim() : "";
      strValue = (strValue != null) ? strValue.trim() : "";

      JCheckBox chk1 = new JCheckBox(Util.getImageIcon("boxGray.gif"));
      final DataField txf1 = new DataField(strLabel);
      final DataField txf2 = new DataField(strValue);
      m_nRow = m_nRow + 1;

      txf1.setName("label");
      txf2.setName("value");

      // new field
      if (strLabel.equals("") && strValue.equals("")) {
        txf2.setText(INFOSTR);
        txf2.addMouseListener(m_mlTxf);
        if (timer != null) timer.cancel();

        timer = new java.util.Timer();
        timer.schedule(
            new TimerTask() {
              public void run() {
                WUtil.blink(txf2, WUtil.FOREGROUND);
              }
            },
            delay,
            delay);
      }

      /* 1st line of text field*/
      m_gbc.weightx = 0;
      showComp(m_gbl, m_gbc, 0, m_nRow, 1, chk1);
      m_gbc.weightx = 1;
      showComp(m_gbl, m_gbc, GridBagConstraints.RELATIVE, m_nRow, 1, txf1);
      // showSpaces( gbl, gbc, 2, 6 );
      showComp(m_gbl, m_gbc, GridBagConstraints.RELATIVE, m_nRow, 1, txf2);
      m_gbc.weightx = 0;
      txf1.addFocusListener(this);
      txf2.addFocusListener(this);

      // Add the textfields to the respective arrays, so that they
      // can be retreived later for writing to the file.
      m_objTxfValue.addToLabel(txf1);
      m_objTxfValue.addToValue(txf2);
    }
示例#13
0
 private void addSlider() {
   _slider = new JSlider(_minimum, _maximum, _minimum);
   GridBagConstraints gbc = new GridBagConstraints();
   gbc.gridwidth = 4;
   gbc.gridx = 0;
   gbc.gridy = 0;
   gbc.weightx = 1.0;
   gbc.fill = GridBagConstraints.HORIZONTAL;
   add(_slider, gbc);
 }
示例#14
0
 public void init(GUI gui) {
   m_gui = gui;
   // Create the display
   // width, height
   addWindowListener(
       new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
           dispose();
         }
       });
   setSize(new Dimension(100, 100));
   setBackground(Color.white);
   setFont(new Font("Helvetica", Font.PLAIN, 14));
   GridBagLayout gridbag = new GridBagLayout();
   setLayout(gridbag);
   GridBagConstraints c = new GridBagConstraints();
   c.fill = GridBagConstraints.BOTH;
   c.weightx = 1.0;
   recency = new TextField(Truline.userProps.getProperty("RecencyDays", "28"), 5);
   setRow(c, gridbag, new Label("Recency Days"), recency);
   maxdays = new TextField(Truline.userProps.getProperty("MaxDays", "120"), 5);
   setRow(c, gridbag, new Label("Max Days"), maxdays);
   maxvariant = new TextField(Truline.userProps.getProperty("MaxVariant", "25"), 5);
   setRow(c, gridbag, new Label("Max Variant"), maxvariant);
   maiden = new TextField(Truline.userProps.getProperty("UseMaiden", "Y"), 2);
   setRow(c, gridbag, new Label("Use Maiden"), maiden);
   betFactorVersion = new TextField(Truline.userProps.getProperty("BetFactorVersion", " "), 7);
   setRow(c, gridbag, new Label("Bet Factor Version"), betFactorVersion);
   datadir = new TextField(Truline.userProps.getProperty("DATADIR", "."), 40);
   setRow(c, gridbag, new Label("Data Directory"), datadir);
   fontsize = new TextField(Truline.userProps.getProperty("FontSize", "8"), 40);
   setRow(c, gridbag, new Label("Print Font Size (8,9,10)"), fontsize);
   printProgram =
       new TextField(Truline.userProps.getProperty("PrintProgram", "WordPad.exe /p"), 40);
   setRow(c, gridbag, new Label("Print program"), printProgram);
   // shell = new TextField(Truline.userProps.getProperty("Shell", "command"),
   // 40);
   // setRow(c, gridbag, new Label("Shell program"), shell);
   Panel panel1 = new Panel();
   panel1.setLayout(new BorderLayout());
   Button OKButton = new Button(" OK ");
   OKButton.setActionCommand("ok");
   OKButton.addActionListener(this);
   panel1.add(OKButton, BorderLayout.CENTER);
   Panel panel2 = new Panel();
   panel2.setLayout(new BorderLayout());
   Button cancelButton = new Button("Cancel");
   cancelButton.setActionCommand("cancel");
   cancelButton.addActionListener(this);
   panel2.add(cancelButton, BorderLayout.CENTER);
   setRow(c, gridbag, panel2, panel1);
   pack();
   show();
 }
 protected GridBagConstraints createConstraints(int x, int y) {
   GridBagConstraints c = new GridBagConstraints();
   c.gridx = x;
   c.gridy = y;
   c.gridwidth = 2;
   c.gridheight = 1;
   c.ipadx = 1;
   c.weightx = 0.5;
   c.weighty = 0.5;
   c.fill = GridBagConstraints.BOTH;
   c.anchor = GridBagConstraints.CENTER;
   return c;
 }
示例#16
0
 private JComponent makeTitlePanel(String title, List<? extends JComponent> list) {
   JPanel p = new JPanel(new GridBagLayout());
   p.setBorder(BorderFactory.createTitledBorder(title));
   GridBagConstraints c = new GridBagConstraints();
   c.fill = GridBagConstraints.HORIZONTAL;
   c.insets = new Insets(5, 5, 5, 5);
   c.weightx = 1d;
   c.gridy = 0;
   for (JComponent cmp : list) {
     p.add(cmp, c);
     c.gridy++;
   }
   return p;
 }
    private Connector() {
      setLayout(new GridBagLayout());
      //      setBorder (new EmptyBorder (8, 8, 8, 8));
      GridBagConstraints c = new GridBagConstraints();

      c.insets = new Insets(0, 0, 3, 3);
      c.anchor = GridBagConstraints.WEST;
      add(new JLabel(bundle.getString("CTL_HostName")), c);

      tfHost = new JTextField(host, 25);
      c = new GridBagConstraints();
      c.gridwidth = 0;
      c.insets = new Insets(0, 3, 3, 0);
      c.fill = java.awt.GridBagConstraints.HORIZONTAL;
      c.weightx = 1.0;
      add(tfHost, c);

      c = new GridBagConstraints();
      c.insets = new Insets(3, 0, 0, 3);
      c.anchor = GridBagConstraints.WEST;
      add(new JLabel(bundle.getString("CTL_Password")), c);

      tfPassword = new JTextField(25);
      c = new GridBagConstraints();
      c.gridwidth = 0;
      c.fill = java.awt.GridBagConstraints.HORIZONTAL;
      c.weightx = 1.0;
      c.insets = new Insets(3, 3, 0, 0);
      add(tfPassword, c);

      c = new GridBagConstraints();
      c.fill = java.awt.GridBagConstraints.BOTH;
      c.weighty = 1.0;
      JPanel p = new JPanel();
      p.setPreferredSize(new Dimension(1, 1));
      add(p, c);
    }
  public DvcsCommitAdditionalComponent(
      @NotNull final Project project, @NotNull CheckinProjectPanel panel) {
    myCheckinPanel = panel;
    myPanel = new JPanel(new GridBagLayout());
    final Insets insets = new Insets(2, 2, 2, 2);
    // add amend checkbox
    GridBagConstraints c = new GridBagConstraints();
    // todo change to MigLayout
    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = 2;
    c.anchor = GridBagConstraints.CENTER;
    c.insets = insets;
    c.weightx = 1;
    c.fill = GridBagConstraints.HORIZONTAL;

    myAmend = new NonFocusableCheckBox(DvcsBundle.message("commit.amend"));
    myAmend.setMnemonic('m');
    myAmend.setToolTipText(DvcsBundle.message("commit.amend.tooltip"));
    myPreviousMessage = myCheckinPanel.getCommitMessage();

    myAmend.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            if (myAmend.isSelected()) {
              if (myPreviousMessage.equals(
                  myCheckinPanel
                      .getCommitMessage())) { // if user has already typed something, don't revert
                                              // it
                if (myMessagesForRoots == null) {
                  loadMessagesInModalTask(project); // load all commit messages for all repositories
                }
                String message = constructAmendedMessage();
                if (!StringUtil.isEmptyOrSpaces(message)) {
                  myAmendedMessage = message;
                  substituteCommitMessage(myAmendedMessage);
                }
              }
            } else {
              // there was the amended message, but user has changed it => not reverting
              if (myCheckinPanel.getCommitMessage().equals(myAmendedMessage)) {
                myCheckinPanel.setCommitMessage(myPreviousMessage);
              }
            }
          }
        });
    myPanel.add(myAmend, c);
  }
    protected void layoutUIComponents(String strPath, boolean bDefaultFile) {
      // gbc.weightx = 0.5;

      showInstructions(m_gbl, m_gbc, 0, 0, 7, infoLabel1);
      showInstructions(m_gbl, m_gbc, 0, 1, 7, infoLabel2);
      showInstructions(m_gbl, m_gbc, 0, 2, 7, infoLabel3);
      /*showInstructions( gbl, gbc, 0, 3, 7, infoLabel4 );
      showInstructions( gbl, gbc, 0, 4, 7, infoLabel5 );*/
      showInstructions(m_gbl, m_gbc, 0, 5, 1, new JLabel(""));

      // i18n
      // label = new JLabel( "LABEL" );
      label = new JLabel(Util.getAdmLabel("_adm_LABEL"));
      label.setForeground(Color.black);
      m_gbc.gridx = 1;
      m_gbc.gridy = 5;
      // gbc.ipadx = 10;
      m_gbl.setConstraints(label, m_gbc);
      m_pnlDisplay.add(label);

      label = new JLabel("     ");
      m_gbc.gridx = 2;
      m_gbc.gridy = 5;
      m_gbc.ipadx = 0;
      m_gbc.gridwidth = 5;
      m_gbc.weightx = 0;
      m_gbl.setConstraints(label, m_gbc);
      // add( label );

      // i18n
      // showInstructions( m_gbl, m_gbc, 2, 5, 1, new JLabel( "DIRECTORY" ));
      showInstructions(m_gbl, m_gbc, 2, 5, 1, new JLabel(Util.getAdmLabel("_adm_DIRECTORY")));

      m_nRow = 5;

      m_bDefaultFile = bDefaultFile;
      m_objTxfValue.clearArrays();
      displayNewTxf(strPath);

      m_pnlDisplay.setBorder(
          new CompoundBorder(
              // i18n
              // BorderFactory.createTitledBorder( "  Parent Directories  "),
              BorderFactory.createTitledBorder(Util.getAdmLabel("_adm_Parent_Directories")),
              BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    }
  /** Initializes the GUI */
  private void initGui() {
    this.setBackground(Color.white);
    headerPane = new HeaderPanel(this);
    contentPane = new ContentPanel(this);

    headerPane.getIntervalLabel().setText(contentPane.getStrategy().getDisplayInterval());
    this.setLayout(new GridBagLayout());
    final GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 1;
    c.fill = GridBagConstraints.BOTH;
    add(headerPane, c);
    c.gridx = 0;
    c.gridy = 1;
    c.weighty = 0.9;
    c.insets = new Insets(10, 10, 10, 10);
    add(contentPane, c);
  }
    GitCheckinOptions(@NotNull final Project project, @NotNull CheckinProjectPanel panel) {
      super(project, panel);
      myVcs = GitVcs.getInstance(project);
      final Insets insets = new Insets(2, 2, 2, 2);
      // add authors drop down
      GridBagConstraints c = new GridBagConstraints();
      c.gridx = 0;
      c.gridy = 0;
      c.anchor = GridBagConstraints.WEST;
      c.insets = insets;
      final JLabel authorLabel = new JLabel(GitBundle.message("commit.author"));
      myPanel.add(authorLabel, c);

      c = new GridBagConstraints();
      c.anchor = GridBagConstraints.CENTER;
      c.insets = insets;
      c.gridx = 1;
      c.gridy = 0;
      c.weightx = 1;
      c.fill = GridBagConstraints.HORIZONTAL;
      final List<String> usersList = getUsersList(project);
      final Set<String> authors =
          usersList == null ? new HashSet<String>() : new HashSet<String>(usersList);
      ContainerUtil.addAll(authors, mySettings.getCommitAuthors());
      List<String> list = new ArrayList<String>(authors);
      Collections.sort(list);
      list =
          ObjectsConvertor.convert(
              list,
              new Convertor<String, String>() {
                @Override
                public String convert(String o) {
                  return StringUtil.shortenTextWithEllipsis(o, 30, 0);
                }
              });
      myAuthor = new ComboBox(ArrayUtil.toObjectArray(list));
      myAuthor.insertItemAt("", 0);
      myAuthor.setSelectedItem("");
      myAuthor.setEditable(true);
      authorLabel.setLabelFor(myAuthor);
      myAuthor.setToolTipText(GitBundle.getString("commit.author.tooltip"));
      myPanel.add(myAuthor, c);
    }
示例#22
0
  /**
   * Sets the reason of a call failure if one occurs. The renderer should display this reason to the
   * user.
   *
   * @param reason the reason to display
   */
  public void setErrorReason(final String reason) {
    if (!SwingUtilities.isEventDispatchThread()) {
      SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {
              setErrorReason(reason);
            }
          });
      return;
    }

    if (errorMessageComponent == null) {
      errorMessageComponent = new JTextPane();

      JTextPane textPane = (JTextPane) errorMessageComponent;
      textPane.setEditable(false);
      textPane.setOpaque(false);

      StyledDocument doc = textPane.getStyledDocument();

      MutableAttributeSet standard = new SimpleAttributeSet();
      StyleConstants.setAlignment(standard, StyleConstants.ALIGN_CENTER);
      StyleConstants.setFontFamily(standard, textPane.getFont().getFamily());
      StyleConstants.setFontSize(standard, 12);
      doc.setParagraphAttributes(0, 0, standard, true);

      GridBagConstraints constraints = new GridBagConstraints();
      constraints.fill = GridBagConstraints.HORIZONTAL;
      constraints.gridx = 0;
      constraints.gridy = 4;
      constraints.weightx = 1;
      constraints.weighty = 0;
      constraints.insets = new Insets(5, 0, 0, 0);

      add(errorMessageComponent, constraints);
      this.revalidate();
    }

    errorMessageComponent.setText(reason);

    if (isVisible()) errorMessageComponent.repaint();
  }
示例#23
0
 public ProgressDialog(Frame frame, String s, URL url, String s1) {
   super(s);
   bytesTransferred = -1L;
   properties = HJBProperties.getHJBProperties("hjbrowser");
   java.awt.Color color = properties.getColor("hotjava.background", null);
   if (color != null) setBackground(color);
   GridBagLayout gridbaglayout = new GridBagLayout();
   setLayout(gridbaglayout);
   GridBagConstraints gridbagconstraints = new GridBagConstraints();
   gridbagconstraints.gridx = 0;
   gridbagconstraints.anchor = 17;
   gridbagconstraints.weightx = 1.0D;
   String s2 = properties.getProperty("progressDialog.url.label", "Source:");
   addComponent(gridbaglayout, gridbagconstraints, new Label(s2 + " " + url));
   s2 = properties.getProperty("progressDialog.saveInto.label", "Destination:");
   addComponent(gridbaglayout, gridbagconstraints, new Label(s2 + " " + s1));
   gridbagconstraints.ipady = 2;
   bytesTransferredPrefix =
       properties.getProperty("progressDialog.transfer.label", "Bytes transferred:") + " ";
   bytesTransferredInd = new BytesTransferredInd();
   addComponent(gridbaglayout, gridbagconstraints, bytesTransferredInd);
   bpsInd = new BPSIndicator();
   addComponent(gridbaglayout, gridbagconstraints, bpsInd);
   gridbagconstraints.weighty = 1.0D;
   gridbagconstraints.anchor = 15;
   gridbagconstraints.insets = new Insets(0, 0, 5, 0);
   stopButton = new UIHJButton("progressDialog.stop", true, properties);
   stopButton.addActionListener(this);
   addComponent(gridbaglayout, gridbagconstraints, stopButton);
   pack();
   centerOnScreen(frame);
   Toolkit toolkit = Toolkit.getDefaultToolkit();
   try {
     URL url1 = ClassLoader.getSystemResource("lib/images/hotjava.icon.gif");
     java.awt.Image image = toolkit.getImage(url1);
     setIconImage(image);
     return;
   } catch (Exception _ex) {
     return;
   }
 }
  private void addSeparator(String label) {
    JPanel p = new JPanel(new GridBagLayout());
    GridBagConstraints c;

    if (label != null) {
      // left border
      c = new GridBagConstraints();
      c.gridy = 0;
      c.ipadx = 15; // half the desired width
      p.add(new JSeparator(), c);

      // label
      c = new GridBagConstraints();
      c.gridy = 0;
      c.insets = new Insets(0, 4, 0, 4);
      p.add(new JLabel(label), c);
    }

    // right border
    c = new GridBagConstraints();
    c.gridy = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;
    p.add(new JSeparator(), c);

    // add to window
    c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = currentRow++;
    c.gridwidth = 3;
    c.fill = GridBagConstraints.HORIZONTAL;
    if (label == null) {
      // simple separator between predicate name and options; don't use
      // pronounced section break
      c.insets = new Insets(3, 0, 3, 0);
    } else {
      c.insets = new Insets(10, 0, 0, 0);
    }
    content.add(p, c);
  }
  /**
   * Initializes the display details component for the given <tt>UIContact</tt>.
   *
   * @param displayDetails the display details to show
   */
  private void initDisplayDetails(String displayDetails) {
    remove(displayDetailsLabel);
    displayDetailsLabel.setText("");

    if (displayDetails != null && displayDetails.length() > 0) {
      // Replace all occurrences of new line with slash.
      displayDetails = Html2Text.extractText(displayDetails);
      displayDetails = displayDetails.replaceAll("\n|<br>|<br/>", " / ");

      displayDetailsLabel.setText(displayDetails);
    }

    constraints.anchor = GridBagConstraints.WEST;
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 1;
    constraints.weightx = 1f;
    constraints.weighty = 0f;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;

    this.add(displayDetailsLabel, constraints);
  }
示例#26
0
  /*
  public void addMiniChart(Plugin p){
  	components.add(p);

  	rebuild();
  }

  public void removeMiniChart(Plugin p){
  	components.remove(p);
  	rebuild();

  }
  */
  public void rebuild() {
    // remove everything from main panel
    mainpanel.removeAll();

    GridBagLayout gbl = new GridBagLayout();
    GridBagConstraints gbc = new GridBagConstraints();
    mainpanel.setLayout(gbl);

    gbc.anchor = gbc.NORTHWEST;
    gbc.fill = gbc.BOTH;
    gbc.weightx = 1;
    gbc.gridx = 0;

    int i = 0;
    // add chart

    gbc.weighty = 1;
    gbc.gridy = i;
    gbl.setConstraints(chartPanel, gbc);
    mainpanel.add(chartPanel);

    // add all other plugins/components
    validate();
  }
示例#27
0
  protected void populateDialog(JDialog dlg) {
    dlg.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
    dlg.setResizable(false);
    dlg.setSize(new Dimension(350, 135));
    dlg.setTitle("New TurboVNC Connection");

    dlg.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            if (VncViewer.nViewers == 1) {
              if (cc.viewer instanceof VncViewer) {
                ((VncViewer) cc.viewer).exit(1);
              }
            } else {
              ret = false;
              endDialog();
            }
          }
        });

    dlg.getContentPane().setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.LINE_START;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.gridheight = 1;
    gbc.insets = new Insets(0, 0, 0, 0);
    gbc.ipadx = 0;
    gbc.ipady = 0;
    gbc.weightx = 1;
    gbc.weighty = 1;

    dlg.getContentPane().add(topPanel, gbc);
    dlg.getContentPane().add(buttonPanel);
    dlg.pack();
  }
示例#28
0
  // Construct GUI for a set of parameters
  public static void makeControls(
      Container controls,
      GridBagLayout controlLayout,
      GridBagConstraints controlCon,
      Vector dpList,
      Vector optList,
      String title) {
    Container spec = new Container();
    controlLayout.setConstraints(spec, controlCon);
    controls.add(spec);

    GridBagLayout layout = new GridBagLayout();
    GridBagConstraints con = new GridBagConstraints();

    spec.setLayout(layout);

    Iterator i = dpList.iterator();
    while (i.hasNext()) {
      DoubleParameter dp = (DoubleParameter) (i.next());

      // Make slider and text field
      JSlider val = new JSlider(JSlider.HORIZONTAL);
      JTextField tval = new JTextField(5);

      dp.register(val);
      dp.register(tval);

      // Lay out label, slider, text field
      con.fill = GridBagConstraints.NONE;
      con.weightx = 0.0;
      con.weighty = 0.0;
      con.gridwidth = 1;

      JLabel name = new JLabel(dp.name);
      layout.setConstraints(name, con);
      spec.add(name);

      con.fill = GridBagConstraints.HORIZONTAL;
      con.weightx = 0.8;
      layout.setConstraints(val, con);
      spec.add(val);

      con.weightx = 0.2;
      con.gridwidth = GridBagConstraints.REMAINDER;
      layout.setConstraints(tval, con);
      spec.add(tval);
    }

    // Label column on bottom
    con.fill = GridBagConstraints.VERTICAL;
    con.anchor = GridBagConstraints.SOUTH;
    con.weightx = 0.0;
    con.weighty = 1.0;
    con.gridwidth = GridBagConstraints.REMAINDER;
    JLabel ltitle = new JLabel(title);
    layout.setConstraints(ltitle, con);
    spec.add(ltitle);

    // Display options
    con.anchor = GridBagConstraints.WEST;
    i = optList.iterator();
    while (i.hasNext()) {
      BooleanParameter bp = (BooleanParameter) (i.next());

      JCheckBox ck = new JCheckBox(bp.name);
      bp.register(ck);

      layout.setConstraints(ck, con);
      spec.add(ck);
    }
  }
示例#29
0
  // Main program -- create and start GUI
  public Mesh(boolean debug) {
    // Create drawing area for shape
    worldDraw = new WorldView(this, shape, debug);
    worldDraw.setSize(500, 500);

    // Create menubar
    JMenuBar menubar = new JMenuBar();
    setJMenuBar(menubar);

    JMenu menu = new JMenu("File");
    menu.getPopupMenu().setLightWeightPopupEnabled(false);
    menubar.add(menu);

    // Exit when quit selected
    JMenuItem resetm = menu.add("Reset");
    resetm.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Parameter.blockAction(true);

            // Reset all parameters
            shape.reset();

            Parameter.blockAction(false);

            Parameter.onUserAction();
          }
        });

    // Exit when quit selected
    JMenuItem quitm = menu.add("Quit");
    quitm.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            System.exit(0);
          }
        });

    // ------------------------------------------------------

    // Lay out main window
    GridBagLayout layout = new GridBagLayout();
    GridBagConstraints con = new GridBagConstraints();

    Container c = getContentPane();
    c.setLayout(layout);

    // World viewport
    con.gridwidth = 1;
    con.weightx = 0.2;
    con.weighty = 1.0;
    con.fill = GridBagConstraints.BOTH;
    con.insets = new Insets(4, 4, 4, 2);
    layout.setConstraints(worldDraw, con);
    c.add(worldDraw);

    // -- Parameter controls

    // Make container for controls
    Container cc = new Container();

    con.gridwidth = GridBagConstraints.REMAINDER;
    con.weightx = 0.2;
    con.weighty = 1.0;
    con.fill = GridBagConstraints.HORIZONTAL;

    layout.setConstraints(cc, con);
    c.add(cc);

    // Fill compartment
    GridBagLayout clayout = new GridBagLayout();
    cc.setLayout(clayout);
    GridBagConstraints ccon = new GridBagConstraints();

    ccon.weightx = 1.0;
    ccon.weighty = 1.0;
    ccon.anchor = GridBagConstraints.NORTH;
    ccon.insets = new Insets(10, 10, 0, 10);
    ccon.fill = GridBagConstraints.BOTH;
    ccon.gridwidth = GridBagConstraints.REMAINDER;
    makeControls(cc, clayout, ccon, shape.getParams(), shape.getOptions(), "Object parameters");

    // ------------------------------------------------------

    // Exit when window closes
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });

    // Placement of window on screen
    setLocation(100, 50);

    pack();
    setVisible(true);
  }
示例#30
0
  private void setupComponents() {
    panel.removeAll();

    JScrollPane scrollPane1 =
        new JScrollPane(
            parametersTable,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    scrollPane1.setOpaque(false);

    ActionPanel actionPanel1 = new ActionPanel(false);
    actionPanel1.setAddAction(addParameterAction);
    actionPanel1.setRemoveAction(removeParameterAction);
    actionPanel1.setAddToolTipText("Use this button to add an existing parameter to the prior");
    actionPanel1.setRemoveToolTipText("Use this button to remove a parameter from the prior");

    removeParameterAction.setEnabled(false);

    JPanel controlPanel1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    controlPanel1.setOpaque(false);
    controlPanel1.add(actionPanel1);

    JPanel panel1 = new JPanel(new BorderLayout(0, 0));
    panel1.setOpaque(false);
    panel1.add(new JLabel("Linked parameters:"), BorderLayout.NORTH);
    panel1.add(scrollPane1, BorderLayout.CENTER);

    // removing the control panel for now. Not sure whether we really want adding and
    // removing of parameteres in this dialog.
    //        panel1.add(controlPanel1, BorderLayout.SOUTH);
    panel1.setSize(new Dimension(PREFERRED_TABLE_WIDTH, PREFERRED_TABLE_HEIGHT));
    panel1.setPreferredSize(new Dimension(PREFERRED_TABLE_WIDTH, PREFERRED_TABLE_HEIGHT));
    panel1.setMinimumSize(new Dimension(MINIMUM_TABLE_WIDTH, MINIMUM_TABLE_HEIGHT));

    OptionsPanel optionsPanel = new OptionsPanel(0, 6);
    if (parameter.getName() != null) {
      nameField.setText(parameter.getName());
    } else {
      nameField.setText("Untitled");
    }
    optionsPanel.addComponentWithLabel("Unique Name: ", nameField);
    //        optionsPanel.addComponentWithLabel("Initial Value: ", initialField);

    panel.setOpaque(false);
    panel.setBorder(new BorderUIResource.EmptyBorderUIResource(new Insets(12, 12, 12, 12)));

    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 0;
    c.weighty = 0;
    c.anchor = GridBagConstraints.PAGE_START;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridwidth = 2;
    panel.add(optionsPanel, c);

    c.gridx = 0;
    c.gridy = 1;
    c.anchor = GridBagConstraints.PAGE_START;
    c.fill = GridBagConstraints.VERTICAL;
    c.gridwidth = 1;
    panel.add(panel1, c);

    c.gridx = 1;
    c.gridy = 1;
    c.weightx = 1;
    c.weighty = 1;
    c.fill = GridBagConstraints.BOTH;
    c.anchor = GridBagConstraints.PAGE_START;
    c.gridwidth = GridBagConstraints.REMAINDER;
    panel.add(priorSettingsPanel, c);
  }