List of usage examples for javax.swing.tree TreePath getLastPathComponent
public Object getLastPathComponent()
From source file:ro.nextreports.designer.wizpublish.PublishFileWizardPanel.java
private boolean selection(JcrBrowserTree jcrBrowserTree, byte type) { TreePath treePath = jcrBrowserTree.getSelectionPath(); if (treePath == null) { return false; }/*from w w w . j av a 2 s . co m*/ final DBBrowserNode selectedNode = (DBBrowserNode) treePath.getLastPathComponent(); if ((type == DBObject.REPORTS_GROUP) || (type == DBObject.CHARTS_GROUP)) { boolean download = (Boolean) context.getAttribute(PublishWizard.DOWNLOAD); String path = selectedNode.getDBObject().getAbsolutePath(); if (selectedNode.getDBObject().getType() == DBObject.FOLDER_REPORT) { pathTextField.setText(path); overwrite = false; } else if (selectedNode.getDBObject().getType() == DBObject.REPORTS_GROUP) { pathTextField.setText(JcrNodeExpander.REPORTS_ROOT); overwrite = false; } else if (selectedNode.getDBObject().getType() == DBObject.CHARTS_GROUP) { pathTextField.setText(JcrNodeExpander.CHARTS_ROOT); overwrite = false; } else if ((selectedNode.getDBObject().getType() == DBObject.REPORTS) || (selectedNode.getDBObject().getType() == DBObject.CHARTS)) { // report if (download) { pathTextField.setText(path); } else { pathTextField.setText(path.substring(0, path.lastIndexOf("/"))); nameTextField.setText(path.substring(path.lastIndexOf("/") + 1)); } overwrite = true; } if (download && !overwrite) { String entity = (String) context.getAttribute(WizardConstants.ENTITY); String name; if (WizardConstants.ENTITY_REPORT.equals(entity)) { name = I18NSupport.getString("report"); } else { name = I18NSupport.getString("chart"); } Show.info(SwingUtilities.getWindowAncestor(jcrBrowserTree), I18NSupport.getString("download.name.select", name)); return false; } } else if (type == DBObject.DATABASE) { if (selectedNode.getDBObject().getType() != DBObject.DATASOURCE) { return false; } dataSourceTextField.setText(selectedNode.getDBObject().getAbsolutePath()); } return true; }
From source file:ro.nextreports.designer.wizpublish.SelectEntityWizardPanel.java
private void add() { // ignore double click listener for tree (which opens the query) // and create our own listener (which just selects the path) final DBBrowserTree dbBrowserTree = new DBBrowserTree(type, false); dbBrowserTree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); dbBrowserTree.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { job(e, true);//www.ja v a 2 s. co m } public void mouseReleased(MouseEvent e) { job(e, false); } private void job(MouseEvent e, boolean pressed) { TreePath[] paths = dbBrowserTree.getSelectionPaths(); if (paths == null) { return; } dbBrowserTree.setSelectionPaths(paths); } }); JScrollPane scroll = new JScrollPane(dbBrowserTree); scroll.setPreferredSize(scrTreeDim); JPanel panel = new JPanel(); panel.add(scroll); JDialog dialog = new BaseDialog(panel, I18NSupport.getString("wizard.publish.entities.select"), true) { protected boolean ok() { TreePath[] paths = dbBrowserTree.getSelectionPaths(); if (paths == null) { return false; } for (TreePath selPath : paths) { final DBBrowserNode selectedNode = (DBBrowserNode) selPath.getLastPathComponent(); if (!selectedNode.getDBObject().isFolder()) { String path = selectedNode.getDBObject().getAbsolutePath(); if (!listModel.contains(path)) { // convert xml if needed before add to list if (selectedNode.getDBObject().getType() == DBObject.REPORTS) { byte result = ConverterUtil.convertIfNeeded(path); if (result != ConverterUtil.TYPE_CONVERSION_EXCEPTION) { listModel.addElement(path); } } else { listModel.addElement(path); } } } } return true; } }; dialog.setBackground(Color.WHITE); dialog.pack(); Show.centrateComponent(Globals.getMainFrame(), dialog); dialog.setVisible(true); }
From source file:rsc.backend.modules.ips.IPS.java
public void valueForPathChanged(TreePath path, Object newValue) { if (path.getLastPathComponent() instanceof TreeElement) ((TreeElement) path.getLastPathComponent()).setName(newValue.toString()); }
From source file:ru.apertum.qsystem.client.forms.FReception.java
/** * ?? ? ?? ?.//from w w w . j a v a 2s. c o m */ private void serviceListChange() { final TreePath selectedPath = treeServices.getSelectionPath(); if (selectedPath != null) { showServiceInfo((QService) selectedPath.getLastPathComponent()); } }
From source file:ru.apertum.qsystem.client.forms.FReception.java
@Action public void serviceDisable() { final TreePath selectedPath = treeServices.getSelectionPath(); if (selectedPath != null) { final QService service = (QService) selectedPath.getLastPathComponent(); final String name = (String) JOptionPane.showInputDialog(this, getLocaleMessage("admin.select_ability.message") + " \"" + service.getName() + "\"", getLocaleMessage("admin.select_ability.title"), JOptionPane.QUESTION_MESSAGE, null, new String[] { getLocaleMessage("admin.service_ability.yes"), getLocaleMessage("admin.service_ability.no") }, null);/*from w w w . j a va2 s. com*/ //? , if (name != null) { if (name.equalsIgnoreCase(getLocaleMessage("admin.service_ability.yes"))) { NetCommander.changeTempAvailableService(netProperty, service.getId(), ""); } else { final String mess = (String) JOptionPane.showInputDialog(this, getLocaleMessage("admin.ability.enter_reason"), getLocaleMessage("admin.select_ability.title"), JOptionPane.QUESTION_MESSAGE); if (mess != null) { NetCommander.changeTempAvailableService(netProperty, service.getId(), mess); } else { return; } } JOptionPane.showMessageDialog(this, getLocaleMessage("admin.select_ability.message") + " " + service.getName() + " \"" + name + "\"", getLocaleMessage("admin.select_ability.title"), JOptionPane.INFORMATION_MESSAGE); } } }
From source file:se.nawroth.asciidoc.browser.AsciidocBrowserApplication.java
public AsciidocBrowserApplication(final String[] args) { super("Asciidoc Browser"); setIconImage(Icons.APPLICATION.image()); setSize(1200, 1024);/* ww w . ja v a2s .c o m*/ addWindowListener(new WindowAdapter() { @Override public void windowClosing(final WindowEvent e) { actionExit(); } }); JPanel buttonPanel = new JPanel(); backButton = new JButton(""); backButton.setIcon(Icons.BACK.icon()); backButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { actionBack(); } }); buttonPanel.setLayout(new MigLayout("", "[1px][][][][]", "[1px]")); JButton btnOptionsbutton = new JButton(""); btnOptionsbutton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { settingsDialog.setVisible(true); } }); btnOptionsbutton.setIcon(Icons.OPTIONS.icon()); buttonPanel.add(btnOptionsbutton, "flowx,cell 0 0"); backButton.setEnabled(false); buttonPanel.add(backButton, "cell 0 0,grow"); forwardButton = new JButton(""); forwardButton.setIcon(Icons.FORWARD.icon()); forwardButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { actionForward(); } }); forwardButton.setEnabled(false); buttonPanel.add(forwardButton, "cell 0 0,grow"); getContentPane().setLayout(new MigLayout("", "[793.00px,grow]", "[44px][930px]")); getContentPane().add(buttonPanel, "cell 0 0,growx,aligny top"); locationTextField = new JTextField(65); locationTextField.setText(""); locationTextField.addKeyListener(new KeyAdapter() { @Override public void keyReleased(final KeyEvent e) { int keyCode = e.getKeyCode(); if (keyCode == KeyEvent.VK_ENTER || keyCode == KeyEvent.VK_TAB) { actionGo(); refreshDocumentTree(); } } }); locationTextField.setTransferHandler( new TextFieldTransferHandler(locationTextField.getTransferHandler(), new Runnable() { @Override public void run() { locationTextField.setText(""); } }, new Runnable() { @Override public void run() { actionGo(); refreshDocumentTree(); } })); homebutton = new JButton(""); homebutton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { locationTextField.setText(Settings.getHome()); actionGo(); refreshDocumentTree(); } }); refreshButton = new JButton(""); refreshButton.setToolTipText("Refresh"); refreshButton.setEnabled(false); refreshButton.setIcon(Icons.REFRESH.icon()); refreshButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { actionGo(); refreshPreview(); } }); buttonPanel.add(refreshButton, "cell 1 0"); homebutton.setIcon(Icons.HOME.icon()); buttonPanel.add(homebutton, "cell 2 0"); buttonPanel.add(locationTextField, "cell 3 0,grow"); treeSourceSplitPane = new JSplitPane(); treeSourceSplitPane.setResizeWeight(0.3); getContentPane().add(treeSourceSplitPane, "cell 0 1,grow"); treeScrollPane = new JScrollPane(); treeScrollPane.setMinimumSize(new Dimension(200, 200)); treeSourceSplitPane.setLeftComponent(treeScrollPane); documentTree = new DocumentTree(documentModel); documentTree.setCellRenderer(new TooltipsTreeCellRenderer()); ToolTipManager.sharedInstance().registerComponent(documentTree); ToolTipManager.sharedInstance().setInitialDelay(INITIAL_TOOLTIP_DELAY); ToolTipManager.sharedInstance().setReshowDelay(0); documentTree.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(final TreeSelectionEvent tse) { TreePath newLeadSelectionPath = tse.getNewLeadSelectionPath(); if (newLeadSelectionPath != null && !newLeadSelectionPath.equals(currentSelectionPath)) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) newLeadSelectionPath .getLastPathComponent(); FileWrapper file = (FileWrapper) node.getUserObject(); showFile(file, true); refreshPreview(); } } }); treeScrollPane.setViewportView(documentTree); sourceEditorPane = new JEditorPane(); sourceEditorPane.setContentType("text/html"); sourceEditorPane.setEditable(false); sourceEditorPane.addHyperlinkListener(new HandleHyperlinkUpdate()); JScrollPane fileScrollPane = new JScrollPane(sourceEditorPane); fileScrollPane.setMinimumSize(new Dimension(600, 600)); documentTabbedPane = new JTabbedPane(SwingConstants.BOTTOM); documentTabbedPane.addChangeListener(new ChangeListener() { @Override public void stateChanged(final ChangeEvent ce) { refreshPreview(); } }); sourceLogSplitPane = new JSplitPane(); sourceLogSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); treeSourceSplitPane.setRightComponent(sourceLogSplitPane); sourceLogSplitPane.setTopComponent(documentTabbedPane); documentTabbedPane.add(fileScrollPane); documentTabbedPane.setTitleAt(0, "Source"); browserPane = new BrowserPane(); previewScrollPane = new JScrollPane(browserPane); documentTabbedPane.addTab("Preview", null, previewScrollPane, null); console = new JConsole(); System.setErr(console.getErr()); System.setOut(console.getOut()); sourceLogSplitPane.setBottomComponent(console); executor = new AsciidocExecutor(); }
From source file:ui.panel.UILicenseAdd.java
public JPanel createButtonPanel() { JPanel panel = p.createPanel(Layouts.flow); panel.setLayout(new FlowLayout(FlowLayout.CENTER)); btnSubmit = b.createButton("Submit"); btnCancel = b.createButton("Cancel"); btnSubmit.addActionListener(new ActionListener() { @Override/*from w ww.j a v a 2s. com*/ public void actionPerformed(ActionEvent e) { SwingWorker<Void, Void> mySwingWorker = new SwingWorker<Void, Void>() { @Override protected Void doInBackground() throws Exception { TreePath[] path = checkTreeManager.getSelectionModel().getSelectionPaths(); ArrayList<String> featureL = new ArrayList<String>(); String[] features = new String[] {}; for (TreePath tp : path) { if (tp.getLastPathComponent().toString().equals("Features")) { Object rootNode = tree.getModel().getRoot(); int parentCount = tree.getModel().getChildCount(rootNode); for (int i = 0; i < parentCount; i++) { Object parentNode = tree.getModel().getChild(rootNode, i); int childrenCount = tree.getModel().getChildCount(parentNode); for (int x = 0; x < childrenCount; x++) { MyDataNode node = (MyDataNode) tree.getModel().getChild(parentNode, x); featureL.add(node.getValue()); } } } else if (tp.getPathCount() == 2) { Object rootNode = tree.getModel().getRoot(); int parentCount = tree.getModel().getChildCount(rootNode); for (int i = 0; i < parentCount; i++) { Object parentNode = tree.getModel().getChild(rootNode, i); if (parentNode.toString().equals(tp.getLastPathComponent().toString())) { int childrenCount = tree.getModel().getChildCount(parentNode); for (int x = 0; x < childrenCount; x++) { MyDataNode node = (MyDataNode) tree.getModel().getChild(parentNode, x); featureL.add(node.getValue()); } } } } else if (tp.getPathCount() == 3) { MyDataNode node = (MyDataNode) tp.getLastPathComponent(); featureL.add(node.getValue()); } } features = featureL.toArray(features); String duration = spnValidity.getValue().toString(); if (cbPerpetual.isSelected()) { duration = "-1"; } String storage = spnCloud.getValue().toString(); String maxVCA = spnConcurrentVCA.getValue().toString(); String response = apiCall.addNodeLicense(Data.targetURL, Data.sessionKey, Data.bucketID, features, duration, storage, maxVCA); try { JSONObject responseObject = new JSONObject(response); if (responseObject.get("result").equals("ok")) { Data.mainFrame.uiLicenseDetail.getLicenseData(); Data.mainFrame.showPanel("license"); } } catch (JSONException e1) { e1.printStackTrace(); } return null; } }; Window win = SwingUtilities.getWindowAncestor((AbstractButton) e.getSource()); final JDialog dialog = new JDialog(win, "Loading", ModalityType.APPLICATION_MODAL); mySwingWorker.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("state")) { if (evt.getNewValue() == SwingWorker.StateValue.DONE) { dialog.dispose(); } } } }); mySwingWorker.execute(); JProgressBar progressBar = new JProgressBar(); progressBar.setIndeterminate(true); JPanel panel = new JPanel(new BorderLayout()); panel.add(progressBar, BorderLayout.CENTER); panel.add(new JLabel("Retrieving License..."), BorderLayout.PAGE_START); dialog.add(panel); dialog.pack(); dialog.setBounds(50, 50, 300, 100); dialog.setLocationRelativeTo(Data.mainFrame); dialog.setVisible(true); } }); btnCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setVisible(false); Data.mainFrame.showPanel("license"); } }); panel.add(btnSubmit); panel.add(btnCancel); return panel; }
From source file:uk.nhs.cfh.dsp.srth.desktop.modules.querycreationtreepanel.QueryAuthoringTreePanel.java
/** * Creates the tree interface./*from w w w . java 2 s . co m*/ */ private void createTreeInterface() { reportingQueryTreeModel = new ReportingQueryStatementTreeModel(activeQuery); queryInterfaceTree = new JXTree(reportingQueryTreeModel); // queryInterfaceTree.setCellRenderer(new ReportingQueryStatementTreeCellRenderer(humanReadableRender)); queryInterfaceTree.setCellRenderer(new StyledQueryStatementTreeCellRenderer(humanReadableRender)); queryInterfaceTree.addHighlighter(HighlighterFactory.createAlternateStriping()); // add listener for mouse events queryInterfaceTree.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { evaluatePopupAction(e); } @Override public void mouseReleased(MouseEvent e) { evaluatePopupAction(e); } private void evaluatePopupAction(MouseEvent e) { // get node selected int row = queryInterfaceTree.getRowForLocation(e.getX(), e.getY()); if (row > -1) { TreePath selectedPath = queryInterfaceTree.getPathForLocation(e.getX(), e.getY()); Object node = selectedPath.getLastPathComponent(); if (node != null && node instanceof QueryExpression) { QueryExpression expression = (QueryExpression) node; // set selected expression selectedExpression = expression; // check if right click if (expression instanceof QueryIntersectionExpression || expression instanceof QueryUnionExpression || expression instanceof QueryStatement) { if (e.isPopupTrigger()) { queryActionsMenu.show(e.getComponent(), e.getX(), e.getY()); } } else if (expression instanceof QueryComponentExpression) { if (e.getClickCount() == 2) { QueryComponentExpression componentExpression = (QueryComponentExpression) expression; // get selected sub query and display it in a dialog queryComponentExpressionPanel.setComponentExpression(componentExpression); // queryComponentExpressionDialog.setTitle("Author Component Query"); queryComponentExpressionDialog.setVisible(true); } else if (e.isPopupTrigger()) { toggleStatusMenu.show(e.getComponent(), e.getX(), e.getY()); } } } } else { if (queryActionsMenu.isVisible()) { queryActionsMenu.setVisible(false); } if (toggleStatusMenu.isVisible()) { toggleStatusMenu.setVisible(false); } } } }); }
From source file:uk.nhs.cfh.dsp.srth.desktop.modules.resultexplanationpanel.ResultsExplanationPanel.java
/** * Inits the components./*from ww w . j a v a 2 s.co m*/ */ public synchronized void initComponents() { while (activeFrame == null) { if (applicationService != null && applicationService.getFrameView() != null) { activeFrame = applicationService.getFrameView().getActiveFrame(); } } // create collections dialog createCollectionsDialog(); tableModel = new ReportingEngineExplanationTreeTableModel(queryService.getActiveQuery(), statsMap); treeTable = new JXTreeTable(tableModel); treeTable.setTreeCellRenderer(new SQLResultsExplanationTreeCellRenderer(queryExpressionHTMLRenderer)); // add mouse listeners treeTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { // get value at selection int row = treeTable.rowAtPoint(e.getPoint()); if (row > -1) { TreePath path = treeTable.getPathForLocation(e.getX(), e.getY()); // get node Object node = path.getLastPathComponent(); if (node instanceof QueryExpression) { QueryExpression expression = (QueryExpression) node; // get collection for selected expression QueryStatisticsCollection collection = statsMap.get(expression); // set expression in collection panel collectionPanel.setCollection(collection); collectionPanel.revalidate(); // show collections dialog collectionDialog.setVisible(true); } } } } }); // add components to this object setLayout(new BorderLayout()); // add(label, BorderLayout.NORTH); add(new JScrollPane(treeTable), BorderLayout.CENTER); }
From source file:VASSAL.launch.ModuleManagerWindow.java
protected void buildTree() { recentModuleConfig = new StringArrayConfigurer("RecentModules", null); Prefs.getGlobalPrefs().addOption(null, recentModuleConfig); final List<String> missingModules = new ArrayList<String>(); final List<ModuleInfo> moduleList = new ArrayList<ModuleInfo>(); for (String s : recentModuleConfig.getStringArray()) { final ModuleInfo module = new ModuleInfo(s); if (module.getFile().exists() && module.isValid()) { moduleList.add(module);//www . j a v a2 s . co m } else { missingModules.add(s); } } for (String s : missingModules) { logger.info(Resources.getString("ModuleManager.removing_module", s)); moduleList.remove(s); recentModuleConfig.removeValue(s); } Collections.sort(moduleList, new Comparator<ModuleInfo>() { public int compare(ModuleInfo f1, ModuleInfo f2) { return f1.compareTo(f2); } }); rootNode = new MyTreeNode(new RootInfo()); for (ModuleInfo moduleInfo : moduleList) { final MyTreeNode moduleNode = new MyTreeNode(moduleInfo); for (ExtensionInfo ext : moduleInfo.getExtensions()) { final MyTreeNode extensionNode = new MyTreeNode(ext); moduleNode.add(extensionNode); } final ArrayList<File> missingFolders = new ArrayList<File>(); for (File f : moduleInfo.getFolders()) { if (f.exists() && f.isDirectory()) { final GameFolderInfo folderInfo = new GameFolderInfo(f, moduleInfo); final MyTreeNode folderNode = new MyTreeNode(folderInfo); moduleNode.add(folderNode); final ArrayList<File> l = new ArrayList<File>(); final File[] files = f.listFiles(); if (files == null) continue; for (File f1 : files) { if (f1.isFile()) { l.add(f1); } } Collections.sort(l); for (File f2 : l) { final SaveFileInfo fileInfo = new SaveFileInfo(f2, folderInfo); if (fileInfo.isValid() && fileInfo.belongsToModule()) { final MyTreeNode fileNode = new MyTreeNode(fileInfo); folderNode.add(fileNode); } } } else { missingFolders.add(f); } } for (File mf : missingFolders) { logger.info(Resources.getString("ModuleManager.removing_folder", mf.getPath())); moduleInfo.removeFolder(mf); } rootNode.add(moduleNode); } updateModuleList(); treeModel = new MyTreeTableModel(rootNode); tree = new MyTree(treeModel); tree.setRootVisible(false); tree.setEditable(false); tree.setTreeCellRenderer(new MyTreeCellRenderer()); tree.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { final TreePath path = tree.getPathForLocation(e.getPoint().x, e.getPoint().y); // do nothing if not on a node, or if this node was expanded // or collapsed during the past doubleClickInterval milliseconds if (path == null || (lastExpansionPath == path && e.getWhen() - lastExpansionTime <= doubleClickInterval)) return; selectedNode = (MyTreeNode) path.getLastPathComponent(); final int row = tree.getRowForPath(path); if (row < 0) return; final AbstractInfo target = (AbstractInfo) selectedNode.getUserObject(); // launch module or load save, otherwise expand or collapse node if (target instanceof ModuleInfo) { final ModuleInfo modInfo = (ModuleInfo) target; if (modInfo.isModuleTooNew()) { ErrorDialog.show("Error.module_too_new", modInfo.getFile().getPath(), modInfo.getVassalVersion(), Info.getVersion()); return; } else { ((ModuleInfo) target).play(); } } else if (target instanceof SaveFileInfo) { ((SaveFileInfo) target).play(); } else if (tree.isExpanded(row)) { tree.collapseRow(row); } else { tree.expandRow(row); } } } @Override public void mouseReleased(MouseEvent e) { final TreePath path = tree.getPathForLocation(e.getPoint().x, e.getPoint().y); if (path == null) return; selectedNode = (MyTreeNode) path.getLastPathComponent(); if (e.isMetaDown()) { final int row = tree.getRowForPath(path); if (row >= 0) { tree.clearSelection(); tree.addRowSelectionInterval(row, row); final AbstractInfo target = (AbstractInfo) selectedNode.getUserObject(); target.buildPopup(row).show(tree, e.getX(), e.getY()); } } } }); // We capture the time and location of clicks which would cause // expansion in order to distinguish these from clicks which // might launch a module or game. tree.addTreeWillExpandListener(new TreeWillExpandListener() { public void treeWillCollapse(TreeExpansionEvent e) { lastExpansionTime = System.currentTimeMillis(); lastExpansionPath = e.getPath(); } public void treeWillExpand(TreeExpansionEvent e) { lastExpansionTime = System.currentTimeMillis(); lastExpansionPath = e.getPath(); } }); // This ensures that double-clicks always start the module but // doesn't prevent single-clicks on the handles from working. tree.setToggleClickCount(3); tree.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { final MyTreeNode node = (MyTreeNode) e.getPath().getLastPathComponent(); final AbstractInfo target = node.getNodeInfo(); if (target instanceof ModuleInfo) { setSelectedModule(target.getFile()); } else { if (node.getParent() != null) { setSelectedModule(node.getParentModuleFile()); } } } }); // FIXME: Width handling needs improvement. Also save in prefs tree.getColumnModel().getColumn(KEY_COLUMN).setMinWidth(250); tree.getColumnModel().getColumn(VERSION_COLUMN).setCellRenderer(new VersionCellRenderer()); tree.getColumnModel().getColumn(VERSION_COLUMN).setMinWidth(100); tree.getColumnModel().getColumn(VASSAL_COLUMN).setCellRenderer(new VersionCellRenderer()); tree.getColumnModel().getColumn(VASSAL_COLUMN).setMinWidth(100); tree.getColumnModel().getColumn(SPARE_COLUMN).setMinWidth(10); tree.getColumnModel().getColumn(SPARE_COLUMN).setPreferredWidth(600); // FIXME: How to set alignment of individual header components? tree.getTableHeader().setAlignmentX(JComponent.CENTER_ALIGNMENT); }