List of usage examples for javax.swing BoxLayout Y_AXIS
int Y_AXIS
To view the source code for javax.swing BoxLayout Y_AXIS.
Click Source Link
From source file:org.openmicroscopy.shoola.agents.treeviewer.util.MoveGroupSelectionDialog.java
/** Builds the components displayed when no node to display.*/ private void buildNoContentPane() { noDisplay = true;// w ww .j a v a 2 s. co m Container c = getContentPane(); StringBuffer s = new StringBuffer(); StringBuffer s1 = new StringBuffer(); if (ProjectData.class.equals(containerType)) { s.append("There is no Project to move the Dataset(s) into."); s1.append("Please create a new Project if you wish."); } else if (DatasetData.class.equals(containerType)) { s.append("There is no Dataset to move the Image(s) into."); s1.append("Please create a new Dataset if you wish."); } else if (ScreenData.class.equals(containerType)) { s.append("There is no Screen to move the Plate into."); s1.append("Please create a new Screen if you wish."); } JPanel p = new JPanel(); p.setBackground(UIUtilities.BACKGROUND); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.add(new JLabel(s.toString())); p.add(new JLabel(s1.toString())); body = buildContent(p); c.add(body, BorderLayout.CENTER); c.add(buildToolBar(), BorderLayout.SOUTH); validate(); repaint(); }
From source file:org.openmicroscopy.shoola.agents.treeviewer.util.SaveResultsDialog.java
/** * Builds and lays out the elements indicating what to save. * * @return See above.//from w ww.j a va2 s .c o m */ private JPanel buildContents() { JPanel buttons = new JPanel(); buttons.add(UIUtilities.setTextFont("Save results for")); buttons.setLayout(new BoxLayout(buttons, BoxLayout.Y_AXIS)); ButtonGroup group = new ButtonGroup(); JRadioButton b = new JRadioButton("Image from current window"); b.setSelected(activeWindow); buttons.add(b); group.add(b); b.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { activeWindow = (e.getStateChange() == ItemEvent.SELECTED); } }); b = new JRadioButton("Images from all image windows"); b.setSelected(activeWindow); buttons.add(b); group.add(b); buttons.add(Box.createRigidArea(UIUtilities.H_SPACER_SIZE)); buttons.add(UIUtilities.setTextFont("Save")); buttons.add(roi); buttons.add(table); JPanel row = new JPanel(); row.setLayout(new FlowLayout(FlowLayout.LEFT)); JLabel l = new JLabel(); l.setText("Measurements File Name: "); row.add(l); row.add(nameField); JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.add(UIUtilities.buildComponentPanel(buttons)); p.add(row); return p; }
From source file:org.openmicroscopy.shoola.agents.treeviewer.util.SaveResultsDialog.java
/** * Builds and lays out the UI.//from ww w. j a v a2s . co m */ private void buildGUI() { Container c = getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.Y_AXIS)); c.add(buildContents(), BorderLayout.CENTER); c.add(buildToolBar(), BorderLayout.SOUTH); }
From source file:org.openmicroscopy.shoola.agents.treeviewer.view.ToolBar.java
/** * Creates the menu hosting the users belonging to the specified group. * Returns <code>true</code> if the group is selected, <code>false</code> * otherwise.//from ww w. ja v a 2s . com * * @param groupItem The item hosting the group. * @param size The number of groups. * @return See above. */ private boolean createGroupMenu(GroupItem groupItem, int size) { long loggedUserID = model.getUserDetails().getId(); GroupData group = groupItem.getGroup(); //Determine the user already added to the display Browser browser = model.getBrowser(Browser.PROJECTS_EXPLORER); TreeImageDisplay refNode = null; List<TreeImageDisplay> nodes; ExperimenterVisitor visitor; List<Long> users = new ArrayList<Long>(); //Find the group already displayed if (group != null && size > 0) { visitor = new ExperimenterVisitor(browser, group.getId()); browser.accept(visitor); nodes = visitor.getNodes(); if (nodes.size() == 1) { refNode = nodes.get(0); } visitor = new ExperimenterVisitor(browser, -1, -1); if (refNode != null) refNode.accept(visitor); else if (size == 1) browser.accept(visitor); nodes = visitor.getNodes(); TreeImageDisplay n; if (CollectionUtils.isNotEmpty(nodes)) { Iterator<TreeImageDisplay> j = nodes.iterator(); while (j.hasNext()) { n = j.next(); if (n.getUserObject() instanceof ExperimenterData) { users.add(((ExperimenterData) n.getUserObject()).getId()); } } if (size == 1) { groupItem.setMenuSelected(true, false); } } } //now add the users List<DataMenuItem> items = new ArrayList<DataMenuItem>(); JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); List l = null; if (group != null) l = sorter.sort(group.getLeaders()); Iterator i; ExperimenterData exp; DataMenuItem item, allUser; JPanel list; boolean view = true; if (group != null) { int level = group.getPermissions().getPermissionsLevel(); if (level == GroupData.PERMISSIONS_PRIVATE) { view = model.isAdministrator() || model.isGroupOwner(group); } } list = new JPanel(); list.setLayout(new BoxLayout(list, BoxLayout.Y_AXIS)); allUser = new DataMenuItem(DataMenuItem.ALL_USERS_TEXT, true); items.add(allUser); if (view) list.add(allUser); p.add(UIUtilities.buildComponentPanel(list)); int count = 0; int total = 0; if (CollectionUtils.isNotEmpty(l)) { total += l.size(); i = l.iterator(); list = new JPanel(); list.setLayout(new BoxLayout(list, BoxLayout.Y_AXIS)); while (i.hasNext()) { exp = (ExperimenterData) i.next(); if (view || exp.getId() == loggedUserID) { item = new DataMenuItem(exp, true); item.setSelected(users.contains(exp.getId())); if (item.isSelected()) count++; item.addPropertyChangeListener(groupItem); items.add(item); list.add(item); } } if (list.getComponentCount() > 0) { p.add(formatHeader("Group owners")); p.add(UIUtilities.buildComponentPanel(list)); } } if (group != null) l = sorter.sort(group.getMembersOnly()); if (CollectionUtils.isNotEmpty(l)) { total += l.size(); i = l.iterator(); list = new JPanel(); list.setLayout(new BoxLayout(list, BoxLayout.Y_AXIS)); while (i.hasNext()) { exp = (ExperimenterData) i.next(); if (view || exp.getId() == loggedUserID) { item = new DataMenuItem(exp, true); item.setSelected(users.contains(exp.getId())); if (item.isSelected()) count++; item.addPropertyChangeListener(groupItem); items.add(item); list.add(item); } } if (list.getComponentCount() > 0) { p.add(formatHeader("Members")); p.add(UIUtilities.buildComponentPanel(list)); } } allUser.setSelected(total != 0 && total == count); allUser.addPropertyChangeListener(groupItem); JScrollPane pane = new JScrollPane(p); Dimension d = p.getPreferredSize(); int max = 500; if (d.height > max) { Insets insets = pane.getInsets(); pane.setPreferredSize(new Dimension(d.width + insets.left + insets.right + 20, max)); } groupItem.add(pane); groupItem.setUsersItem(items); groupItem.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (GroupItem.USER_SELECTION_PROPERTY.equals(name)) handleSelection(); else if (GroupItem.ALL_GROUPS_SELECTION_PROPERTY.equals(name)) handleAllGroupsSelection(true); else if (GroupItem.ALL_GROUPS_DESELECTION_PROPERTY.equals(name)) handleAllGroupsSelection(false); else if (GroupItem.ALL_USERS_SELECTION_PROPERTY.equals(name)) handleAllUsersSelection((Boolean) evt.getNewValue()); } }); return groupItem.isMenuSelected(); }
From source file:org.openmicroscopy.shoola.agents.util.SelectionWizard.java
/** * Creates the filtering controls.//from w ww . j a v a2 s.c om * * @return See above. */ private JPanel createFilteringControl() { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.add(new JLabel("Filter by")); String txt = null; if (TagAnnotationData.class.equals(type)) { txt = "tag"; } else if (TagAnnotationData.class.equals(type)) { txt = "attachment"; } String[] values = new String[2]; StringBuilder builder = new StringBuilder(); builder.append("start of "); if (txt != null) { builder.append(txt); builder.append(" "); } builder.append("name"); values[0] = builder.toString(); builder = new StringBuilder(); builder.append("anywhere in "); if (txt != null) { builder.append(txt); builder.append(" "); } builder.append("name"); values[1] = builder.toString(); JComboBox box = new JComboBox(values); int selected = 0; if (uiDelegate.isFilterAnywhere()) selected = 1; box.setSelectedIndex(selected); box.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JComboBox src = (JComboBox) e.getSource(); uiDelegate.setFilterAnywhere(src.getSelectedIndex() == 1); } }); JPanel rows = new JPanel(); rows.setLayout(new BoxLayout(rows, BoxLayout.Y_AXIS)); p.add(box); rows.add(p); if (!ExperimenterData.class.equals(type)) { //Filter by owner p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.add(new JLabel("Filter by owner")); values = new String[3]; values[SelectionWizardUI.ALL] = "All"; values[SelectionWizardUI.CURRENT] = "Owned by me"; values[SelectionWizardUI.OTHERS] = "Owned by others"; box = new JComboBox(values); box.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JComboBox src = (JComboBox) e.getSource(); uiDelegate.setOwnerIndex(src.getSelectedIndex()); } }); p.add(box); rows.add(p); } return UIUtilities.buildComponentPanel(rows); }
From source file:org.openmicroscopy.shoola.agents.util.SelectionWizard.java
/** * Builds and lays out the UI./*from w w w.j a v a 2 s .c o m*/ * * @param addCreation Pass <code>true</code> to add a component * allowing creation of object of the passed type, * <code>false</code> otherwise. */ private void buildUI(boolean addCreation) { Container c = getContentPane(); c.setLayout(new BorderLayout()); JPanel container = new JPanel(); container.setLayout(new BoxLayout(container, BoxLayout.Y_AXIS)); container.add(uiDelegate); container.add(createFilteringControl()); if (addCreation && TagAnnotationData.class.equals(type)) { container.add(createAdditionPane()); } c.add(container, BorderLayout.CENTER); c.add(createControlsPane(), BorderLayout.SOUTH); }
From source file:org.openmicroscopy.shoola.agents.util.SelectionWizard.java
/** * Builds and lays out the component to add new objects to the selection. * //from ww w . j av a2 s.c o m * @return See above. */ private JPanel createAdditionPane() { JPanel p = new JPanel(); p.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); if (TagAnnotationData.class.equals(type)) { formatAddLabelText(); p.add(UIUtilities.buildComponentPanel(addLabel)); JPanel pane = new JPanel(); pane.setLayout(new BoxLayout(pane, BoxLayout.X_AXIS)); pane.add(addField); pane.add(Box.createHorizontalStrut(5)); pane.add(descriptionField); pane.add(addNewButton); p.add(pane); } return UIUtilities.buildComponentPanel(p); }
From source file:org.openmicroscopy.shoola.agents.util.SelectionWizardUI.java
/** * Builds and lays out the available tags. * * @return See above./* w w w. ja v a 2 s . co m*/ */ private JPanel createAvailableItemsPane() { JPanel p = new JPanel(); p.setLayout(new BorderLayout()); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(UIUtilities.setTextFont(createText("Available"))); panel.add(filterArea); panel.add(Box.createVerticalStrut(2)); p.add(panel, BorderLayout.NORTH); p.add(new JScrollPane(availableItemsListbox), BorderLayout.CENTER); populateTreeItems(availableItemsListbox, availableItems); return p; }
From source file:org.openmicroscopy.shoola.agents.util.SelectionWizardUI.java
/** * Builds and lays out the buttons used to select tags. * * @return See above./*from ww w . ja v a 2s . c o m*/ */ private JPanel createSelectionPane() { JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS)); buttonPanel.add(Box.createVerticalStrut(30)); buttonPanel.add(addButton); buttonPanel.add(Box.createVerticalStrut(10)); buttonPanel.add(removeButton); buttonPanel.add(Box.createVerticalStrut(10)); buttonPanel.add(addAllButton); buttonPanel.add(Box.createVerticalStrut(10)); buttonPanel.add(removeAllButton); buttonPanel.add(Box.createVerticalStrut(10)); return buttonPanel; }
From source file:org.openmicroscopy.shoola.agents.util.ui.ScriptComponent.java
/** * Returns the label associated to the component. * /* www . j av a 2 s . c om*/ * @return See above. */ private JComponent getLabel() { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); if (requireLabel != null) { JPanel lp = new JPanel(); lp.setLayout(new BoxLayout(lp, BoxLayout.X_AXIS)); lp.add(label); lp.add(requireLabel); p.add(lp); } else p.add(label); if (info != null) p.add(info); return UIUtilities.buildComponentPanel(p, 0, 0); }