Ejemplo n.º 1
0
  public ResultsTopComponent(RtcQuery query) {
    this.query = query;
    manager = new ExplorerManager();
    initComponents();
    outlineView = new RtcOutline();
    outlineView.getOutline().addMouseListener(new MouseListenerImpl(outlineView.getOutline()));
    outlineView.getOutline().setDefaultEditor(Property.class, null);

    outlineView
        .getOutline()
        .setDefaultRenderer(
            Property.class,
            new LabelProviderTableCellRenderer(
                outlineView.getOutline().getDefaultRenderer(Property.class)));
    outlineView.getOutline().setDefaultRenderer(Object.class, new EmptyTableCellRenderer());

    //        outlineView.getOutline().getModel()

    Outline outline = outlineView.getOutline();
    this.removeDefaultColumn(outline);
    outline.setRootVisible(false);
    add(outlineView);

    ic.add(this.query);
    HashMap hm = new HashMap();
    hm.put(query, previousQuery);
    ic.add(hm);
    previousQuery = this.query;

    setDisplayName(
        NbBundle.getMessage(ResultsTopComponent.class, "ResultTopComponent.name")
            + " "
            + this.query.getEditableName());
    setFocusable(true);
  }
Ejemplo n.º 2
0
    @Override
    public void run() {
      if (!EventQueue.isDispatchThread()) {
        ProgressHandle ph;
        ph =
            ProgressHandleFactory.createHandle(
                NbBundle.getMessage(ResultsTopComponent.class, "PreparingResultsWindow.msg"));
        ph.start();
        n = new ResultsNode(query);
        rtcsc = query.getColumns();
        List cols = Arrays.asList(rtcsc);
        Iterator colsIt = cols.iterator();
        alps = new ArrayList();
        while (colsIt.hasNext()) {
          RtcQueryColumn rsc = (RtcQueryColumn) colsIt.next();
          alps.add(rsc.getColumnIdentifier());
          alps.add(rsc.getColumnDisplayName());
        }
        actualCols = alps.toArray(new String[] {});
        EventQueue.invokeLater(this);
        ph.finish();
      } else {
        outlineView.setPropertyColumns(alps.toArray(new String[] {}));
        Outline outline = outlineView.getOutline();
        removeDefaultColumn(outline);
        ETableColumnModel etcm = (ETableColumnModel) outline.getColumnModel();

        // TODO: szymon : change j to proper sort order
        int j = 1;
        for (int i = 1; i < rtcsc.length; i++) {
          ETableColumn etc = (ETableColumn) etcm.getColumn(i);
          if (alps.get(i * 2 - 2).equals("id")) {
            etc.setMaxWidth(20);
          }
          if (alps.get(i * 2 - 2).equals("internalSeverity")) {
            etc.setMaxWidth(20);
          }
          if (alps.get(i * 2 - 2).equals("internalPriority")) {
            etc.setMaxWidth(20);
          }
          if (alps.get(i * 2 - 2).equals("workItemType")) {
            etc.setMaxWidth(20);
          }
          if (alps.get(i * 2 - 2).equals("internalState")) {
            etc.setMaxWidth(85);
          }
          if (alps.get(i * 2 - 2).equals("summary")) {
            etc.setMaxWidth(550);
            etc.setWidth(475);
            etc.setMinWidth(400);
          }
          if (rtcsc[i].isSortColumn()) {
            etcm.setColumnSorted(etc, rtcsc[i].isAscending(), j);
            j++;
          }
        }

        manager.setRootContext(n);
      }
    }
Ejemplo n.º 3
0
 @Override
 public void mouseClicked(MouseEvent e) {
   int row = outline.rowAtPoint(e.getPoint());
   int col = outline.columnAtPoint(e.getPoint());
   if (prevCol == col && prevRow == row && System.currentTimeMillis() - time < 500) {
     Node node = Visualizer.findNode(outline.getValueAt(row, 0));
     time = 0;
     node.getPreferredAction().actionPerformed(null);
   } else {
     time = System.currentTimeMillis();
   }
   prevRow = row;
   prevCol = col;
 }
Ejemplo n.º 4
0
  private void removeDefaultColumn(Outline o) {
    TableColumn nodeColumn = o.getColumnModel().getColumn(0);
    nodeColumn.setHeaderValue("");
    nodeColumn.setWidth(1);
    nodeColumn.setMaxWidth(1);
    nodeColumn.setMinWidth(1);
    //        o.getColumnModel().removeColumn(nodeColumn);

  }