Ejemplo n.º 1
0
  private void setupLogDisplay() {
    LogDND.makeComponentTarget(
        display.displayTabs,
        new LogDNDTarget() {
          @Override
          public void takeLogsFromDrop(Log[] log) {
            if (log.length < 1) return;
            List<Log> list = new LinkedList<>(Arrays.asList(log));
            displayLog(list.remove(0), list);
          }
        });

    tabDisplayer = new ToolDisplayTabs(display);
  }
Ejemplo n.º 2
0
  private void setupLogsTab() {
    String last = "don't filter";
    Vector<String> streamVector = new Vector<String>();
    for (Pair<String, Criteria> pair : LogSearching.CRITERIA) {
      streamVector.add("search for: " + pair.a);
    }
    streamVector.add(last);

    ActionListener tellModel =
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            model.treeReSorted();
          }
        };

    display.sasStreamProfile.setModel(new DefaultComboBoxModel<String>(streamVector));
    display.sasStreamProfile.setSelectedItem(last);
    display.sasStreamProfile.addActionListener(tellModel);

    display.sasOrderBox.setModel(new DefaultComboBoxModel<>(LogSorting.Sort.values()));
    display.sasOrderBox.setSelectedItem(LogSorting.Sort.BY_ARRIVAL);
    display.sasOrderBox.addActionListener(tellModel);

    model = new LogTreeModel();
    display.logTree.setModel(model);
    display.logTree.setCellRenderer(model);

    display.logTree.setEditable(false);
    display.logTree.setRootVisible(false);
    display.logTree.setScrollsOnExpand(true);
    display
        .logTree
        .getSelectionModel()
        .setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
    display.logTree.addTreeSelectionListener(model);
    LogDND.makeComponentSource(display.logTree, model);

    display.logTree.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyReleased(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_DELETE || e.getKeyCode() == KeyEvent.VK_BACK_SPACE) {
              model.deleteCurrent();
            }
          }
        });
  }