org.jdesktop.swingx.treetable.DefaultTreeTableModel Java Examples

The following examples show how to use org.jdesktop.swingx.treetable.DefaultTreeTableModel. 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 File: ContextAccessControlPanel.java    From zap-extensions with 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 File: GPTreeTableBase.java    From ganttproject with 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 File: GuildSearchService.java    From gameserver with 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 File: GuildBagSearchService.java    From gameserver with 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 File: GuildMemberSearchService.java    From gameserver with 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 File: AccountSearchService.java    From gameserver with 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 File: UserSearchService.java    From gameserver with 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 File: FileSystemPanel.java    From aion-germany with 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());
}