Beispiel #1
0
    public PlayerPanel(Power power) {
      this.power = power;

      notes.setBorder(new EtchedBorder());

      for (int i = 0; i < email.length; i++) {
        email[i] = Utils.createEmailTextField(COLUMNS);
      }

      // layout
      int w1[] = {BORDER, 0, 5, 0, 15, 0, 5, 0, BORDER};
      int h1[] = {BORDER, 0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 10, 0, 5, 0, BORDER};

      HIGLayout layout = new HIGLayout(w1, h1);
      layout.setColumnWeight(5, 1);
      layout.setRowWeight(12, 1);
      this.setLayout(layout);

      HIGConstraints c = new HIGConstraints();

      this.add(new JLabel(Utils.getLocalString(PDF_NAME)), c.rcwh(2, 2, 1, 1, "r"));
      this.add(name, c.rcwh(2, 4, 1, 1, "l"));

      this.add(new JLabel(Utils.getLocalString(PDF_URI)), c.rcwh(4, 2, 1, 1, "r"));
      this.add(uri, c.rcwh(4, 4, 1, 1, "l"));

      this.add(new JLabel(Utils.getLocalString(PDF_NOTES)), c.rcwh(10, 2, 1, 1, "l"));
      this.add(makeScrollPane(notes), c.rcwh(12, 2, 7, 1, "lrtb"));

      for (int i = 0; i < email.length; i++) {
        int row = 2 + (i * 2);
        this.add(
            new JLabel(Utils.getLocalString(PDF_EMAIL) + " " + String.valueOf(i + 1)),
            c.rcwh(row, 6, 1, 1, "r"));
        this.add(email[i], c.rcwh(row, 8, 1, 1, "l"));
      }
    } // PlayerPanel()
Beispiel #2
0
  private class GamePanel extends JPanel {
    /** */
    private static final long serialVersionUID = 1L;

    private JTextPane notes = new JTextPane();
    private JTextField comment = new JTextField(COLUMNS_LONG);
    private JTextField gameName = new JTextField(COLUMNS_LONG);
    private JTextField modName = new JTextField(COLUMNS_LONG);
    private JTextField modEmail = Utils.createEmailTextField(COLUMNS_LONG);
    private JTextField modURI = Utils.createURITextField(COLUMNS_LONG);
    private JTextField judgeName = new JTextField(COLUMNS);
    private JTextField gameURI = Utils.createURITextField(COLUMNS_LONG);
    private JTextField gameID = new JTextField(COLUMNS);

    public GamePanel() {
      notes.setBorder(new EtchedBorder());

      // layout
      int w1[] = {BORDER, 10, 0, 5, 0, 10, 5, 0, BORDER};
      int h1[] = {BORDER, 0, 20, 0, 5, 0, 10, 0, 10, 0, 10, 0, 30, 0, 10, 0, 10, 0, BORDER};

      HIGLayout layout = new HIGLayout(w1, h1);
      layout.setColumnWeight(8, 1);
      this.setLayout(layout);

      HIGConstraints c = new HIGConstraints();

      this.add(new JLabel(Utils.getLocalString(GDF_GAME_NAME)), c.rcwh(2, 3, 1, 1, "r"));
      this.add(gameName, c.rcwh(2, 5, 1, 1, "lr"));

      this.add(new JLabel(Utils.getLocalString(GDF_NOTES)), c.rcwh(4, 8, 1, 1, "l"));
      this.add(makeScrollPane(notes), c.rcwh(6, 8, 1, 14, "lrtb"));

      this.add(new JLabel(Utils.getLocalString(GDF_COMMENT)), c.rcwh(6, 3, 1, 1, "r"));
      this.add(comment, c.rcwh(6, 5, 1, 1, "lr"));

      this.add(new JLabel(Utils.getLocalString(GDF_GAME_URI)), c.rcwh(8, 3, 1, 1, "r"));
      this.add(gameURI, c.rcwh(8, 5, 1, 1, "lr"));

      this.add(new JLabel(Utils.getLocalString(GDF_GAME_ID)), c.rcwh(10, 3, 1, 1, "r"));
      this.add(gameID, c.rcwh(10, 5, 1, 1, "lr"));

      this.add(new JLabel(Utils.getLocalString(GDF_JUDGE_NAME)), c.rcwh(12, 3, 1, 1, "r"));
      this.add(judgeName, c.rcwh(12, 5, 1, 1, "lr"));

      this.add(new JLabel(Utils.getLocalString(GDF_MOD_NAME)), c.rcwh(14, 3, 1, 1, "r"));
      this.add(modName, c.rcwh(14, 5, 1, 1, "lr"));

      this.add(new JLabel(Utils.getLocalString(GDF_MOD_EMAIL)), c.rcwh(16, 3, 1, 1, "r"));
      this.add(modEmail, c.rcwh(16, 5, 1, 1, "lr"));

      this.add(new JLabel(Utils.getLocalString(GDF_MOD_URI)), c.rcwh(18, 3, 1, 1, "r"));
      this.add(modURI, c.rcwh(18, 5, 1, 1, "lr"));
    } // GamePanel()

    /** Get the panel values from the given GameMetadata object. */
    public void read(GameMetadata gmd) {
      notes.setText(gmd.getNotes());
      comment.setText(gmd.getComment());
      gameName.setText(gmd.getGameName());
      modName.setText(n2e(gmd.getModeratorName()));
      modEmail.setText(n2e(gmd.getModeratorEmail()));
      modURI.setText(n2e(gmd.getModeratorURI()));
      judgeName.setText(n2e(gmd.getJudgeName()));
      gameURI.setText(n2e(gmd.getGameURI()));
      gameID.setText(gmd.getGameID());
    } // read()

    /** Set GameMetadata object from the entered panel values. */
    public void write(GameMetadata gmd) {
      gmd.setNotes(notes.getText());
      gmd.setComment(comment.getText());
      gmd.setGameName(gameName.getText());
      gmd.setGameID(gameID.getText());
      gmd.setGameURI(convertURI(gameURI.getText()));

      gmd.setJudgeName((judgeName.getText().length() == 0) ? null : judgeName.getText());

      gmd.setModeratorName((modName.getText().length() == 0) ? null : modName.getText());
      gmd.setModeratorEmail((modEmail.getText().length() == 0) ? null : modEmail.getText());
      gmd.setModeratorURI(convertURI(modURI.getText()));
    } // write()
  } // inner class GamePanel