List of usage examples for com.jgoodies.forms.layout CellConstraints DEFAULT
Alignment DEFAULT
To view the source code for com.jgoodies.forms.layout CellConstraints DEFAULT.
Click Source Link
From source file:org.columba.mail.gui.config.export.ExportDialog.java
License:Mozilla Public License
private JPanel createPanel() { JPanel jpanel1 = new JPanel(); FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:GROW(1.0),3DLU,FILL:DEFAULT:NONE", "CENTER:DEFAULT:NONE,1DLU,FILL:DEFAULT:GROW(1.0),3DLU,CENTER:DEFAULT:NONE"); CellConstraints cc = new CellConstraints(); jpanel1.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12)); jpanel1.setLayout(formlayout1);//from ww w .j av a2s .c o m JLabel jlabel1 = new JLabel(); jlabel1.setText("Select Folders:"); jpanel1.add(jlabel1, cc.xy(1, 1)); JScrollPane scrollPane = new JScrollPane(tree); scrollPane.setPreferredSize(new Dimension(350, 250)); jpanel1.add(scrollPane, cc.xy(1, 3)); jpanel1.add(createPanel1(), new CellConstraints(3, 3, 1, 1, CellConstraints.DEFAULT, CellConstraints.TOP)); return jpanel1; }
From source file:org.deegree.igeo.views.swing.digitize.construction.SizedEllipseDialog.java
License:Open Source License
private void initGUI() { try {/*from w ww.ja v a 2 s .c om*/ GridBagLayout thisLayout = new GridBagLayout(); thisLayout.rowWeights = new double[] { 0.0, 0.1 }; thisLayout.rowHeights = new int[] { 156, 7 }; thisLayout.columnWeights = new double[] { 0.0, 0.1 }; thisLayout.columnWidths = new int[] { 148, 7 }; getContentPane().setLayout(thisLayout); { pnMessage = new JPanel(); BorderLayout pnMessageLayout = new BorderLayout(); pnMessage.setLayout(pnMessageLayout); getContentPane().add(pnMessage, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); pnMessage.setBorder(BorderFactory.createTitledBorder(Messages.getMessage(getLocale(), "$MD11107"))); { taMessage = new JTextArea(); pnMessage.add(taMessage, BorderLayout.CENTER); taMessage.setText(Messages.getMessage(getLocale(), "$MD11115")); taMessage.setEnabled(false); taMessage.setLineWrap(true); taMessage.setWrapStyleWord(true); taMessage.setEditable(false); taMessage.setDisabledTextColor(new java.awt.Color(0, 0, 0)); } } { pnButtons = new JPanel(); FlowLayout pnButtonsLayout = new FlowLayout(); pnButtonsLayout.setAlignment(FlowLayout.LEFT); pnButtons.setLayout(pnButtonsLayout); getContentPane().add(pnButtons, new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); { btOK = new JButton(IconRegistry.getIcon("accept.png")); pnButtons.add(btOK); btOK.setText(Messages.getMessage(getLocale(), "$MD11116")); btOK.setToolTipText(Messages.getMessage(getLocale(), "$MD11117")); btOK.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { // Point center = mapModel.getEnvelope().getCentroid(); try { double radX = ((Number) spWidth.getValue()).doubleValue() / 2d; double radY = ((Number) spHeight.getValue()).doubleValue() / 2d; surface = GeometryFactory.createSurfaceAsEllipse(center.getX(), center.getY(), radX, radY, 100, mapModel.getCoordinateSystem()); } catch (GeometryException e) { DialogFactory.openErrorDialog(owner.getApplicationContainer().getViewPlatform(), parent, Messages.getMessage(getLocale(), "$MD11118", e.getMessage()), Messages.getMessage(getLocale(), "$MD11119"), e); } SizedEllipseDialog.this.dispose(); } }); } { btCancel = new JButton(IconRegistry.getIcon("cancel.png")); pnButtons.add(btCancel); btCancel.setText(Messages.getMessage(getLocale(), "$MD11120")); btCancel.setToolTipText(Messages.getMessage(getLocale(), "$MD11121")); btCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SizedEllipseDialog.this.dispose(); } }); } } { pnForm = new JPanel(); FormLayout pnFormLayout = new FormLayout("48dlu, 84dlu", "26dlu, 17dlu, 18dlu"); pnForm.setLayout(pnFormLayout); getContentPane().add(pnForm, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); pnForm.setBorder(BorderFactory.createTitledBorder(Messages.getMessage(getLocale(), "$MD11122"))); { lbwidth = new JLabel(); pnForm.add(lbwidth, new CellConstraints(1, 1, 1, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 10, 0, 0))); lbwidth.setText(Messages.getMessage(getLocale(), "$MD11336")); } { lbHeight = new JLabel(); pnForm.add(lbHeight, new CellConstraints(1, 3, 1, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 10, 0, 0))); lbHeight.setText(Messages.getMessage(getLocale(), "$MD11337")); } { SpinnerModel spWidthModel = new SpinnerNumberModel(mapModel.getEnvelope().getWidth() / 10d, 0.0001, 9E99, mapModel.getEnvelope().getWidth() / 100d); spWidth = new JSpinner(spWidthModel); spWidth.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if (pressed) { spHeight.setValue(spWidth.getValue()); } } }); pnForm.add(spWidth, new CellConstraints("2, 1, 1, 1, default, default")); } { SpinnerModel spHeightModel = new SpinnerNumberModel(mapModel.getEnvelope().getHeight() / 10d, 0.0001, 9E99, mapModel.getEnvelope().getWidth() / 100d); spHeight = new JSpinner(spHeightModel); pnForm.add(spHeight, new CellConstraints("2, 3, 1, 1, default, default")); } { tbLock = new JToggleButton(IconRegistry.getIcon("lock_open.png")); tbLock.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { pressed = !pressed; if (pressed) { spHeight.setValue(spWidth.getValue()); tbLock.setIcon(IconRegistry.getIcon("lock.png")); spHeight.setEnabled(false); } else { tbLock.setIcon(IconRegistry.getIcon("lock_open.png")); spHeight.setEnabled(true); } } }); tbLock.doClick(); pnForm.add(tbLock, new CellConstraints("2, 2, 1, 1, center, default")); } } this.setSize(437, 221); } catch (Exception e) { e.printStackTrace(); } }
From source file:org.deegree.igeo.views.swing.digitize.construction.SizedRectangleDialog.java
License:Open Source License
private void initGUI() { try {/* w w w.j a va2s. c o m*/ GridBagLayout thisLayout = new GridBagLayout(); thisLayout.rowWeights = new double[] { 0.0, 0.1 }; thisLayout.rowHeights = new int[] { 156, 7 }; thisLayout.columnWeights = new double[] { 0.0, 0.1 }; thisLayout.columnWidths = new int[] { 148, 7 }; getContentPane().setLayout(thisLayout); { pnMessage = new JPanel(); BorderLayout pnMessageLayout = new BorderLayout(); pnMessage.setLayout(pnMessageLayout); getContentPane().add(pnMessage, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); pnMessage.setBorder(BorderFactory.createTitledBorder(Messages.getMessage(getLocale(), "$MD11107"))); { taMessage = new JTextArea(); pnMessage.add(taMessage, BorderLayout.CENTER); taMessage.setText(Messages.getMessage(getLocale(), "$MD11101")); taMessage.setEnabled(false); taMessage.setLineWrap(true); taMessage.setWrapStyleWord(true); taMessage.setBackground(pnMessage.getBackground()); taMessage.setDisabledTextColor(new java.awt.Color(0, 0, 0)); } } { pnButtons = new JPanel(); FlowLayout pnButtonsLayout = new FlowLayout(); pnButtonsLayout.setAlignment(FlowLayout.LEFT); pnButtons.setLayout(pnButtonsLayout); getContentPane().add(pnButtons, new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); { btOK = new JButton(IconRegistry.getIcon("accept.png")); pnButtons.add(btOK); btOK.setText(Messages.getMessage(getLocale(), "$MD11102")); btOK.setToolTipText(Messages.getMessage(getLocale(), "$MD11103")); btOK.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { double x = center.getX() - ((Number) spWidth.getValue()).doubleValue() / 2d; double y = center.getY() - ((Number) spHeight.getValue()).doubleValue() / 2d; Position min = GeometryFactory.createPosition(x, y); x = center.getX() + ((Number) spWidth.getValue()).doubleValue() / 2d; y = center.getY() + ((Number) spHeight.getValue()).doubleValue() / 2d; Position max = GeometryFactory.createPosition(x, y); Envelope env = GeometryFactory.createEnvelope(min, max, mapModel.getCoordinateSystem()); try { surface = GeometryFactory.createSurface(env, mapModel.getCoordinateSystem()); } catch (GeometryException e) { DialogFactory.openErrorDialog(owner.getApplicationContainer().getViewPlatform(), parent, Messages.getMessage(getLocale(), "$MD11108", e.getMessage()), Messages.getMessage(getLocale(), "$MD11109"), e); } SizedRectangleDialog.this.dispose(); } }); } { btCancel = new JButton(IconRegistry.getIcon("cancel.png")); pnButtons.add(btCancel); btCancel.setText(Messages.getMessage(getLocale(), "$MD11104")); btCancel.setToolTipText(Messages.getMessage(getLocale(), "$MD11105")); btCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SizedRectangleDialog.this.dispose(); } }); } } { pnForm = new JPanel(); FormLayout pnFormLayout = new FormLayout("48dlu, 84dlu", "26dlu, 21dlu"); pnForm.setLayout(pnFormLayout); getContentPane().add(pnForm, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); pnForm.setBorder(BorderFactory.createTitledBorder(Messages.getMessage(getLocale(), "$MD11106"))); { lbwidth = new JLabel(); pnForm.add(lbwidth, new CellConstraints(1, 1, 1, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 10, 0, 0))); lbwidth.setText(Messages.getMessage(getLocale(), "$MD11338")); } { lbHeight = new JLabel(); pnForm.add(lbHeight, new CellConstraints(1, 2, 1, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 10, 0, 0))); lbHeight.setText(Messages.getMessage(getLocale(), "$MD11339")); } { SpinnerModel spWidthModel = new SpinnerNumberModel(mapModel.getEnvelope().getWidth() / 10d, 0.0001, 9E99, mapModel.getEnvelope().getWidth() / 100d); spWidth = new JSpinner(spWidthModel); pnForm.add(spWidth, new CellConstraints("2, 1, 1, 1, default, default")); } { SpinnerModel spHeightModel = new SpinnerNumberModel(mapModel.getEnvelope().getHeight() / 10d, 0.0001, 9E99, mapModel.getEnvelope().getWidth() / 100d); spHeight = new JSpinner(spHeightModel); pnForm.add(spHeight, new CellConstraints("2, 2, 1, 1, default, default")); } } this.setSize(400, 221); } catch (Exception e) { e.printStackTrace(); } }
From source file:org.deegree.igeo.views.swing.layerlist.InfoPanel.java
License:Open Source License
private void initGUI() { try {/*from ww w . ja va2 s .c o m*/ GridBagLayout thisLayout = new GridBagLayout(); this.setPreferredSize(new java.awt.Dimension(588, 351)); thisLayout.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.1 }; thisLayout.rowHeights = new int[] { 166, 65, 83, -1, 7 }; thisLayout.columnWeights = new double[] { 0.0, 0.0, 0.0 }; thisLayout.columnWidths = new int[] { 166, 254, 147 }; this.setLayout(thisLayout); { pnLegend = new JPanel(); BorderLayout pn_legendLayout = new BorderLayout(); pnLegend.setLayout(pn_legendLayout); this.add(pnLegend, new GridBagConstraints(0, 1, 1, 2, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); pnLegend.setBorder(BorderFactory.createTitledBorder(Messages.getMessage(getLocale(), "$MD11128"))); { scLegend = new JScrollPane(); pnLegend.add(scLegend, BorderLayout.CENTER); { lbLegend = new JLabel(); scLegend.setViewportView(lbLegend); lbLegend.setPreferredSize(new java.awt.Dimension(143, 15)); } } } { pnState = new JPanel(); GridBagLayout pn_stateLayout = new GridBagLayout(); this.add(pnState, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); pnState.setBorder(BorderFactory.createTitledBorder(Messages.getMessage(getLocale(), "$MD11129"))); pn_stateLayout.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.1 }; pn_stateLayout.rowHeights = new int[] { 28, 28, 28, 28, 7 }; pn_stateLayout.columnWeights = new double[] { 0.1 }; pn_stateLayout.columnWidths = new int[] { 7 }; pnState.setLayout(pn_stateLayout); { Icon icon = new ImageIcon(InfoPanel.class.getResource("visible.png")); tbVisible = new JToggleButton(icon); pnState.add(tbVisible, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); tbVisible.setToolTipText(Messages.getMessage(getLocale(), "$MD10001")); } { Icon icon = new ImageIcon(InfoPanel.class.getResource("queryable.png")); tbQueryable = new JToggleButton(icon); pnState.add(tbQueryable, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); tbQueryable.setToolTipText(Messages.getMessage(getLocale(), "$MD10002")); } { Icon icon = new ImageIcon(InfoPanel.class.getResource("editable.png")); tbEditable = new JToggleButton(icon); pnState.add(tbEditable, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); tbEditable.setToolTipText(Messages.getMessage(getLocale(), "$MD10003")); } { Icon icon = new ImageIcon(InfoPanel.class.getResource("selected4edit.png")); tbSelectedForEdit = new JToggleButton(icon); pnState.add(tbSelectedForEdit, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); tbSelectedForEdit.setToolTipText(Messages.getMessage(getLocale(), "$MD10005")); } } { pnAbstract = new JPanel(); BorderLayout pn_abstractLayout = new BorderLayout(); pnAbstract.setLayout(pn_abstractLayout); this.add(pnAbstract, new GridBagConstraints(1, 0, 2, 2, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); pnAbstract .setBorder(BorderFactory.createTitledBorder(Messages.getMessage(getLocale(), "$MD11130"))); { epDescription = new JEditorPane(); JScrollPane sc = new JScrollPane(epDescription); pnAbstract.add(sc, BorderLayout.CENTER); epDescription.setPreferredSize(new java.awt.Dimension(259, 218)); } } { pnButtons = new JPanel(); FlowLayout pn_buttonsLayout = new FlowLayout(); pn_buttonsLayout.setAlignment(FlowLayout.LEFT); pnButtons.setLayout(pn_buttonsLayout); this.add(pnButtons, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); { btTake = new JButton(Messages.getMessage(getLocale(), "$MD10006"), IconRegistry.getIcon("save.gif")); btTake.setToolTipText(Messages.getMessage(getLocale(), "$MD11125")); pnButtons.add(btTake); btTake.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { mme.setAbstract(epDescription.getText()); if (mme instanceof Layer) { double min = ((Number) spMin.getValue()).doubleValue(); double max = ((Number) spMax.getValue()).doubleValue(); double d = min; if (min > max) { min = max; max = d; } ((Layer) mme).setMinScaleDenominator(min); ((Layer) mme).setMaxScaleDenominator(max); } ((Layer) mme).fireRepaintEvent(); } }); } } { pnHelp = new JPanel(); FlowLayout jPanel1Layout = new FlowLayout(); jPanel1Layout.setAlignment(FlowLayout.RIGHT); pnHelp.setLayout(jPanel1Layout); this.add(pnHelp, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); { btHelp = new JButton(Messages.getMessage(getLocale(), "$MD11126"), IconRegistry.getIcon("help.png")); pnHelp.add(btHelp); btHelp.setToolTipText(Messages.getMessage(getLocale(), "$MD11127")); btHelp.addActionListener(new ActionListener() { @SuppressWarnings("unchecked") public void actionPerformed(ActionEvent e) { ApplicationContainer<Container> appCont = (ApplicationContainer<Container>) mme .getOwner().getApplicationContainer(); HelpFrame hf = HelpFrame.getInstance(new HelpManager(appCont)); hf.setVisible(true); hf.gotoModule(LayerListTreeViewModule.class.getName()); } }); } } { pnScale = new JPanel(); FormLayout pnScaleLayout = new FormLayout("38dlu, 101dlu", "18dlu, 18dlu"); pnScale.setLayout(pnScaleLayout); this.add(pnScale, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0)); pnScale.setBorder(BorderFactory.createTitledBorder(Messages.getMessage(getLocale(), "$MD11207"))); { lnMin = new JLabel(); pnScale.add(lnMin, new CellConstraints("1, 1, 1, 1, default, default")); lnMin.setText(Messages.getMessage(getLocale(), "$MD11208")); } { lbMax = new JLabel(); pnScale.add(lbMax, new CellConstraints("1, 2, 1, 1, default, default")); lbMax.setText(Messages.getMessage(getLocale(), "$MD11209")); } { spMin = new JSpinner(new SpinnerNumberModel(0, 0, 9E99, 100)); pnScale.add(spMin, new CellConstraints(2, 1, 1, 1, CellConstraints.FILL, CellConstraints.DEFAULT, new Insets(0, 10, 0, 10))); } { spMax = new JSpinner(new SpinnerNumberModel(0, 0, 9E99, 100)); pnScale.add(spMax, new CellConstraints(2, 2, 1, 1, CellConstraints.FILL, CellConstraints.CENTER, new Insets(0, 10, 0, 10))); } } } catch (Exception e) { e.printStackTrace(); } }
From source file:org.drugis.addis.gui.components.progressgraph.ProgressGraph.java
License:Open Source License
public JPanel createPanel() { final FormLayout layout = new FormLayout(createFormSpec("pref", d_numCols), "p, " + createFormSpec("3dlu, p", d_numTotalRows - 1)); CellConstraints cc = new CellConstraints(); JPanel progressPanel = new JPanel(layout); Dimension cellSize = new Dimension(d_edgeLength, d_arrowSize); Dimension circleSize = new Dimension(d_circleDiameter, d_circleDiameter); for (int i = 0; i < d_numberOfChains; ++i) { int rowIdx = (2 * i) + 1; Task tuningTask = d_model.getModel().getActivityTask().getModel() .getStateByName(MCMCModel.TUNING_CHAIN_PREFIX + i); progressPanel.add(new GraphLine(cellSize, 2, SwingConstants.EAST), cc.xy(6, rowIdx)); progressPanel.add(new GraphProgressNode(d_gridCellSize, tuningTask), cc.xy(7, rowIdx)); Task simulationTask = d_model.getModel().getActivityTask().getModel() .getStateByName(MCMCModel.SIMULATION_CHAIN_PREFIX + i); progressPanel.add(new GraphLine(new Dimension(d_edgeLength * 2, d_arrowSize), 2, SwingConstants.EAST), cc.xy(9, rowIdx));//from w w w .j a v a 2 s.co m progressPanel.add(new GraphProgressNode(d_gridCellSize, simulationTask), cc.xy(10, rowIdx)); progressPanel.add(new GraphLine(cellSize, 2, SwingConstants.EAST), cc.xy(11, rowIdx)); } /** Placement needed for the calculated preferred size */ progressPanel.add(new GraphSimpleNode(circleSize, GraphSimpleNodeType.START), centerCell(cc, d_numMainRows, 1)); progressPanel.add(new GraphLine(cellSize, 2, SwingConstants.EAST), centerCell(cc, d_numMainRows, 2)); Task startTask = d_model.getModel().getActivityTask().getModel() .getStateByName(MCMCModel.STARTING_SIMULATION_PHASE); progressPanel.add(new GraphProgressNode(d_gridCellSize, startTask, false), centerCell(cc, d_numMainRows, 3)); progressPanel.add(new GraphLine(cellSize, 2, SwingConstants.EAST), centerCell(cc, d_numMainRows, 4)); //NOTE: it is a mystery why numMainRows - 1 is the correct count instead of just numMainRows progressPanel.add( new GraphBar(new Dimension(d_barWidth, (int) progressPanel.getPreferredSize().getHeight())), centerCell(cc, d_numMainRows - 1, 5)); progressPanel.add( new GraphBar(new Dimension(d_barWidth, (int) progressPanel.getPreferredSize().getHeight())), centerCell(cc, d_numMainRows - 1, 12)); Task assessConvergence = d_model.getModel().getActivityTask().getModel() .getStateByName(MCMCModel.CALCULATING_SUMMARIES_PHASE); progressPanel.add(new GraphLine(cellSize, 2, SwingConstants.EAST), centerCell(cc, d_numMainRows, 13)); progressPanel.add(new GraphProgressNode(d_gridCellSize, assessConvergence, false), centerCell(cc, d_numMainRows, 14)); progressPanel.add(new GraphLine(new Dimension(d_arrowSize, 50), 2, SwingConstants.SOUTH), cc.xywh(14, d_numMainRows / 2 + 2, 1, d_numMainRows / 2 + 1, CellConstraints.CENTER, CellConstraints.BOTTOM)); progressPanel.add(new GraphSimpleNode(circleSize, GraphSimpleNodeType.DECISION), cc.xywh(14, d_numMainRows + 2, 1, 1, CellConstraints.CENTER, CellConstraints.CENTER)); progressPanel.add( new GraphLine(new Dimension((int) (d_edgeLength + (d_edgeLength)), d_arrowSize), 2, SwingConstants.EAST), cc.xyw(14, d_numMainRows + 2, 2, CellConstraints.RIGHT, CellConstraints.DEFAULT)); progressPanel.add(new GraphSimpleNode(circleSize, GraphSimpleNodeType.END), cc.xy(16, d_numMainRows + 2)); progressPanel.add(new GraphLine(new Dimension(d_edgeLength * 9, d_arrowSize), 2, SwingConstants.WEST), cc.xyw(10, d_numMainRows + 2, 14 - 7, CellConstraints.LEFT, CellConstraints.DEFAULT)); progressPanel.add(new GraphBar(new Dimension(d_edgeLength * 2, d_barWidth)), cc.xy(9, d_numMainRows + 2)); int totalHeight = (int) progressPanel.getPreferredSize().getHeight(); progressPanel.add( new GraphConnector(new Dimension(d_edgeLength * 2, totalHeight), d_cellHeight + Sizes.DLUY3.getPixelSize(progressPanel), totalHeight - 30, d_numberOfChains), cc.xywh(9, 1, 1, d_numTotalRows)); PanelBuilder builder = new PanelBuilder(new FormLayout("pref", "p")); builder.setDefaultDialogBorder(); builder.add(progressPanel); return builder.getPanel(); }
From source file:org.drugis.addis.gui.ConvergenceSummaryDialog.java
License:Open Source License
private JPanel createPanel() { final FormLayout layout = new FormLayout("pref, 3dlu, fill:0:grow", "pref, 3dlu, pref"); final PanelBuilder builder = new PanelBuilder(layout, new JPanel()); builder.setDefaultDialogBorder();/*from w ww. jav a2 s . com*/ CellConstraints cc = new CellConstraints(); builder.add(buildConvergenceTable(d_wrapper, d_modelConstructed), cc.xy(1, 1, CellConstraints.DEFAULT, CellConstraints.TOP)); builder.add(AuxComponentFactory.createHtmlField(CONVERGENCE_TEXT), cc.xy(3, 1)); d_settingsPanel = buildMCMCSettingsPanel(); builder.add(d_settingsPanel, cc.xyw(1, 3, 3)); final JPanel panel = builder.getPanel(); d_tableModel.addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { panel.validate(); } }); return panel; }
From source file:org.eclipse.wb.internal.swing.FormLayout.gef.FormSelectionEditPolicy.java
License:Open Source License
@Override public void performRequest(Request request) { if (request instanceof KeyRequest) { KeyRequest keyRequest = (KeyRequest) request; if (keyRequest.isPressed()) { char c = keyRequest.getCharacter(); // horizontal if (c == 'd') { setAlignment(true, CellConstraints.DEFAULT); } else if (c == 'l') { setAlignment(true, CellConstraints.LEFT); } else if (c == 'f') { setAlignment(true, CellConstraints.FILL); } else if (c == 'c') { setAlignment(true, CellConstraints.CENTER); } else if (c == 'r') { setAlignment(true, CellConstraints.RIGHT); }/* ww w . ja v a 2 s . com*/ // vertical if (c == 'D') { setAlignment(false, CellConstraints.DEFAULT); } else if (c == 't') { setAlignment(false, CellConstraints.TOP); } else if (c == 'F') { setAlignment(false, CellConstraints.FILL); } else if (c == 'm') { setAlignment(false, CellConstraints.CENTER); } else if (c == 'b') { setAlignment(false, CellConstraints.BOTTOM); } } } }
From source file:org.eclipse.wb.internal.swing.FormLayout.model.CellConstraintsAssistantPage.java
License:Open Source License
public CellConstraintsAssistantPage(Composite parent, FormLayoutInfo layout, List<ObjectInfo> objects) { super(parent, objects); m_layout = layout;/*from www .ja v a2 s .co m*/ GridLayoutFactory.create(this).columns(3); // horizontal alignments { Group horizontalGroup = addChoiceProperty(this, "h alignment", ModelMessages.CellConstraintsAssistantPage_horizontalGroup, new Object[][] { new Object[] { ModelMessages.CellConstraintsAssistantPage_haDefault, CellConstraints.DEFAULT }, new Object[] { ModelMessages.CellConstraintsAssistantPage_haLeft, CellConstraints.LEFT }, new Object[] { ModelMessages.CellConstraintsAssistantPage_haCenter, CellConstraints.CENTER }, new Object[] { ModelMessages.CellConstraintsAssistantPage_haRight, CellConstraints.RIGHT }, new Object[] { ModelMessages.CellConstraintsAssistantPage_haFill, CellConstraints.FILL } }); GridDataFactory.modify(horizontalGroup).fill(); } // vertical alignments { Group verticalGroup = addChoiceProperty(this, "v alignment", ModelMessages.CellConstraintsAssistantPage_verticalGroup, new Object[][] { new Object[] { ModelMessages.CellConstraintsAssistantPage_vaDefault, CellConstraints.DEFAULT }, new Object[] { ModelMessages.CellConstraintsAssistantPage_vaTop, CellConstraints.TOP }, new Object[] { ModelMessages.CellConstraintsAssistantPage_vaCenter, CellConstraints.CENTER }, new Object[] { ModelMessages.CellConstraintsAssistantPage_vaBottom, CellConstraints.BOTTOM }, new Object[] { ModelMessages.CellConstraintsAssistantPage_vaFill, CellConstraints.FILL } }); GridDataFactory.modify(verticalGroup).fill(); } // grid { Group gridGroup = addIntegerProperties(this, ModelMessages.CellConstraintsAssistantPage_gridGroup, new String[][] { { "grid x", ModelMessages.CellConstraintsAssistantPage_gridX }, { "grid y", ModelMessages.CellConstraintsAssistantPage_gridY }, { "grid width", ModelMessages.CellConstraintsAssistantPage_gridWidth }, { "grid height", ModelMessages.CellConstraintsAssistantPage_gridHeight } }); GridDataFactory.modify(gridGroup).fill(); } }
From source file:org.eclipse.wb.internal.swing.FormLayout.model.CellConstraintsSupport.java
License:Open Source License
CellConstraintsSupport(FormLayoutInfo layoutInfo, ComponentInfo componentInfo) { m_layout = layoutInfo;//from w w w .ja v a2s . com m_component = componentInfo; // fetch values FormLayout layout = (FormLayout) m_layout.getObject(); if (layout != null && m_component.getComponent() != null && m_component.getComponent().getParent() == m_layout.getContainer().getContainer()) { CellConstraints constraints = layout.getConstraints(m_component.getComponent()); x = constraints.gridX; y = constraints.gridY; width = constraints.gridWidth; height = constraints.gridHeight; alignH = constraints.hAlign; alignV = constraints.vAlign; } else { x = y = width = height = 1; alignH = alignV = CellConstraints.DEFAULT; } // remember state rememberWrittenState(); }
From source file:org.eclipse.wb.internal.swing.FormLayout.model.CellConstraintsSupport.java
License:Open Source License
/** * Writes current values as constraints in component association using * {@link Container#add(Component, Object)}. *//* w w w. j a v a2s.c o m*/ public void write() throws Exception { // check if write required if (needWrite()) { // prepare constraints source String source; { source = x + ", " + y; // span if (width != 1 || height != 1) { source += ", " + width + ", " + height; } // align if (alignH != CellConstraints.DEFAULT || alignV != CellConstraints.DEFAULT) { source += ", " + alignH + ", " + alignV; } } // update association constraints if (m_component.getAssociation() instanceof InvocationChildAssociation) { InvocationChildAssociation association = (InvocationChildAssociation) m_component.getAssociation(); MethodInvocation invocation = association.getInvocation(); String signature = AstNodeUtils.getMethodSignature(invocation); if (signature.equals("add(java.awt.Component,java.lang.Object)")) { Expression constraintsExpression = (Expression) invocation.arguments().get(1); m_layout.getEditor().replaceExpression(constraintsExpression, "\"" + source + "\""); } else if (signature.equals("add(java.awt.Component)")) { m_layout.getEditor().addInvocationArgument(invocation, 1, "\"" + source + "\""); } } // remember state rememberWrittenState(); } }