public static JMenu getJMenu() { JMenu menu = new JMenu("copy to DeploymentDiagram as ComponentInstance"); Project p = ProjectBrowser.TheInstance.getProject(); for (Iterator it = p.getDiagrams().iterator(); it.hasNext(); ) { Object d = it.next(); if (d instanceof UMLDeploymentDiagram) menu.add(new CopyAction((UMLDeploymentDiagram) d)); } return menu; }
public static void main(String[] args) throws ProjectFileParsingException, EquationException { Project testProj = Project.loadProject( new File("examples/Ex5-Networks/Ex5-Networks.neuro.xml"), new ProjectEventListener() { public void tableDataModelUpdated(String tableModelName) {}; public void tabUpdated(String tabName) {}; public void cellMechanismUpdated() {}; }); SynapticProperties sp = new SynapticProperties("Syn1"); sp.setDelayGenerator(new NumberGenerator(33)); WeightGenerator wg = new WeightGenerator("r*r", true); sp.setWeightsGenerator(wg); SynapticPropertiesDialog dlg = new SynapticPropertiesDialog(new Frame(), sp, testProj); // Dimension dlgSize = dlg.getPreferredSize(); dlg.setModal(true); dlg.pack(); dlg.setVisible(true); System.out.println("wg: " + sp.getWeightsGenerator()); }
/** * Constructor. * * @param title the title of the tab component * @param editor the editor of the tab (used to close the tab) */ public TabComponent(final AbstractEditorPanel editor) { setLayout(new BorderLayout()); setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0)); setOpaque(false); // title title = new JLabel(editor.getTitle()); title.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); add(title, BorderLayout.WEST); // close final JButton close = new JButton(Project.getEditorImageIconOrEmpty("icon_cross.png")); close.setPreferredSize(new Dimension(16, 16)); close.setUI(new BasicButtonUI()); close.setBorderPainted(false); close.setOpaque(false); close.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { removeEditor(editor, true); } }); close.addMouseListener( new MouseListener() { @Override public void mouseClicked(MouseEvent me) {} @Override public void mousePressed(MouseEvent me) {} @Override public void mouseReleased(MouseEvent me) {} @Override public void mouseEntered(MouseEvent me) { close.setBorderPainted(true); } @Override public void mouseExited(MouseEvent me) { close.setBorderPainted(false); } }); add(close, BorderLayout.EAST); }
public void itemStateChanged(ItemEvent e) { if (e.getStateChange() != ItemEvent.SELECTED) return; final Project selectedProject = (Project) e.getItem(); if (selectedProject.isValid()) issueLoader.setProject(selectedProject); }
/** Display a frame for browsing issues. */ private JPanel constructView() { // sort the original issues list final SortedList<Issue> issuesSortedList = new SortedList<Issue>(issuesEventList, null); // filter the sorted issues FilterList<Issue> filteredIssues = new FilterList<Issue>(issuesSortedList, filterPanel.getMatcherEditor()); SeparatorList<Issue> separatedIssues = new SeparatorList<Issue>( filteredIssues, GlazedLists.beanPropertyComparator(Issue.class, "subcomponent"), 0, Integer.MAX_VALUE); EventList<Issue> separatedIssuesProxyList = GlazedListsSwing.swingThreadProxyList(separatedIssues); // build the issues table issuesTableModel = GlazedListsSwing.eventTableModel(separatedIssuesProxyList, new IssueTableFormat()); final TableColumnModel issuesTableColumnModel = new EventTableColumnModel<TableColumn>(new BasicEventList<TableColumn>()); JSeparatorTable issuesJTable = new JSeparatorTable(issuesTableModel, issuesTableColumnModel); issuesJTable.setAutoCreateColumnsFromModel(true); issuesJTable.setSeparatorRenderer(new IssueSeparatorTableCell(separatedIssues)); issuesJTable.setSeparatorEditor(new IssueSeparatorTableCell(separatedIssues)); issuesSelectionModel = GlazedListsSwing.eventSelectionModel(separatedIssuesProxyList); issuesSelectionModel.setSelectionMode( ListSelection .MULTIPLE_INTERVAL_SELECTION_DEFENSIVE); // multi-selection best demos our awesome // selection management issuesSelectionModel.addListSelectionListener(new IssuesSelectionListener()); issuesJTable.setSelectionModel(issuesSelectionModel); issuesJTable.getColumnModel().getColumn(0).setPreferredWidth(150); issuesJTable.getColumnModel().getColumn(1).setPreferredWidth(400); issuesJTable.getColumnModel().getColumn(2).setPreferredWidth(300); issuesJTable.getColumnModel().getColumn(3).setPreferredWidth(300); issuesJTable.getColumnModel().getColumn(4).setPreferredWidth(250); issuesJTable.getColumnModel().getColumn(5).setPreferredWidth(300); issuesJTable.getColumnModel().getColumn(6).setPreferredWidth(300); issuesJTable.getColumnModel().getColumn(7).setPreferredWidth(1000); // turn off cell focus painting issuesJTable.setDefaultRenderer( String.class, new NoFocusRenderer(issuesJTable.getDefaultRenderer(String.class))); issuesJTable.setDefaultRenderer( Integer.class, new NoFocusRenderer(issuesJTable.getDefaultRenderer(Integer.class))); issuesJTable.setDefaultRenderer( Priority.class, new NoFocusRenderer(new PriorityTableCellRenderer())); LookAndFeelTweaks.tweakTable(issuesJTable); TableComparatorChooser.install( issuesJTable, issuesSortedList, TableComparatorChooser.MULTIPLE_COLUMN_KEYBOARD); JScrollPane issuesTableScrollPane = new JScrollPane( issuesJTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); issuesTableScrollPane.getViewport().setBackground(UIManager.getColor("EditorPane.background")); issuesTableScrollPane.setBorder(BorderFactory.createEmptyBorder()); issueDetails = new IssueDetailsComponent(filteredIssues); // projects EventList<Project> projects = Project.getProjects(); TransformedList<Project, Project> projectsProxyList = GlazedListsSwing.swingThreadProxyList(projects); // project select combobox DefaultEventComboBoxModel projectsComboModel = new DefaultEventComboBoxModel<Project>(projectsProxyList); JComboBox projectsCombo = new JComboBox(projectsComboModel); projectsCombo.setEditable(false); projectsCombo.setOpaque(false); projectsCombo.addItemListener(new ProjectChangeListener()); projectsComboModel.setSelectedItem(new Project(null, "Select a Java.net project...")); // build a label to display the number of issues in the issue table issueCounter = new IssueCounterLabel(filteredIssues); issueCounter.setHorizontalAlignment(SwingConstants.CENTER); issueCounter.setForeground(Color.WHITE); // throbber throbber = new JLabel(THROBBER_STATIC); throbber.setHorizontalAlignment(SwingConstants.RIGHT); // header bar JPanel iconBar = new GradientPanel(GLAZED_LISTS_MEDIUM_BROWN, GLAZED_LISTS_DARK_BROWN, true); iconBar.setLayout(new GridLayout(1, 3)); iconBar.add(projectsCombo); iconBar.add(issueCounter); iconBar.add(throbber); iconBar.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); // assemble all data components on a common panel JPanel dataPanel = new JPanel(); JComponent issueDetailsComponent = issueDetails; dataPanel.setLayout(new GridLayout(2, 1)); dataPanel.add(issuesTableScrollPane); dataPanel.add(issueDetailsComponent); // draw lines between components JComponent filtersPanel = filterPanel.getComponent(); filtersPanel.setBorder(BorderFactory.createEmptyBorder()); // filtersPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, // IssuesBrowser.GLAZED_LISTS_DARK_BROWN)); issueDetailsComponent.setBorder( BorderFactory.createMatteBorder(1, 0, 0, 0, GLAZED_LISTS_DARK_BROWN)); // the outermost panel to layout the icon bar with the other panels final JPanel mainPanel = new JPanel(new GridBagLayout()); mainPanel.add( iconBar, new GridBagConstraints( 0, 0, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); mainPanel.add( filtersPanel, new GridBagConstraints( 0, 1, 1, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); mainPanel.add( Box.createHorizontalStrut(240), new GridBagConstraints( 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); mainPanel.add( dataPanel, new GridBagConstraints( 1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); return mainPanel; }