/** * Returns the number of columns in this view. * * @return the number of columns in this view */ public int getColumnCount() { return m_formlayout.getColumnCount(); }
/** * Returns the number of columns in the form. * * @return the number of columns */ public final int getColumnCount() { return getLayout().getColumnCount(); }
/** * Returns the number of columns in the form. * * @return the number of columns */ public final int getColumnCount() { return getLayout().getColumnCount(); }
/** * Returns the number of columns in the form. * * @return the number of columns */ public final int getColumnCount() { return getLayout().getColumnCount(); }
/** * Dumps the layout's column specifications to the console. * * @param layout the <code>FormLayout</code> to inspect */ public static void dumpColumnSpecs(FormLayout layout) { System.out.print("COLUMN SPECS:"); for (int col = 1; col <= layout.getColumnCount(); col++) { ColumnSpec colSpec = layout.getColumnSpec(col); System.out.print(colSpec.toShortString()); if (col < layout.getColumnCount()) System.out.print(", "); } System.out.println(); }
/** * Dumps the layout's column specifications to the console. * * @param layout * the <code>FormLayout</code> to inspect */ public static void dumpColumnSpecs(FormLayout layout) { System.out.print("COLUMN SPECS:"); for (int col = 1; col <= layout.getColumnCount(); col++) { ColumnSpec colSpec = layout.getColumnSpec(col); System.out.print(colSpec.toShortString()); if (col < layout.getColumnCount()) System.out.print(", "); } System.out.println(); }
/** * Dumps the layout's column specifications to the console. * * @param layout the {@code FormLayout} to inspect */ public static void dumpColumnSpecs(FormLayout layout) { System.out.print("COLUMN SPECS:"); for (int col = 1; col <= layout.getColumnCount(); col++) { ColumnSpec colSpec = layout.getColumnSpec(col); System.out.print(colSpec.toShortString()); if (col < layout.getColumnCount()) { System.out.print(", "); } } System.out.println(); }
/** * Inserts the specified column at the specified position. Shifts components * that intersect the new column to the right hand side 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 columnIndex index of the column to be inserted * @param columnSpec specification of the column to be inserted * @throws IndexOutOfBoundsException if the column index is out of range */ public void insertColumn(int columnIndex, ColumnSpec columnSpec) { if (columnIndex < 1 || columnIndex > getColumnCount()) { throw new IndexOutOfBoundsException( "The column index " + columnIndex + "must be in the range [1, " + getColumnCount() + "]."); } colSpecs.add(columnIndex - 1, columnSpec); shiftComponentsHorizontally(columnIndex, false); adjustGroupIndices(colGroupIndices, columnIndex, false); }
/** * Inserts the specified column at the specified position. Shifts components * that intersect the new column to the right hand side 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 columnIndex index of the column to be inserted * @param columnSpec specification of the column to be inserted * @throws IndexOutOfBoundsException if the column index is out of range */ public void insertColumn(int columnIndex, ColumnSpec columnSpec) { if (columnIndex < 1 || columnIndex > getColumnCount()) { throw new IndexOutOfBoundsException( "The column index " + columnIndex + "must be in the range [1, " + getColumnCount() + "]."); } colSpecs.add(columnIndex - 1, columnSpec); shiftComponentsHorizontally(columnIndex, false); adjustGroupIndices(colGroupIndices, columnIndex, 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); } }
/** * Insert the specified column into the layout. This accomodates * for the appendRow/insertRow API weakness in FormLayout. */ private void insertColumn(int index, ColumnSpec columnSpec) { if(index == formLayout.getColumnCount()) formLayout.appendColumn(columnSpec); else formLayout.insertColumn(index + 1, columnSpec); }
/** * Insert the specified column into the layout. This accomodates * for the appendRow/insertRow API weakness in FormLayout. */ private void insertColumn(int index, ColumnSpec columnSpec) { if(index == formLayout.getColumnCount()) formLayout.appendColumn(columnSpec); else formLayout.insertColumn(index + 1, columnSpec); }
/** * Insert the specified column into the layout. This accomodates * for the appendRow/insertRow API weakness in FormLayout. */ private void insertColumn(int index, ColumnSpec columnSpec) { if(index == formLayout.getColumnCount()) formLayout.appendColumn(columnSpec); else formLayout.insertColumn(index + 1, columnSpec); }
/** * 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); } } }
/** * Adds a titled separator to the form that spans all columns. * * @param text * the separator titel * @return the added separator */ public final JComponent addSeparator(String text) { return addSeparator(text, getLayout().getColumnCount()); }
/** * Adds a titled separator to the form that spans all columns.<p> * * <pre> * addSeparator("Name"); // No Mnemonic * addSeparator("N&ame"); // Mnemonic is 'a' * addSeparator("Save &as"); // Mnemonic is the second 'a' * addSeparator("Look&&Feel"); // No mnemonic, text is "look&feel" * </pre> * * @param textWithMnemonic the separator label's text - * may contain an ampersand (<tt>&</tt>) to mark a mnemonic * @return the added separator */ public final JComponent addSeparator(String textWithMnemonic) { return addSeparator(textWithMnemonic, getLayout().getColumnCount()); }
/** * 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()); }
/** * Adds a titled separator to the form that spans all columns.<p> * * <pre> * addSeparator("Name"); // No Mnemonic * addSeparator("N&ame"); // Mnemonic is 'a' * addSeparator("Save &as"); // Mnemonic is the second 'a' * addSeparator("Look&&Feel"); // No mnemonic, text is "look&feel" * </pre> * * @param textWithMnemonic the separator label's text - * may contain an ampersand (<tt>&</tt>) to mark a mnemonic * @return the added separator */ public final JComponent addSeparator(String textWithMnemonic) { return addSeparator(textWithMnemonic, getLayout().getColumnCount()); }
/** * 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()); }