List of usage examples for com.jgoodies.forms.layout CellConstraints TOP
Alignment TOP
To view the source code for com.jgoodies.forms.layout CellConstraints TOP.
Click Source Link
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 w w . jav a 2 s . c o m*/ 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); }/*from w w w .ja v a 2s .c o m*/ // 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 w w w . jav a 2s . c o 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
/** * @return the small {@link Image} that represents horizontal/vertical alignment. */// ww w .ja v a2 s . co m public Image getSmallAlignmentImage(boolean horizontal) { if (horizontal) { if (alignH == CellConstraints.LEFT) { return Activator.getImage("alignment/h/left.gif"); } else if (alignH == CellConstraints.CENTER) { return Activator.getImage("alignment/h/center.gif"); } else if (alignH == CellConstraints.RIGHT) { return Activator.getImage("alignment/h/right.gif"); } else if (alignH == CellConstraints.FILL) { return Activator.getImage("alignment/h/fill.gif"); } else { return null; } } else { if (alignV == CellConstraints.TOP) { return Activator.getImage("alignment/v/top.gif"); } else if (alignV == CellConstraints.CENTER) { return Activator.getImage("alignment/v/center.gif"); } else if (alignV == CellConstraints.BOTTOM) { return Activator.getImage("alignment/v/bottom.gif"); } else if (alignV == CellConstraints.FILL) { return Activator.getImage("alignment/v/fill.gif"); } else { return null; } } }
From source file:org.eclipse.wb.internal.swing.FormLayout.model.CellConstraintsSupport.java
License:Open Source License
/** * Adds the vertical alignment {@link Action}'s. *///from www . j a va2s. c o m public void fillVerticalAlignmentMenu(IMenuManager manager2) { manager2.add(new SetAlignmentAction(ModelMessages.CellConstraintsSupport_vaDefault, "default.gif", false, CellConstraints.DEFAULT)); manager2.add(new SetAlignmentAction(ModelMessages.CellConstraintsSupport_vaTop, "top.gif", false, CellConstraints.TOP)); manager2.add(new SetAlignmentAction(ModelMessages.CellConstraintsSupport_vaCenter, "center.gif", false, CellConstraints.CENTER)); manager2.add(new SetAlignmentAction(ModelMessages.CellConstraintsSupport_vaBottom, "bottom.gif", false, CellConstraints.BOTTOM)); manager2.add(new SetAlignmentAction(ModelMessages.CellConstraintsSupport_vaFill, "fill.gif", false, CellConstraints.FILL)); }
From source file:org.eclipse.wb.internal.swing.FormLayout.model.FormLayoutConverter.java
License:Open Source License
/** * Calculate vertical alignment./*from w ww .j a v a 2 s . c o m*/ */ private static CellConstraints.Alignment getVerticalAlignment(List<ComponentGroup> rows, ComponentInGroup componentInGroup, GeneralLayoutData generalLayoutData) { if (generalLayoutData.verticalAlignment != null) { // from general layout data CellConstraints.Alignment alignment = GeneralLayoutData .getRealValue(FormLayoutInfo.m_verticalAlignmentMap, generalLayoutData.verticalAlignment); if (alignment != null && alignment != CellConstraints.DEFAULT) { return alignment; } } // calculate IAbstractComponentInfo component = componentInGroup.getComponent(); // prepare begin/end row ComponentGroup beginRow = GridConvertionHelper.getBeginForComponent(rows, componentInGroup); ComponentGroup endRow = GridConvertionHelper.getEndForComponent(rows, componentInGroup); Rectangle bounds = component.getBounds(); Dimension prefSize = component.getPreferredSize(); int bt = bounds.y; int bb = bounds.bottom(); int rowTop = beginRow.getMin(); int rowBottom = endRow.getMax(); int rowCenter = rowTop + (rowBottom - rowTop) / 2; // int topOffset = bt - rowTop; int bottomOffset = rowBottom - bb; // prepare how much location of two sides will be changed for each alignment int topDelta = topOffset + Math.abs(rowTop + prefSize.height - bb); int bottomDelta = bottomOffset + Math.abs(rowBottom - prefSize.height - bt); int fillDelta = topOffset + bottomOffset; int centerDelta = Math.abs(bt - (rowCenter - prefSize.height / 2)) + Math.abs(bb - (rowCenter + prefSize.height / 2)); // set alignment return getAlignment(new int[] { topDelta, centerDelta, bottomDelta, fillDelta }, new Alignment[] { CellConstraints.TOP, CellConstraints.CENTER, CellConstraints.BOTTOM, CellConstraints.FILL }); }
From source file:org.eclipse.wb.internal.swing.FormLayout.model.SelectionActionsSupport.java
License:Open Source License
@Override public void addSelectionActions(List<ObjectInfo> objects, List<Object> actions) throws Exception { if (objects.isEmpty()) { return;//www. j av a 2 s .c o m } // prepare constraints List<CellConstraintsSupport> constraints = Lists.newArrayList(); for (ObjectInfo object : objects) { // check object if (!(object instanceof ComponentInfo) || object.getParent() != m_layout.getContainer()) { return; } // add data info ComponentInfo component = (ComponentInfo) object; constraints.add(FormLayoutInfo.getConstraints(component)); } // create horizontal actions actions.add(new Separator()); addAlignmentAction(actions, constraints, true, "default.gif", ModelMessages.SelectionActionsSupport_haDefault, CellConstraints.DEFAULT); addAlignmentAction(actions, constraints, true, "left.gif", ModelMessages.SelectionActionsSupport_haLeft, CellConstraints.LEFT); addAlignmentAction(actions, constraints, true, "center.gif", ModelMessages.SelectionActionsSupport_haCenter, CellConstraints.CENTER); addAlignmentAction(actions, constraints, true, "right.gif", ModelMessages.SelectionActionsSupport_haRight, CellConstraints.RIGHT); addAlignmentAction(actions, constraints, true, "fill.gif", ModelMessages.SelectionActionsSupport_haFill, CellConstraints.FILL); // create vertical actions actions.add(new Separator()); addAlignmentAction(actions, constraints, false, "default.gif", ModelMessages.SelectionActionsSupport_vaDefault, CellConstraints.DEFAULT); addAlignmentAction(actions, constraints, false, "top.gif", ModelMessages.SelectionActionsSupport_haTop, CellConstraints.TOP); addAlignmentAction(actions, constraints, false, "center.gif", ModelMessages.SelectionActionsSupport_vaCenter, CellConstraints.CENTER); addAlignmentAction(actions, constraints, false, "bottom.gif", ModelMessages.SelectionActionsSupport_vaBottom, CellConstraints.BOTTOM); addAlignmentAction(actions, constraints, false, "fill.gif", ModelMessages.SelectionActionsSupport_vaFill, CellConstraints.FILL); }
From source file:org.eclipse.wb.tests.designer.swing.model.layout.FormLayout.CellConstraintsSupportTest.java
License:Open Source License
public void test_setAlignV() throws Exception { CellConstraintsSupport support = FormLayoutInfo.getConstraints(m_button); ////from w w w. ja v a 2s .co m String expectedSource = StringUtils.replace(m_lastEditor.getSource(), "1, 2", "1, 2, default, top"); support.setAlignV(CellConstraints.TOP); support.write(); assertEditor(expectedSource, m_lastEditor); }
From source file:org.eclipse.wb.tests.designer.swing.model.layout.FormLayout.CellConstraintsSupportTest.java
License:Open Source License
public void test_getSmallAlignmentImage() throws Exception { check_getSmallAlignmentImage(CellConstraints.DEFAULT, true, false); check_getSmallAlignmentImage(CellConstraints.LEFT, true, true); check_getSmallAlignmentImage(CellConstraints.CENTER, true, true); check_getSmallAlignmentImage(CellConstraints.RIGHT, true, true); check_getSmallAlignmentImage(CellConstraints.FILL, true, true); ///* w ww .j ava 2 s . c om*/ check_getSmallAlignmentImage(CellConstraints.DEFAULT, false, false); check_getSmallAlignmentImage(CellConstraints.TOP, false, true); check_getSmallAlignmentImage(CellConstraints.CENTER, false, true); check_getSmallAlignmentImage(CellConstraints.BOTTOM, false, true); check_getSmallAlignmentImage(CellConstraints.FILL, false, true); }
From source file:org.janelia.it.venkman.gui.parameter.ParameterGroup.java
License:Open Source License
public JPanel getContentPanel(boolean isEditable) { if (contentPanel == null) { FormLayout layout = new FormLayout("left:max(40dlu;pref), 4dlu, left:pref:none", // column layout ""); // row layout DefaultFormBuilder builder = new DefaultFormBuilder(layout); // builder.setDefaultRowSpec(RowSpec.decode("top:pref:none")); builder.setVAlignment(CellConstraints.TOP); if (parameterList.size() > 0) { for (ExperimentParameter parameter : parameterList) { if (isEditable) { builder.append(parameter.getDisplayName() + ":", parameter.getComponent()); } else { builder.append(parameter.getDisplayName() + ":", parameter.getReadOnlyComponent()); }/*from w w w . ja va 2 s . c om*/ } builder.nextLine(); } else { builder.append("There are no parameters to configure."); } contentPanel = builder.getPanel(); } return contentPanel; }