/** * Returns the number of rows in this view. * * @return the number of rows in this view */ public int getRowCount() { return m_formlayout.getRowCount(); }
/** * Returns the number of rows in the form. * * @return the number of rows */ public final int getRowCount() { return getLayout().getRowCount(); }
/** * Returns the number of rows in the form. * * @return the number of rows */ public final int getRowCount() { return getLayout().getRowCount(); }
/** * Returns the number of rows in the form. * * @return the number of rows */ public final int getRowCount() { return getLayout().getRowCount(); }
/** * Dumps the layout's row specifications to the console. * * @param layout the <code>FormLayout</code> to inspect */ public static void dumpRowSpecs(FormLayout layout) { System.out.print("ROW SPECS: "); for (int row = 1; row <= layout.getRowCount(); row++) { RowSpec rowSpec = layout.getRowSpec(row); System.out.print(rowSpec.toShortString()); if (row < layout.getRowCount()) System.out.print(", "); } System.out.println(); }
/** * Dumps the layout's row specifications to the console. * * @param layout * the <code>FormLayout</code> to inspect */ public static void dumpRowSpecs(FormLayout layout) { System.out.print("ROW SPECS: "); for (int row = 1; row <= layout.getRowCount(); row++) { RowSpec rowSpec = layout.getRowSpec(row); System.out.print(rowSpec.toShortString()); if (row < layout.getRowCount()) System.out.print(", "); } System.out.println(); }
/** * Dumps the layout's row specifications to the console. * * @param layout the {@code FormLayout} to inspect */ public static void dumpRowSpecs(FormLayout layout) { System.out.print("ROW SPECS: "); for (int row = 1; row <= layout.getRowCount(); row++) { RowSpec rowSpec = layout.getRowSpec(row); System.out.print(rowSpec.toShortString()); if (row < layout.getRowCount()) { System.out.print(", "); } } System.out.println(); }
/** * Inserts the specified column at the specified position. Shifts * components that intersect the new column to the right and readjusts * column groups.<p> * * The component shift works as follows: components that were located on * the right hand side of the inserted column are shifted one column to * the right; component column span is increased by one if it intersects * the new column.<p> * * Column group indices that are greater or equal than the given column * index will be increased by one. * * @param rowIndex index of the row to be inserted * @param rowSpec specification of the row to be inserted * @throws IndexOutOfBoundsException if the row index is out of range */ public void insertRow(int rowIndex, RowSpec rowSpec) { if (rowIndex < 1 || rowIndex > getRowCount()) { throw new IndexOutOfBoundsException( "The row index " + rowIndex + " must be in the range [1, " + getRowCount() + "]."); } rowSpecs.add(rowIndex - 1, rowSpec); shiftComponentsVertically(rowIndex, false); adjustGroupIndices(rowGroupIndices, rowIndex, false); }
/** * Inserts the specified column at the specified position. Shifts components * that intersect the new column to the right and readjusts column groups. * <p> * * The component shift works as follows: components that were located on the * right hand side of the inserted column are shifted one column to the * right; component column span is increased by one if it intersects the new * column. * <p> * * Column group indices that are greater or equal than the given column * index will be increased by one. * * @param rowIndex * index of the row to be inserted * @param rowSpec * specification of the row to be inserted * @throws IndexOutOfBoundsException * if the row index is out of range */ public void insertRow(int rowIndex, RowSpec rowSpec) { if (rowIndex < 1 || rowIndex > getRowCount()) { throw new IndexOutOfBoundsException("The row index " + rowIndex + " must be in the range [1, " + getRowCount() + "]."); } rowSpecs.add(rowIndex - 1, rowSpec); shiftComponentsVertically(rowIndex, false); adjustGroupIndices(rowGroupIndices, rowIndex, false); }
/** * Initializes two lists for columns and rows that hold a column's or row's * components that span only this column or row. * <p> * * Iterates over all components and their associated constraints; every * component that has a column span or row span of 1 is put into the * column's or row's component list. */ private void initializeColAndRowComponentLists() { colComponents = new LinkedList[getColumnCount()]; for (int i = 0; i < getColumnCount(); i++) { colComponents[i] = new LinkedList(); } rowComponents = new LinkedList[getRowCount()]; for (int i = 0; i < getRowCount(); i++) { rowComponents[i] = new LinkedList(); } for (Iterator i = constraintMap.entrySet().iterator(); i.hasNext();) { Map.Entry entry = (Map.Entry) i.next(); Component component = (Component) entry.getKey(); if (!component.isVisible()) continue; CellConstraints constraints = (CellConstraints) entry.getValue(); if (constraints.gridWidth == 1) colComponents[constraints.gridX - 1].add(component); if (constraints.gridHeight == 1) rowComponents[constraints.gridY - 1].add(component); } }
/** * Initializes two lists for columns and rows that hold a column's * or row's components that span only this column or row.<p> * * Iterates over all components and their associated constraints; * every component that has a column span or row span of 1 * is put into the column's or row's component list. */ private void initializeColAndRowComponentLists() { colComponents = new List[getColumnCount()]; for (int i=0; i < getColumnCount(); i++) { colComponents[i] = new ArrayList(); } rowComponents = new List[getRowCount()]; for (int i=0; i < getRowCount(); i++) { rowComponents[i] = new ArrayList(); } for (Iterator i = constraintMap.entrySet().iterator(); i.hasNext(); ) { Map.Entry entry = (Map.Entry) i.next(); Component component = (Component) entry.getKey(); CellConstraints constraints = (CellConstraints) entry.getValue(); if (takeIntoAccount(component, constraints)) { if (constraints.gridWidth == 1) colComponents[constraints.gridX-1].add(component); if (constraints.gridHeight == 1) rowComponents[constraints.gridY-1].add(component); } } }
/** * Insert the specified row into the layout. This accomodates * for the appendColumn/insertColumn API weakness in FormLayout. */ private void insertRow(int index, RowSpec rowSpec) { if(index == formLayout.getRowCount()) formLayout.appendRow(rowSpec); else formLayout.insertRow(index + 1, rowSpec); }
/** * Insert the specified row into the layout. This accomodates * for the appendColumn/insertColumn API weakness in FormLayout. */ private void insertRow(int index, RowSpec rowSpec) { if(index == formLayout.getRowCount()) formLayout.appendRow(rowSpec); else formLayout.insertRow(index + 1, rowSpec); }
/** * Inserts the specified column at the specified position. Shifts * components that intersect the new column to the right and readjusts * column groups.<p> * * The component shift works as follows: components that were located on * the right hand side of the inserted column are shifted one column to * the right; component column span is increased by one if it intersects * the new column.<p> * * Column group indices that are greater or equal than the given column * index will be increased by one. * * @param rowIndex index of the row to be inserted * @param rowSpec specification of the row to be inserted * @throws IndexOutOfBoundsException if the row index is out of range */ public void insertRow(int rowIndex, RowSpec rowSpec) { if (rowIndex < 1 || rowIndex > getRowCount()) { throw new IndexOutOfBoundsException( "The row index " + rowIndex + " must be in the range [1, " + getRowCount() + "]."); } rowSpecs.add(rowIndex - 1, rowSpec); shiftComponentsVertically(rowIndex, false); adjustGroupIndices(rowGroupIndices, rowIndex, false); }
/** * Insert the specified row into the layout. This accomodates * for the appendColumn/insertColumn API weakness in FormLayout. */ private void insertRow(int index, RowSpec rowSpec) { if(index == formLayout.getRowCount()) formLayout.appendRow(rowSpec); else formLayout.insertRow(index + 1, rowSpec); }
/** * Sets the constraints for the specified component in this layout. * * @param component the component to be modified * @param constraints the constraints to be applied * @throws NullPointerException if the component or constraints object * is <code>null</code> */ public void setConstraints(Component component, CellConstraints constraints) { if (component == null) throw new NullPointerException("The component must not be null."); if (constraints == null) throw new NullPointerException("The constraints must not be null."); constraints.ensureValidGridBounds(getColumnCount(), getRowCount()); constraintMap.put(component, constraints.clone()); }
/** * Sets the constraints for the specified component in this layout. * * @param component * the component to be modified * @param constraints * the constraints to be applied * @throws NullPointerException * if the component or constraints object is <code>null</code> */ public void setConstraints(Component component, CellConstraints constraints) { if (component == null) throw new NullPointerException("The component must not be null."); if (constraints == null) throw new NullPointerException("The constraints must not be null."); constraints.ensureValidGridBounds(getColumnCount(), getRowCount()); constraintMap.put(component, constraints.clone()); }
/** * Sets the constraints for the specified component in this layout. * * @param component the component to be modified * @param constraints the constraints to be applied * @throws NullPointerException if {@code component} or {@code constraints} * is {@code null} */ public void setConstraints(Component component, CellConstraints constraints) { checkNotNull(component, "The component must not be null."); checkNotNull(constraints, "The constraints must not be null."); constraints.ensureValidGridBounds(getColumnCount(), getRowCount()); constraintMap.put(component, (CellConstraints) constraints.clone()); }
/** * ctor */ public ImageFillView(GridView preview, PaintProperty pp) { super("com/jeta/swingbuilder/gui/images/imageProperties.frm", null); FormPanel view = getView(); Container form = view.getFormContainer(); FormLayout layout = (FormLayout) form.getLayout(); layout.appendRow(new RowSpec("2dlu")); layout.appendRow(new RowSpec("pref")); CellConstraints cc = new CellConstraints(); JComboBox hbox = new JComboBox(new Object[] { "LEFT", "CENTER", "RIGHT" }); hbox.setName(ImageFillNames.ID_HORIZONTAL_ALIGNMENT); form.add(new JLabel("Horizontal Alignment"), cc.xy(1, layout.getRowCount())); form.add(hbox, cc.xy(3, layout.getRowCount())); layout.appendRow(new RowSpec("2dlu")); layout.appendRow(new RowSpec("pref")); JComboBox vbox = new JComboBox(new Object[] { "TOP", "CENTER", "BOTTOM" }); vbox.setName(ImageFillNames.ID_VERTICAL_ALIGNMENT); form.add(new JLabel("Vertical Alignment"), cc.xy(1, layout.getRowCount())); form.add(vbox, cc.xy(3, layout.getRowCount())); m_preview = preview; setController(new ImageFillController(this)); if (pp != null) { setPaintProperty(pp); } }
@Override public void add(JPanel panel, JComponent component, Object constraint) { FormLayout layout = (FormLayout) panel.getLayout(); // Field row layout.appendRow(RowSpec.decode("default")); int row = layout.getRowCount(); // Constraints CellConstraints cc = new CellConstraints(); // Decoration component = decorate(component); // Field panel.add(component, cc.xy(3, row)); // Label String key = (String) constraint; if (StringUtils.isNotBlank(key) && GUIStrings.isDefined(key)) { String text = GUIStrings.get(key); JLabel label = new JLabel(text); panel.add(label, cc.xy(1, row)); label.setLabelFor(component); } // Separator layout.appendRow(RowSpec.decode("2dlu")); }