Java Code Examples for org.jdesktop.swingx.treetable.DefaultTreeTableModel

The following examples show how to use org.jdesktop.swingx.treetable.DefaultTreeTableModel. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: zap-extensions   Source File: ContextAccessControlPanel.java    License: Apache License 2.0 5 votes vote down vote up
private ContextPanelUsersSelectComboBox getUsersComboBox() {
    if (usersComboBox == null) {
        usersComboBox = new ContextPanelUsersSelectComboBox(getContextId());

        // We need to add a 'custom' user for allowing setting access rules for unauthenticated
        // visitors. The custom user will have the id '-1' which is an id that should not be
        // generated for normal users.
        User unauthenticatedUser =
                new User(getContextId(), UNAUTHENTICATED_USER_NAME, UNAUTHENTICATED_USER_ID);
        unauthenticatedUser.setEnabled(true);
        usersComboBox.setCustomUsers(new User[] {unauthenticatedUser});

        usersComboBox.addActionListener(
                new ActionListener() {

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        User selectedUser = usersComboBox.getSelectedUser();
                        if (selectedUser != null) {
                            selectedUserId = selectedUser.getId();
                            tree.setVisible(true);
                            if (internalRulesManager != null) {
                                tree.setTreeTableModel(getUserAccessRulesModel(selectedUserId));
                            }
                            tree.expandAll();
                        } else {
                            tree.setVisible(false);
                            tree.setTreeTableModel(new DefaultTreeTableModel());
                            tree.expandAll();
                        }
                    }
                });
    }
    return usersComboBox;
}
 
Example 2
Source Project: ganttproject   Source File: GPTreeTableBase.java    License: GNU General Public License v3.0 5 votes vote down vote up
protected GPTreeTableBase(IGanttProject project, UIFacade uiFacade, CustomPropertyManager customPropertyManager,
                          DefaultTreeTableModel model) {
  super(model);
  setTableHeader(new JTableHeader(getColumnModel()) {
    @Override
    public void applyComponentOrientation(ComponentOrientation o) {
      super.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
    }
  });
  myCustomPropertyManager = customPropertyManager;
  myUiFacade = uiFacade;
  myProject = project;
  myProject.addProjectEventListener(new ProjectEventListener.Stub() {
    @Override
    public void projectClosed() {
      getTableHeaderUiFacade().clear();
    }

    @Override
    public void projectOpened() {
      onProjectOpened();
    }

    @Override
    public void projectCreated() {
      onProjectCreated();
    }
  });
  setAutoStartEditOnKeyStroke(true);
  setSurrendersFocusOnKeystroke(true);
}
 
Example 3
Source Project: gameserver   Source File: GuildSearchService.java    License: Apache License 2.0 5 votes vote down vote up
public GuildSearchService(DefaultTreeTableModel model, String userNameOrId, boolean preciMatch) {
	this.model = model;
	this.preciMatch = preciMatch;
	this.userNameOrId = userNameOrId;
	this.databaseName = ConfigManager.getConfigAsString(ConfigKey.mongoDBName);
	this.namespace = ConfigManager.getConfigAsString(ConfigKey.mongoNamespace);
}
 
Example 4
Source Project: gameserver   Source File: GuildBagSearchService.java    License: Apache License 2.0 5 votes vote down vote up
public GuildBagSearchService(DefaultTreeTableModel model, String userNameOrId, boolean preciMatch) {
	this.model = model;
	this.preciMatch = preciMatch;
	this.userNameOrId = userNameOrId;
	this.databaseName = ConfigManager.getConfigAsString(ConfigKey.mongoDBName);
	this.namespace = ConfigManager.getConfigAsString(ConfigKey.mongoNamespace);
}
 
Example 5
Source Project: gameserver   Source File: GuildMemberSearchService.java    License: Apache License 2.0 5 votes vote down vote up
public GuildMemberSearchService(DefaultTreeTableModel model, String userNameOrId, boolean preciMatch) {
	this.model = model;
	this.preciMatch = preciMatch;
	this.userNameOrId = userNameOrId;
	this.databaseName = ConfigManager.getConfigAsString(ConfigKey.mongoDBName);
	this.namespace = ConfigManager.getConfigAsString(ConfigKey.mongoNamespace);
}
 
