Package org.jamesii.gui.utils.treetable

Examples of org.jamesii.gui.utils.treetable.GroupingTreeTableModel


  @SuppressWarnings("unchecked")
  public SyntaxEditorInfoTable(final JTextComponent editor) {
    super(null);

    final GroupingTreeTableModel ttModel =
        new GroupingTreeTableModel(tableModel =
            new InfoProviderTableModel(Collections.EMPTY_LIST), 0) {
          @Override
          protected Object getValueForGroup(Object groupingObject,
              int columnIndex) {
            if (columnIndex == 1) {
              return String.format("(%d) Elements",
                  this.getElementCountInGroup(groupingObject));
            }
            return super.getValueForGroup(groupingObject, columnIndex);
          }
        };
    super.setTreeTableModel(ttModel);

    // set dimensions of table columns
    getColumnModel().getColumn(0).setWidth(45);
    getColumnModel().getColumn(0).setMaxWidth(45);
    getColumnModel().getColumn(0).setMinWidth(45);
    getColumnModel().getColumn(0).setCellRenderer(new IconAwareCellRenderer());
    getTableHeader().setReorderingAllowed(false);

    // react on double click on table item -> select area in editor
    // specified by token
    addMouseListener(new MouseAdapter() {
      @Override
      public void mouseClicked(MouseEvent e) {
        if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
          int row = ttModel.getRowForNode(getNode(getSelectedRow()));
          if (row >= 0) {
            ILexerToken token = tableModel.getTokenAt(row);
            editor.select(token.getStart(), token.getEnd());
            editor.requestFocus();
          }
          e.consume();
        }
      }
    });

    // react on left click on specific information entries with
    // information actions
    addMouseListener(new MouseAdapter() {
      @Override
      public void mousePressed(MouseEvent e) {
        mouseReleased(e);
      }

      @Override
      public void mouseReleased(MouseEvent event) {
        if (event.isPopupTrigger()) {
          // get token at triggered location
          int row = ttModel.getRowForNode(getNode(getSelectedRow()));
          if (row >= 0) {
            ILexerToken token = tableModel.getTokenAt(row);
            // get provider for token
            IInfoProvider provider = tableModel.getInfoProviderForToken(token);
View Full Code Here


   *          the contribution
   * @param icon
   *          the icon
   */
  public BasicLogView(String title, Contribution contribution, Icon icon) {
    super(title, new GroupingTreeTableModel(new LogRecordTableModel(), 0) {

      @Override
      protected Object getValueForGroup(Object groupingObject, int columnIndex) {
        if (columnIndex == 3) {
          // add log count
View Full Code Here

TOP

Related Classes of org.jamesii.gui.utils.treetable.GroupingTreeTableModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.