List of usage examples for com.jgoodies.forms.layout FormSpec getDefaultAlignment
public final DefaultAlignment getDefaultAlignment()
From source file:com.intellij.uiDesigner.radComponents.FormLayoutColumnProperties.java
License:Apache License
public void showProperties(final RadContainer container, final boolean row, final int[] selectedIndices) { if (mySaving) return;// ww w . ja va 2 s .co m if (selectedIndices.length == 1) { showControls(true); myShowing = true; try { myLayout = (FormLayout) container.getLayout(); myIndex = selectedIndices[0] + 1; myIsRow = row; myTitleLabel.setText(myIsRow ? UIDesignerBundle.message("title.row.properties", myIndex) : UIDesignerBundle.message("title.column.properties", myIndex)); myLeftRadioButton.setText(row ? UIDesignerBundle.message("alignment.top") : UIDesignerBundle.message("alignment.left")); myRightRadioButton.setText(row ? UIDesignerBundle.message("alignment.bottom") : UIDesignerBundle.message("alignment.right")); mySizePanel.setBorder( IdeBorderFactory.createTitledBorder(myIsRow ? UIDesignerBundle.message("title.height") : UIDesignerBundle.message("title.width"), true)); FormSpec formSpec = row ? myLayout.getRowSpec(myIndex) : myLayout.getColumnSpec(myIndex); showAlignment(formSpec.getDefaultAlignment()); showSize(formSpec.getSize()); if (formSpec.getResizeWeight() < 0.01) { myGrowCheckBox.setSelected(false); myGrowSpinner.setValue(1.0); } else { myGrowCheckBox.setSelected(true); myGrowSpinner.setValue(formSpec.getResizeWeight()); } } finally { myShowing = false; } } else { showControls(false); if (selectedIndices.length > 1) { myTitleLabel.setText(myIsRow ? UIDesignerBundle.message("title.multiple.rows.selected") : UIDesignerBundle.message("title.multiple.columns.selected")); } else { myTitleLabel.setText(myIsRow ? UIDesignerBundle.message("title.no.rows.selected") : UIDesignerBundle.message("title.no.columns.selected")); } } }
From source file:com.intellij.uiDesigner.radComponents.RadFormLayoutManager.java
License:Apache License
public int getAlignment(RadComponent component, boolean horizontal) { CellConstraints cc = (CellConstraints) component.getCustomLayoutConstraints(); CellConstraints.Alignment al = horizontal ? cc.hAlign : cc.vAlign; if (al == CellConstraints.DEFAULT) { FormLayout formLayout = (FormLayout) component.getParent().getLayout(); FormSpec formSpec = horizontal ? formLayout.getColumnSpec(component.getConstraints().getColumn() + 1) : formLayout.getRowSpec(component.getConstraints().getRow() + 1); final FormSpec.DefaultAlignment defaultAlignment = formSpec.getDefaultAlignment(); if (defaultAlignment.equals(RowSpec.FILL)) { return GridConstraints.ALIGN_FILL; }// www .ja v a 2 s . c o m if (defaultAlignment.equals(RowSpec.TOP) || defaultAlignment.equals(ColumnSpec.LEFT)) { return GridConstraints.ALIGN_LEFT; } if (defaultAlignment.equals(RowSpec.CENTER)) { return GridConstraints.ALIGN_CENTER; } return GridConstraints.ALIGN_RIGHT; } return Utils.alignFromConstraints(component.getConstraints(), horizontal); }
From source file:org.eclipse.wb.internal.swing.FormLayout.model.FormDimensionInfo.java
License:Open Source License
/** * Updates {@link FormDimensionInfo} model using {@link FormSpec}. *///from ww w. ja v a2 s . co m private void setFormSpec(FormSpec spec) throws Exception { m_size = new FormSizeInfo(spec.getSize(), m_horizontal); m_alignment = spec.getDefaultAlignment(); m_weight = spec.getResizeWeight(); }
From source file:org.eclipse.wb.internal.swing.FormLayout.model.FormDimensionUtils.java
License:Open Source License
/** * @return <code>true</code> if two {@link FormSpec} objects are equal. *//* w ww . j a v a2 s. c om*/ public static boolean equals(FormSpec a, FormSpec b) { if (a.getClass() == b.getClass()) { return a.getDefaultAlignment() == b.getDefaultAlignment() && a.getResizeWeight() == b.getResizeWeight() && a.getSize().equals(b.getSize()); } return false; }