Example 6
Source Project: gameserver   Source File: AccountSearchService.java    License: Apache License 2.0 5 votes vote down vote up
public AccountSearchService(DefaultTreeTableModel model, String userNameOrId, boolean preciMatch) {
	this.model = model;
	this.preciMatch = preciMatch;
	this.userNameOrId = userNameOrId;
	this.databaseName = ConfigManager.getConfigAsString(ConfigKey.mongoDBName);
	this.namespace = ConfigManager.getConfigAsString(ConfigKey.mongoNamespace);
}
 
Example 7
Source Project: gameserver   Source File: UserSearchService.java    License: Apache License 2.0 5 votes vote down vote up
public UserSearchService(DefaultTreeTableModel model, 
		String userNameOrId, boolean preciMatch) {
	this.model = model;
	this.preciMatch = preciMatch;
	this.userNameOrId = userNameOrId;
	this.databaseName = ConfigManager.getConfigAsString(ConfigKey.mongoDBName);
	this.namespace = ConfigManager.getConfigAsString(ConfigKey.mongoNamespace);
}
 
Example 8
Source Project: aion-germany   Source File: FileSystemPanel.java    License: GNU General Public License v3.0 4 votes vote down vote up
public FileSystemPanel(String name)
{
    this.setLayout(new GridBagLayout());
    GridBagConstraints cons = new GridBagConstraints();

    getFileTree().setTreeCellRenderer(new LogTreeRenderer());
    getFileTree().getColumnModel().getColumn(0).setPreferredWidth(140);
    getFileTree().getColumnModel().getColumn(1).setPreferredWidth(50);
    getFileTree().getColumnModel().getColumn(0).setPreferredWidth(100);
    getFileTree().addMouseListener(new LogTreeMouseAdpater());

    this.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(name),
            BorderFactory.createEmptyBorder(5,5,5,5)));

    cons.anchor = GridBagConstraints.NORTHWEST;
    cons.fill = GridBagConstraints.BOTH;
    cons.insets = new Insets(2,2,2,2);
    cons.weightx = 1.0;
    this.add(_quickFilter, cons);


    cons.fill = GridBagConstraints.NONE;
    
    _refreshLocalButton.setPreferredSize(new Dimension(_refreshLocalButton.getIcon().getIconWidth()+9, _refreshLocalButton.getIcon().getIconHeight()+9));
    _refreshLocalButton.setToolTipText("Refresh Local Logs");
    _refreshLocalButton.setActionCommand("refreshLocal");
    _refreshLocalButton.addActionListener(this);
    this.add(_refreshLocalButton);
    
    _refreshRemoteButton.setPreferredSize(new Dimension(_refreshRemoteButton.getIcon().getIconWidth()+9, _refreshRemoteButton.getIcon().getIconHeight()+9));
    _refreshRemoteButton.setToolTipText("Refresh Remote Logs");
    _refreshRemoteButton.setActionCommand("refreshRemote");
    _refreshRemoteButton.addActionListener(this);
    this.add(_refreshRemoteButton);
    
    cons.fill = GridBagConstraints.BOTH;

    cons.gridwidth = 3;
    cons.weighty = 1.0;
    cons.gridy = 1;
    this.add(new JScrollPane(getFileTree()), cons);
    cons.weighty = 0.0;
    cons.gridy = 2;
    this.add(_statsLabel, cons);
    
    DefaultMutableTreeTableNode root = (DefaultMutableTreeTableNode) this.getFileTree().getTreeTableModel().getRoot();
    _local = new DefaultMutableTreeTableNode("Local Logs");
    _remote = new DefaultMutableTreeTableNode("Remote Logs");
    DefaultTreeTableModel model = (DefaultTreeTableModel) this.getFileTree().getTreeTableModel();
    model.insertNodeInto(_local, root, root.getChildCount());
    model.insertNodeInto(_remote, root, root.getChildCount());
}