List of usage examples for com.jgoodies.forms.factories CC xyw
public static CellConstraints xyw(int col, int row, int colSpan)
Examples:
CC.xyw(1, 3, 7); CC.xyw(1, 3, 2);
From source file:edu.udo.scaffoldhunter.gui.datacalculation.CalcDialog.java
License:Open Source License
private JPanel buildCalcPanel(ListModel plugins) { PanelBuilder builder = new PanelBuilder(new FormLayout("p, 3dlu, p, 3dlu, p:g", "f:p:g, 3dlu, p")); builder.add(buildControlPanel(plugins, jobs), CC.xy(1, 1)); builder.add(new JSeparator(SwingConstants.VERTICAL), CC.xy(3, 1)); pluginPanel = buildPluginPanel();/*www. jav a 2s. co m*/ builder.add(pluginPanel, CC.xy(5, 1)); builder.add(ButtonBarFactory.buildOKCancelBar(continueButton, buildCancelButton()), CC.xyw(1, 3, 5)); return builder.getPanel(); }
From source file:edu.udo.scaffoldhunter.gui.dataimport.ImportDialog.java
License:Open Source License
private JPanel buildImportPanel(ListModel plugins) { PanelBuilder builder = new PanelBuilder(new FormLayout("p, 3dlu, p, 3dlu, p:g", "f:p:g, 3dlu, p")); builder.add(buildControlPanel(plugins, jobs), CC.xy(1, 1)); builder.add(new JSeparator(SwingConstants.VERTICAL), CC.xy(3, 1)); pluginPanel = buildPluginPanel();/* www .j a v a 2s .com*/ builder.add(pluginPanel, CC.xy(5, 1)); builder.add(ButtonBarFactory.buildOKCancelBar(continueButton, buildCancelButton()), CC.xyw(1, 3, 5)); return builder.getPanel(); }
From source file:edu.udo.scaffoldhunter.gui.dataimport.ImportMappingsDialog.java
License:Open Source License
/** * Create a new Import Mappings Dialog./*from w w w . j av a2s. c o m*/ * * @param owner * this dialog's owner * @param sources * the sources represented by this dialog */ public ImportMappingsDialog(Window owner, ImportProcess sources) { super(owner); this.sources = sources; this.propertyDefinitions = new PropertyDefinitionList(sources.getPropertyDefinitions()); setModal(true); setTitle(_("ImportMappings.Title")); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowCloseListener()); FormLayout layout = new FormLayout("d, 5dlu, d, f:d:grow", "c:d, 5dlu, f:d:grow, 3dlu, center:d"); PanelBuilder pb = new PanelBuilder(layout); pb.setDefaultDialogBorder(); tablePane = new JScrollPane(buildTablePanel(), JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); tablePane.getVerticalScrollBar().setUnitIncrement(SCROLL_INCREMENT); cancelButton = new JButton(new CancelAction()); okButton = new JButton(new OkAction()); // restrict preferred width of the label to a sane value descriptionLabel = getDescriptionLabel(); Dimension d = tablePane.getPreferredSize(); d.height = 50; descriptionLabel.setPreferredSize(d); pb.add(descriptionLabel, CC.xyw(3, 1, 2)); pb.add(tablePane, CC.xyw(3, 3, 2)); previewPanel = new PreviewPanel(); pb.add(previewPanel, CC.xywh(1, 3, 1, 3)); pb.add(getPreviewToggle(), CC.xy(3, 5)); pb.add(ButtonBarFactory.buildOKCancelBar(okButton, cancelButton), CC.xy(4, 5)); add(pb.getPanel()); getRootPane().setDefaultButton(okButton); pack(); setLocationRelativeTo(owner); }
From source file:edu.udo.scaffoldhunter.gui.dataimport.ImportMappingsDialog.java
License:Open Source License
private JPanel buildTablePanel() { ImmutableList.Builder<JTable> listBuilder = ImmutableList.builder(); JPanel tablesPanel = new JPanel(); tablesPanel.setLayout(new BoxLayout(tablesPanel, BoxLayout.Y_AXIS)); for (ImportJob job : sources.getJobs()) { FormLayout layout = new FormLayout("right:p, 4dlu, 125dlu, 7dlu, right:p, 4dlu, 100dlu, 20dlu, p, p:g", "p, 10dlu, p, 5dlu, p, p, p, 5dlu, p, p, 5dlu"); PanelBuilder pb = new PanelBuilder(layout); pb.setDefaultDialogBorder();/* ww w . j a va 2 s.com*/ pb.addSeparator(String.format("%s (%s)", job.getJobName(), job.getPlugin().getTitle()), CC.xyw(1, 1, 10)); pb.addLabel(_("ImportMappings.MoleculeTitle"), CC.xy(1, 3)); pb.add(getTitlePropertyComboBox(job.getTitlePropertyModel()), CC.xy(3, 3)); pb.addLabel(_("ImportMappings.MoleculeTitleMergeStrategy"), CC.xy(5, 3)); pb.add(getTitleMergeStrategyComboBox(job.getTitleMergeStrategyModel()), CC.xy(7, 3)); pb.addLabel(_("ImportMappings.StructureMergeStrategy"), CC.xy(5, 5)); pb.add(getStructureMergeStrategyComboBox(job.getStructureMergeStrategyModel()), CC.xy(7, 5)); pb.add(new JButton(new MapAllAction(job)), CC.xy(9, 3)); JTable table = getMappingTable(job); pb.add(table.getTableHeader(), CC.xyw(1, 9, 10)); pb.add(table, CC.xyw(1, 10, 10)); listBuilder.add(table); table.getModel().addTableModelListener(this); if (sources.getDataset() != null) { pb.add(getSpacedTitledSeparator(_("ImportMappings.MergeProperty")), CC.xyw(1, 6, 10)); // merge by property pb.addLabel(_("ImportMappings.MergeBy"), CC.xy(1, 7)); JComboBox mergeByComboBox = getMergeByComboBox(job, table); pb.add(mergeByComboBox, CC.xy(3, 7)); // merge to property pb.addLabel(_("ImportMappings.MergeTo"), CC.xy(5, 7)); JComboBox mergeToComboBox = getMergeToComboBox(job, table, mergeByComboBox); pb.add(mergeToComboBox, CC.xy(7, 7)); mergeIntoModels.put(job, mergeToComboBox.getModel()); /* * the renderer of the table must be aware of the * mergeByComboBox state to color the cell */ table.setDefaultRenderer(Object.class, new ActivatableTableCellRenderer(mergeByComboBox)); table.getColumnModel().getColumn(MappingTableModel.PROPERTY_DEFINITION_COLUMN) .setCellRenderer(new PropertyDefinitionRenderer(mergeByComboBox)); table.getColumnModel().getColumn(MappingTableModel.MERGE_STRATEGY_COLUMN) .setCellRenderer(new MergeStrategyRenderer(sources, job, mergeByComboBox)); } JPanel panel = (pb.getPanel()); panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, panel.getPreferredSize().height)); tablesPanel.add(panel); } tables = listBuilder.build(); return tablesPanel; }
From source file:edu.udo.scaffoldhunter.gui.dialogs.ConnectionDialog.java
License:Open Source License
/** * Creates a panel that holds all components needed to enter the information * for a new profile.//from ww w . j a v a2s . c o m * * @return The <code>JScrollPane</code> with the embedded panel. */ private JPanel getProfilePanel() { JPanel panel = new JPanel(new BorderLayout(10, 0)); FormLayout layout = new FormLayout("f:p:g, left:default, 5dlu, max(p;120dlu), f:default:g", "p, 3dlu, p, 3dlu, p"); PanelBuilder commonBuilder = new PanelBuilder(layout); nameText = new JTextField(); SelectAllOnFocus.addTo(nameText); // ignore ',' since they aren't allowed in a connection name nameText.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { if (e.getKeyChar() == ',') { e.consume(); } } @Override public void keyReleased(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { } }); nameText.getDocument().addDocumentListener(validateListener); commonBuilder.addLabel(I18n.get("Profile.Name") + ":", CC.xy(2, 1)); commonBuilder.add(nameText, CC.xy(4, 1)); typeDBCombo = new JComboBox(new DefaultComboBoxModel(ConnectionType.values())); typeDBCombo.addItemListener(new TypeListener()); typeDBCombo.addItemListener(validateListener); commonBuilder.addLabel(I18n.get("Profile.ConnectionType") + ":", CC.xy(2, 3)); commonBuilder.add(typeDBCombo, CC.xy(4, 3)); commonBuilder.addSeparator(I18n.get("Profile.DB.Header"), CC.xyw(1, 5, 5)); panel.add(commonBuilder.getPanel(), BorderLayout.NORTH); profilePanel = new JPanel(new CardLayout()); NetworkPanel np = new NetworkPanel(); np.addPropertyChangeListener(validateListener); profilePanels.put(ConnectionType.MYSQL, np); DiskPanel dp = new DiskPanel(I18n.get("Profile.ConnectionType.HSQLDB.Filetype"), "script", ConnectionType.HSQLDB.getUrlPrefix()); dp.addPropertyChangeListener(validateListener); profilePanels.put(ConnectionType.HSQLDB, dp); for (Entry<ConnectionType, ProfilePanel> e : profilePanels.entrySet()) { profilePanel.add((JPanel) e.getValue(), e.getKey().name()); } profilePanel.add(new JPanel(), NO_CONNECTION); panel.add(profilePanel, BorderLayout.CENTER); return panel; }
From source file:edu.udo.scaffoldhunter.gui.dialogs.InitialViewDialog.java
License:Open Source License
/** * // w w w.j av a 2s .co m * @param owner * the parent window */ public InitialViewDialog(Window owner) { super(owner, I18n.get("Session.InitialViews.Title"), ModalityType.APPLICATION_MODAL); setIconImage(Resources.getBufferedImage("images/scaffoldhunter-icon.png")); JPanel pane = new JPanel(new FormLayout("p, p", "p, 3dlu, p, 3dlu, p")); pane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); setContentPane(pane); this.setResizable(false); for (Class<? extends View> viewclass : ViewClassRegistry.getClasses()) { views.put(ViewClassRegistry.getClassName(viewclass), viewclass); } JTextPane description = new JTextPane(); description.setEditable(false); description.setAlignmentX(LEFT_ALIGNMENT); description.setFocusable(false); description.setBackground(SystemColor.control); description.setText(I18n.get("Session.InitialViews.Description")); add(description, CC.xyw(1, 1, 2)); JPanel propertyPanel = buildPropertyPanel(); propertyPanel.setBorder(BorderFactory.createTitledBorder(I18n.get("Session.InitialViews.AvailableViews"))); JScrollPane scrollPane = new JScrollPane(propertyPanel); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); add(propertyPanel, CC.xyw(1, 3, 2)); JButton okButton = StandardButtonFactory.createOKButton(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dispose(); } }); JPanel buttonBar = ButtonBarFactory.buildLeftAlignedBar(new JButton(new SelectAll()), new JButton(new SelectNone()), okButton); add(buttonBar, CC.xy(1, 5)); // this fixes the width of the text pane, so the preferred height can be calculated properly description.setSize((int) buttonBar.getPreferredSize().getWidth(), Short.MAX_VALUE); getRootPane().setDefaultButton(okButton); pack(); setLocationRelativeTo(owner); }
From source file:edu.udo.scaffoldhunter.gui.dialogs.TooltipConfigurationDialog.java
License:Open Source License
/** * /*from w w w.j av a 2 s .com*/ * @param owner * the parent window * @param dataset * the current dataset * @param config the global config object */ public TooltipConfigurationDialog(Window owner, Dataset dataset, GlobalConfig config) { super(owner, I18n.get("Tooltip.Configuration.Title"), ModalityType.APPLICATION_MODAL); JPanel pane = new JPanel(new FormLayout("p, l:p:g, d", "p, 3dlu, min(d;400dlu):g, 3dlu, p")); pane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); setContentPane(pane); this.dataset = dataset; this.currentProperties = config.getTooltipProperties(dataset); for (ToolTipPropertyConfigurationEntry e : currentProperties) { this.newProperties.put(e.getPropertyDefinitionKey(), (ToolTipPropertyConfigurationEntry) e.copy()); this.selectedProperties.add(e.getPropertyDefinitionKey()); } for (PropertyDefinition propDef : dataset.getPropertyDefinitions().values()) { if (!newProperties.containsKey(propDef.getKey())) { newProperties.put(propDef.getKey(), new ToolTipPropertyConfigurationEntry(propDef.getKey())); } } this.config = config; add(ButtonBarFactory.buildLeftAlignedBar(new JButton(new SelectAll()), new JButton(new SelectNone())), CC.xy(1, 1)); add(buildOptionPanel(), CC.xyw(2, 1, 2)); JPanel propertyPanel = buildPropertyPanel(); JScrollPane scrollPane = new JScrollPane(propertyPanel); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); add(scrollPane, CC.xyw(1, 3, 2)); JButton okButton = StandardButtonFactory.createOKButton(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { apply(); dispose(); } }); add(ButtonBarFactory.buildOKCancelApplyBar(okButton, StandardButtonFactory.createCancelButton(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dispose(); } }), StandardButtonFactory.createApplyButton(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { apply(); } })), CC.xyw(1, 5, 2)); getRootPane().setDefaultButton(okButton); pack(); setLocationRelativeTo(owner); }
From source file:edu.udo.scaffoldhunter.view.scaffoldtree.config.GradientPanel.java
License:Open Source License
/** * Create a new gradient panel//from w w w .j a v a2s. c o m * * @param color * should the panel provide color selection? * @param mapping * the mapping whose gradient is configured by this panel */ public GradientPanel(boolean color, ConfigMapping mapping) { super(new FormLayout("p, 3dlu, max(20dlu;p), p:g", "p:g, p, 3dlu, p, 3dlu, p, 5dlu, p, 3dlu, max(20dlu;p), 3dlu, max(20dlu;p), p:g")); this.mapping = mapping; DefaultComponentFactory componentFactory = new DefaultComponentFactory(); ButtonGroup bg = new ButtonGroup(); JRadioButton ascending = new JRadioButton(I18n.get("VisualMappings.Gradient.Ascending")); ascending.setActionCommand(ASCENDING); ascending.addActionListener(this); bg.add(ascending); JRadioButton descending = new JRadioButton(I18n.get("VisualMappings.Gradient.Descending")); descending.setActionCommand(DESCENDING); descending.addActionListener(this); bg.add(descending); ascending.setSelected(mapping.isGradientAscending()); descending.setSelected(!mapping.isGradientAscending()); add(componentFactory.createSeparator(I18n.get("VisualMappings.Direction")), CC.xyw(1, 2, 4)); add(ascending, CC.xyw(1, 4, 4)); add(descending, CC.xyw(1, 6, 4)); if (color) { add(componentFactory.createSeparator(I18n.get("VisualMappings.Color")), CC.xyw(1, 8, 4)); add(new JLabel(I18n.get("VisualMappings.Gradient.Color1") + ":"), CC.xy(1, 10)); ColorEditor ce1 = new ColorEditor(mapping.getGradientColor1()); ce1.addPropertyChangeListener(ColorEditor.COLOR_PROPERTY, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { GradientPanel.this.mapping.setGradientColor1((Color) evt.getNewValue()); } }); add(ce1, CC.xy(3, 10)); add(new JLabel(I18n.get("VisualMappings.Gradient.Color2") + ":"), CC.xy(1, 12)); ColorEditor ce2 = new ColorEditor(mapping.getGradientColor2()); ce2.addPropertyChangeListener(ColorEditor.COLOR_PROPERTY, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { GradientPanel.this.mapping.setGradientColor2((Color) evt.getNewValue()); } }); add(ce2, CC.xy(3, 12)); } }
From source file:edu.udo.scaffoldhunter.view.scaffoldtree.config.MappingDialog.java
License:Open Source License
/** * Create a new MappingDialog// www . j av a 2 s .c o m * * @param owner * the dialog's owner * @param config * the configuration object which holds the mapping configuration * @param profile * the profile of the current user * @param db */ public MappingDialog(Window owner, ScaffoldTreeViewConfig config, Profile profile, DbManager db, Subset subset) { super(owner, _("VisualMappings.Title"), ModalityType.DOCUMENT_MODAL); this.config = config; this.profile = profile; for (Map.Entry<VisualFeature, ConfigMapping> e : config.getMappings().entrySet()) { if (e.getValue() != null) this.mappings.put(e.getKey(), (ConfigMapping) e.getValue().copy()); } for (VisualFeature f : VisualFeature.values()) if (mappings.get(f) == null) mappings.put(f, new ConfigMapping(f)); PanelBuilder builder = new PanelBuilder( new FormLayout("max(p;100dlu), 3dlu, p, 3dlu, p:g", "p:g, 3dlu, p")); builder.setDefaultDialogBorder(); // remove non working VisualFeatures for beta Vector<VisualFeature> features = new Vector<VisualFeature>(Arrays.asList(VisualFeature.values())); features.remove(VisualFeature.NodeSize); visualFeatures = new JList<VisualFeature>(features); visualFeatures.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); visualFeatures.setSelectedIndex(0); visualFeatures.getSelectionModel().addListSelectionListener(this); builder.add(visualFeatures, CC.xy(1, 1)); builder.add(new JSeparator(JSeparator.VERTICAL), CC.xywh(3, 1, 1, 2)); builder.add(featurePanelContainer, CC.xy(5, 1)); JButton okButton = buildOKButton(); builder.add(ButtonBarFactory.buildOKCancelApplyBar(okButton, buildCancelButton(), buildApplyButton()), CC.xyw(4, 3, 2)); for (VisualFeature f : VisualFeature.values()) { if (SinglePropertyPanel.supported(f)) featurePanelContainer.add(new SinglePropertyPanel(mappings.get(f), profile, db, subset), f.name()); } VisualFeature selected = visualFeatures.getSelectedValue(); featurePanelLayout.show(featurePanelContainer, selected.name()); setContentPane(builder.getPanel()); getRootPane().setDefaultButton(okButton); pack(); setLocationRelativeTo(owner); setMinimumSize(getSize()); setResizable(false); }
From source file:edu.udo.scaffoldhunter.view.treemap.sidebar.PropertySelector.java
License:Open Source License
@SuppressWarnings("unchecked") private void createOptionsPanel() { JPanel plotTypePanel = new JPanel(new FormLayout("4dlu, l:d:g(.5), 4dlu, l:d:g(.5), 4dlu", "p:g")); JPanel sizePanel = new JPanel(new FormLayout("0dlu, left:min, 4dlu, 4dlu, f:d:g, 0dlu", "p:g")); JPanel colorPanel = new JPanel( new FormLayout("0dlu, left:min, 4dlu, 4dlu, f:d:g, 0dlu", "p, 3dlu, p, 3dlu, p, 1dlu, p:g")); plotTypePanel.setBorder(BorderFactory.createTitledBorder(I18n.get("TreeMapView.Mappings.NodeType"))); sizePanel.setBorder(BorderFactory.createTitledBorder(I18n.get("TreeMapView.Mappings.NodeSize"))); colorPanel.setBorder(BorderFactory.createTitledBorder(I18n.get("TreeMapView.Mappings.NodeColor"))); ToolboxComboBoxRenderer tcb = new ToolboxComboBoxRenderer(); sizeBox.setRenderer(tcb);//from ww w . j a v a 2 s. c o m colorBox.setRenderer(tcb); // type panel ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.add(scaffoldRadioButton); //couple them together buttonGroup.add(moleculeRadioButton); //if one is selected, the other is unselected plotTypePanel.add(scaffoldRadioButton, CC.xyw(2, 1, 2)); plotTypePanel.add(moleculeRadioButton, CC.xyw(4, 1, 2)); // size panel sizePanel.add(new JLabel(I18n.get("TreeMapView.Mappings.Size")), CC.xyw(2, 1, 1)); sizePanel.add(sizeBox, CC.xyw(4, 1, 2)); // color panel JLabel accumulationLabel = new JLabel(I18n.get("TreeMapView.Mappings.Accumulation")); accumulationLabel.setToolTipText(I18n.get("Tooltip.ScaffoldTreeView.Sort.AcculumulationFunction")); accumulationBox.addItem(AccumulationFunction.Average); accumulationBox.addItem(AccumulationFunction.Sum); accumulationBox.addItem(AccumulationFunction.Minimum); accumulationBox.addItem(AccumulationFunction.Maximum); cumulativeBox.setText(I18n.get("TreeMapView.Mappings.Cumulative")); cumulativeBox.setToolTipText(I18n.get("Tooltip.ScaffoldTreeView.Sort.Cumulative")); subsetIntervalBox.setText(I18n.get("TreeMapView.Mappings.SubsetInterval")); subsetIntervalBox.setToolTipText(I18n.get("Tooltip.TreeMapView.SubsetInterval")); colorPanel.add(new JLabel(I18n.get("TreeMapView.Mappings.Color")), CC.xyw(2, 1, 1)); colorPanel.add(accumulationLabel, CC.xyw(2, 3, 1)); colorPanel.add(colorBox, CC.xyw(4, 1, 2)); colorPanel.add(accumulationBox, CC.xyw(4, 3, 2)); colorPanel.add(cumulativeBox, CC.xyw(2, 5, 4)); colorPanel.add(subsetIntervalBox, CC.xyw(2, 7, 4)); // rest progressBar = new JProgressBar(); progressBar.setString("Loaded"); progressBar.setStringPainted(true); syncLabel = new JLabel(); syncLabel.setForeground(Color.RED); syncLabel.setText(I18n.get("TreeMapView.Mappings.MappingChanged")); add(plotTypePanel, CC.xyw(1, 1, 4)); add(sizePanel, CC.xyw(1, 3, 4)); add(colorPanel, CC.xyw(1, 5, 4)); add(plotButton, CC.xyw(2, 7, 2)); add(progressBar, CC.xyw(2, 9, 2)); add(syncLabel, CC.xyw(2, 11, 2)); }