コード例 #1
0
 public List<DOQuickTagEntry> getQuickTagEntries() {
   List<DOQuickTagEntry> res = new ArrayList<DOQuickTagEntry>();
   for (QuickTagEntryPanel pEntry : quickTagEntryPanels) {
     res.add(pEntry.getQuickTagEntry());
   }
   return res;
 }
コード例 #2
0
  public void addQuickTagEntry(DOQuickTagEntry quickTagEntry) {
    QuickTagEntryPanel newEntry = new QuickTagEntryPanel(quickTagEntry, fileType);
    newEntry.addDeleteListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            quickTagEntryPanels.remove(e.getSource());
            refresh();
          }
        });

    quickTagEntryPanels.add(newEntry);

    refresh();
  }
コード例 #3
0
  private void refresh() {
    if (isInitializing) {
      return;
    }

    // create the rows string
    String rowsString = "5px, p, 5px, ";
    if (quickTagEntryPanels.size() > 0) {
      for (int i = 0; i < quickTagEntryPanels.size(); i++) {
        rowsString += "p, 3px, ";
      }
      rowsString = rowsString.substring(0, rowsString.length() - 5);
    }
    rowsString += "5px";

    FormLayout layout =
        new FormLayout(
            "5px, 135, 5px, 135, 5px, f:210:g, 5px, p, 2px, p, 2px, p, 5px, p, 5px", rowsString);
    PanelBuilder builder = new PanelBuilder(layout);
    builder.opaque(true);

    CellConstraints cc = new CellConstraints();

    // add the headers
    int rowIndex = 2;
    builder.add(
        new JHeader(Messages.getString("ML.QuickTagDialog.Header.Name")),
        cc.xy(2, rowIndex, CellConstraints.CENTER, CellConstraints.DEFAULT));
    builder.add(
        new JHeader(Messages.getString("ML.QuickTagDialog.Header.TagName")),
        cc.xy(4, rowIndex, CellConstraints.CENTER, CellConstraints.DEFAULT));
    builder.add(
        new JHeader(Messages.getString("ML.QuickTagDialog.Header.TagValue")),
        cc.xy(6, rowIndex, CellConstraints.CENTER, CellConstraints.DEFAULT));
    builder.add(
        new JHeader(Messages.getString("ML.QuickTagDialog.Header.HotKey")),
        cc.xyw(8, rowIndex, 5, CellConstraints.CENTER, CellConstraints.DEFAULT));

    // add the entries
    for (QuickTagEntryPanel pEntry : quickTagEntryPanels) {
      rowIndex += 2;

      builder.add(pEntry.getTfName(), cc.xy(2, rowIndex));
      builder.add(pEntry.getCbTagName(), cc.xy(4, rowIndex));
      builder.add(pEntry.getCbTagValue(), cc.xy(6, rowIndex));
      builder.add(pEntry.getCbKeyCombination(), cc.xy(8, rowIndex));
      builder.addLabel("+", cc.xy(10, rowIndex));
      builder.add(pEntry.getCbVirtualKey(), cc.xy(12, rowIndex));
      builder.add(pEntry.getbDelete(), cc.xy(14, rowIndex));
    }

    removeAll();

    JScrollPane spMain = new JScrollPane(builder.getPanel());
    spMain.setBorder(BorderFactory.createEmptyBorder());

    add(spMain);

    validate();
    repaint();
  }