private JMenu createFileMenu() { ActionMap actionMap = context.getActionMap(this); final JMenu file = new JMenu("File"); file.setMnemonic('f'); file.add(actionMap.get("openProject")); final JMenu fileRecent = new JMenu("Recent Projects"); fileRecent.setIcon(new ImageIcon("/resources/icons/open.png")); fileRecent.addMenuListener(new RecentProjectsMenuManager(application, projectService)); file.add(fileRecent); file.addSeparator(); final JMenu fileExport = new JMenu("Export To"); fileExport.setIcon(new ImageIcon("/resources/icons/exportTo.png")); fileExport.add(application.getAction(ExportToHtml.COMMAND)); fileExport.add(application.getAction(ExportToRecordBundle.COMMAND)); file.add(fileExport); final JMenu fileImport = new JMenu("Import From"); fileExport.setIcon(new ImageIcon("/resources/icons/import.png")); fileImport.add(application.getAction(ImportFromRecordBundle.COMMAND)); file.add(fileImport); file.addSeparator(); file.add(application.getAction(NewRvConnection.COMMAND)); final JMenu connRecent = new JMenu("Recent Connections"); connRecent.addMenuListener(new RecentConnectionsMenuManager(application)); file.add(connRecent); return file; }
private JTree createSubjectExplorer() { final JTree tree = new JTree(application.getSubjectHierarchy()); tree.setBorder(BorderFactory.createEmptyBorder()); tree.setRootVisible(false); tree.setShowsRootHandles(true); tree.setEditable(true); tree.setCellRenderer(new SubjectExplorerRenderer()); tree.setCellEditor(new SubjectExplorerEditor(application, tree)); application.getSubjectHierarchy().addTreeModelListener(new TreeExpander()); // This line allows the cell renderer to provide a custom tooltip for each node. ToolTipManager.sharedInstance().registerComponent(tree); return tree; }
public MainFrame( ApplicationContext context, Application application, RecordTypes recordTypes, ProjectService projectService) { setName("mainFrame"); this.context = context; this.application = application; this.recordTypes = recordTypes; this.projectService = projectService; statusBar = new StatusBar(application); subjectExplorer = createSubjectExplorer(); connectionList = new ConnectionList(application); messageLedger = createMessageLedger(application.getFilteredLedger()); connectionListScroller = createConnectionListScroller(connectionList); subjectExplorerScroller = createSubjectExplorerScroller(subjectExplorer); messageLedgerScroller = createMessageLedgerScroller(messageLedger); messageLedgerSplitter = createMessageLedgerSplitter(messageLedgerScroller, detailsPanel); subjectExplorerSplitter = createSubjectExplorerSplitter(subjectExplorerScroller, messageLedgerSplitter); connectionListSplitter = createConnectionListSplitter(connectionListScroller, subjectExplorerSplitter); setJMenuBar(createMenuBar(messageLedger)); getContentPane().add(connectionListSplitter, BorderLayout.CENTER); getContentPane().add(createToolBar(), BorderLayout.NORTH); getContentPane().add(statusBar, BorderLayout.SOUTH); pack(); connectListeners(); }
public Record getSelectedRecord() { try { final int index = messageLedger.getSelectedRow(); return index >= 0 ? application.getFilteredLedger().get(index) : null; } catch (IndexOutOfBoundsException e) { logger.error(e, "Failed to get selected record from ledger."); return null; } }
private JMenu createViewMenu(RecordLedgerTable table) { final JMenu view = new JMenu("View"); view.setMnemonic('v'); view.add(application.getAction(SelectAllRecords.COMMAND)); view.add(application.getAction(ShowAllColumns.COMMAND)); view.addSeparator(); view.add(application.getAction(Filter.COMMAND)); view.add(application.getAction(FilterBySelection.COMMAND)); view.addSeparator(); final JMenu viewColumns = new JMenu("Columns"); viewColumns.setIcon(new ImageIcon("/resources/icons/filter_columns.png")); viewColumns.addMenuListener(new VisibleColumnsMenuManager(table.getTableFormat())); view.add(viewColumns); final JMenu viewTypes = new JMenu("Types"); viewTypes.setIcon(new ImageIcon("/resources/icons/editRecordTypes.png")); viewTypes.addMenuListener(new RecordTypesMenuManager(application)); view.add(viewTypes); return view; }
private JToolBar createToolBar() { ActionMap actionMap = context.getActionMap(this); final JToolBar toolbar = new JToolBar(); toolbar.setFloatable(false); toolbar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.GRAY)); toolbar.setRollover(true); toolbar.add(actionMap.get("openProject")); toolbar.addSeparator(); toolbar.add(application.getAction(NewRvConnection.COMMAND)); toolbar.addSeparator(); toolbar.add(application.getAction(ClearLedger.COMMAND)); toolbar.addSeparator(); toolbar.add(application.getAction(PauseAllConnections.COMMAND)); final Component[] components = toolbar.getComponents(); for (int i = 0, imax = components.length; i < imax; ++i) { Component component = components[i]; if (component instanceof AbstractButton) { ((AbstractButton) component).setBorderPainted(false); ((AbstractButton) component).setOpaque(false); } } return toolbar; }
private JMenu createEditMenu() { final JMenu edit = new JMenu("Edit"); edit.setMnemonic('e'); edit.add(application.getAction(Cut.COMMAND)); edit.add(application.getAction(Copy.COMMAND)); edit.add(application.getAction(Paste.COMMAND)); edit.addSeparator(); edit.add(application.getAction(Search.COMMAND)); edit.add(application.getAction(SearchBySelection.COMMAND)); edit.addSeparator(); edit.add(application.getAction(Republish.COMMAND)); edit.addSeparator(); edit.add(application.getAction(PruneEmptySubjects.COMMAND)); edit.addSeparator(); edit.add(application.getAction(Delete.COMMAND)); return edit; }
private RecordLedgerTable createMessageLedger(RecordLedger ledger) { final RecordLedgerTable table = new RecordLedgerTable(ledger, application.getConnections(), recordTypes); columnsPopup.addPopupMenuListener(new VisibleColumnsMenuManager(table.getTableFormat())); return table; }