Package ca.odell.glazedlists.swing

Examples of ca.odell.glazedlists.swing.TableComparatorChooser$TableHeaderUIHandler


        installEventList(eventList);

        masterTable = createTable(createTableModel());

        // Finish the sorting installation       
        new TableComparatorChooser(masterTable, sortedList, true);

        // If we have either a sort or a filter, we need a special selection model
//        if (matcher != null) {
//            EventSelectionModel selectionModel = new EventSelectionModel(eventList);
//            masterTable.setSelectionModel(selectionModel);
View Full Code Here


          new BeanTableFormat<ObservableObject>(propertyNames, columnLabels));
      final ObservableList<ServiceInfo> list = new ObservableList(servicesEventList, propertyNames, new String[]{"host", "name"});
      jTable.setModel(servicesTableModel);
      _selection = new EventSelectionModel<ObservableObject>(servicesEventList);
      jTable.setSelectionModel(_selection);
      TableComparatorChooser tableSorter = TableComparatorChooser.install(jTable, servicesEventList, TableComparatorChooser.SINGLE_COLUMN);
      new Timer("services table updated", true).schedule(new TimerTask()
      {

      @Override
      public void run()
View Full Code Here

      list = new ObservableList(servicesEventList, propertyNames, new String[]{"name"});
      //JTable jTable = new JTable(servicesTableModel);
      jTable.setModel(servicesTableModel);
      _selection = new EventSelectionModel<ObservableObject>(servicesEventList);
      jTable.setSelectionModel(_selection);
      TableComparatorChooser tableSorter = TableComparatorChooser.install(jTable, servicesEventList, TableComparatorChooser.SINGLE_COLUMN);
      Dimension size = jTable.getPreferredScrollableViewportSize();
//      jTable.setPreferredScrollableViewportSize
//          (new Dimension(jTable.getPreferredSize().width, size.height));
//      JScrollPane servicesListScrollPane = new JScrollPane(jTable);
//      this.setLayout(new BorderLayout());
View Full Code Here

        assertEquals(1, firstModel.getTableModelListeners().length);
        assertEquals(3, table.getColumnCount());


        // 2. wire up a TableComparatorChooser and make the third column sort
        TableComparatorChooser chooser = TableComparatorChooser.install(table, sorted, AbstractTableComparatorChooser.SINGLE_COLUMN);
        chooser.appendComparator(2, 0, false);

        // the TableComparatorChooser should install a PropertyChangeListener on the JTable
        assertEquals(initialNumPropertyChangeListenersOnJTable+1, table.getPropertyChangeListeners().length);
        // the TableComparatorChooser should install a TableModelListener on the EventTableModel
        assertEquals(2, firstModel.getTableModelListeners().length);

        // this assertion proves that the TableComparatorChooser cleared its sorting state
        assertEquals(1, chooser.getSortingColumns().size());


        // 3. changing the TableFormat within the existing EventTableModel should clear the sorting state
        firstModel.setTableFormat(new TestTableFormat(1));

        // this assertion proves that the JTable has rebuilt the TableColumnModel
        assertEquals(1, table.getColumnCount());
        // this assertion proves that the TableComparatorChooser cleared its sorting state
        assertTrue(chooser.getSortingColumns().isEmpty());
        assertEquals(2, firstModel.getTableModelListeners().length);


        // 4. reapply a sort to the JTable on the first column
        chooser.appendComparator(0, 0, false);
        assertEquals(1, chooser.getSortingColumns().size());


        // 5. set a new EventTableModel that only uses 2 columns
        secondModel = new EventTableModel<String>(sorted, new TestTableFormat(2));
        table.setModel(secondModel);

        // nothing should listen to firstModel, and secondModel is now active
        assertEquals(0, firstModel.getTableModelListeners().length);
        assertEquals(2, secondModel.getTableModelListeners().length);

        // this assertion proves that the JTable has rebuilt the TableColumnModel
        assertEquals(2, table.getColumnCount());
        // this assertion proves that the TableComparatorChooser cleared its sorting state
        assertTrue(chooser.getSortingColumns().isEmpty());


        // 6. disposing of the TableComparatorChooser should remove all listeners
        assertEquals(initialNumPropertyChangeListenersOnJTable+1, table.getPropertyChangeListeners().length);
        chooser.dispose();
        assertEquals(initialNumPropertyChangeListenersOnJTable, table.getPropertyChangeListeners().length);
        assertEquals(0, firstModel.getTableModelListeners().length);
        assertEquals(1, secondModel.getTableModelListeners().length); // the JTable is still listening to the secondModel

        // replacing the JTable's model should remove the remaining listener from secondModel
View Full Code Here

  protected JTable getTable() {
    return (JTable) getControl();
  }

  protected AbstractTableComparatorChooser createTableSorter(JTable table, SortedList sortedList) {
    return new TableComparatorChooser(table, sortedList, isMultipleColumnSort());
  }
View Full Code Here

        masterTable = createTable( createTableModel() );

        // Finish the sorting installation
        if( comparator != null || useSortedList()) {
            new TableComparatorChooser(masterTable, sortedList, true );
        }

        // If we have either a sort or a filter, we need a special selection model
        if( comparator != null || matcher != null || useSortedList()) {
            EventSelectionModel selectionModel = new EventSelectionModel(eventList);
View Full Code Here

        statusTable.setShowVerticalLines(true);
        statusTable.setShowHorizontalLines(false);
        statusTable.setSelectionModel( selectedProjectsModel );
       
        // setup sorting
        TableComparatorChooser chooser = new TableComparatorChooser( statusTable, sortedProjects, true );
        configureCustomComparators(chooser);
       
        // setup renderer
        StatusCellRenderer mtr = new StatusCellRenderer();
        statusTable.setDefaultRenderer(Object.class, mtr);
View Full Code Here

    methodList.addAll(traceModel.getMethodKeyBlackList());
    SortedList sortedMethodList = new SortedList(methodList, NoOpComparator.INSTANCE);
    TableModel tableModel = new EventTableModel(sortedMethodList, new MethodKeyTableFormat());
    blackListTable = new JTable();
    blackListTable.setModel(tableModel);
    new TableComparatorChooser(blackListTable, sortedMethodList, true);
    JTabbedPane tabbedPane = new JTabbedPane(SwingConstants.BOTTOM, JTabbedPane.WRAP_TAB_LAYOUT);
    traceTree = new JTree(traceModel.getRootNode());
    traceTree.setCellRenderer(new TraceTreeCellRenderer());
    traceTree.setRootVisible(false);
    traceTree.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
View Full Code Here

    // totalsTable.setShowVerticalLines(false);
    StatsMatcherEditorsPanel editorsPanel = new StatsMatcherEditorsPanel();
    editorsPanel.add(new StatsMatcherEditorPanel(classMatcherEditor, "Class Name"));
    editorsPanel.add(new StatsMatcherEditorPanel(methodMatcherEditor, "Method"));
    editorsPanel.add(new StatsMatcherEditorPanel(signatureMatcherEditor, "Signature"));
    TableComparatorChooser tableSorter = new TableComparatorChooser(accumulatorsTable, sortedAccumulators, true);
    setLayout(new BorderLayout());
    add(editorsPanel, BorderLayout.NORTH);
    add(new JScrollPane(accumulatorsTable,
        ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
        ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER), BorderLayout.CENTER);
View Full Code Here

TOP

Related Classes of ca.odell.glazedlists.swing.TableComparatorChooser$TableHeaderUIHandler

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.