Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.TablePane$Column


     *
     * @param columnIndex
     * The index of the column whose preferred width we're calculating
     */
    private int getPreferredColumnWidth(int columnIndex) {
        TablePane tablePane = (TablePane)getComponent();

        TablePane.RowSequence rows = tablePane.getRows();

        int preferredWidth = 0;

        for (int i = 0, n = rows.getLength(); i < n; i++) {
            TablePane.Row row = rows.get(i);
View Full Code Here


    private int getPreferredRowHeight(int rowIndex, int[] columnWidths) {
        if (columnWidths == null) {
            throw new IllegalArgumentException("columnWidths is null");
        }

        TablePane tablePane = (TablePane)getComponent();

        TablePane.ColumnSequence columns = tablePane.getColumns();
        TablePane.Row row = tablePane.getRows().get(rowIndex);

        int preferredHeight = 0;

        for (int j = 0, n = row.getLength(), m = columns.getLength(); j < n && j < m; j++) {
            Component component = row.get(j);
View Full Code Here

     * @return
     * An array containing the width of each column in the table pane given the
     * specified constraint
     */
    private int[] getColumnWidths(int width) {
        TablePane tablePane = (TablePane)getComponent();

        TablePane.RowSequence rows = tablePane.getRows();
        TablePane.ColumnSequence columns = tablePane.getColumns();

        int rowCount = rows.getLength();
        int columnCount = columns.getLength();

        int[] columnWidths = new int[columnCount];
View Full Code Here

    private int[] getRowHeights(int height, int[] columnWidths) {
        if (columnWidths == null) {
            throw new IllegalArgumentException("columnWidths is null");
        }

        TablePane tablePane = (TablePane)getComponent();
        TablePane.RowSequence rows = tablePane.getRows();

        int rowCount = tablePane.getRows().getLength();
        int columnCount = tablePane.getColumns().getLength();

        int rowHeights[] = new int[rowCount];

        boolean[] defaultHeightRows = new boolean[rowCount];
        int totalRelativeWeight = 0;
View Full Code Here

        invalidateComponent();
    }

    @Override
    public void rowHighlightedChanged(TablePane.Row row) {
        TablePane tablePane = row.getTablePane();
        repaintComponent(getRowBounds(tablePane.getRows().indexOf(row)));
    }
View Full Code Here

        invalidateComponent();
    }

    @Override
    public void columnHighlightedChanged(TablePane.Column column) {
        TablePane tablePane = column.getTablePane();
        repaintComponent(getColumnBounds(tablePane.getColumns().indexOf(column)));
    }
View Full Code Here

        dividerColor = theme.getColor(9);

        selectionBevelColor = TerraTheme.brighten(selectionBackgroundColor);

        // Create the table pane
        calendarTablePane = new TablePane();
        for (int i = 0; i < 7; i++) {
            calendarTablePane.getColumns().add(new TablePane.Column(1, true));
        }

        // Month spinner
        monthSpinner = new Spinner();
        monthSpinner.setSpinnerData(new NumericSpinnerData(0, 11));
        monthSpinner.setItemRenderer(new MonthSpinnerItemRenderer());
        monthSpinner.setCircular(true);
        monthSpinner.getStyles().put("sizeToContent", true);

        monthSpinner.getSpinnerSelectionListeners().add(new SpinnerSelectionListener() {
            @Override
            public void selectedIndexChanged(Spinner spinner, int previousSelectedIndex) {
                Calendar calendar = (Calendar)getComponent();
                calendar.setMonth((Integer)spinner.getSelectedItem());
            }
        });

        // Year spinner
        yearSpinner = new Spinner();
        yearSpinner.setSpinnerData(new NumericSpinnerData(0, Short.MAX_VALUE));

        yearSpinner.getSpinnerSelectionListeners().add(new SpinnerSelectionListener() {
            @Override
            public void selectedIndexChanged(Spinner spinner, int previousSelectedIndex) {
                Calendar calendar = (Calendar)getComponent();
                calendar.setYear((Integer)spinner.getSelectedItem());
            }
        });

        // Attach a listener to consume mouse clicks
        ComponentMouseButtonListener spinnerMouseButtonListener = new ComponentMouseButtonListener.Adapter() {
            @Override
            public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count) {
                return true;
            }
        };

        monthSpinner.getComponentMouseButtonListeners().add(spinnerMouseButtonListener);
        yearSpinner.getComponentMouseButtonListeners().add(spinnerMouseButtonListener);

        // Add the month/year table pane
        TablePane monthYearTablePane = new TablePane();
        monthYearTablePane.getStyles().put("padding", 3);
        monthYearTablePane.getStyles().put("horizontalSpacing", 4);

        monthYearTablePane.getColumns().add(new TablePane.Column(1, true));
        monthYearTablePane.getColumns().add(new TablePane.Column(-1));

        TablePane.Row monthYearRow = new TablePane.Row(-1);
        monthYearTablePane.getRows().add(monthYearRow);
        monthYearRow.add(monthSpinner);
        monthYearRow.add(yearSpinner);

        TablePane.Row calendarRow = new TablePane.Row();
        calendarRow.add(monthYearTablePane);
View Full Code Here

                tableView.getRowBounds(rowIndex))));
            cardPane.setSelectedIndex(0);
            cardPane.getStyles().put("selectionChangeEffect", editEffect);
            cardPane.getStyles().put("selectionChangeDuration", editEffectDuration);

            tablePane = new TablePane();
            tablePane.getStyles().put("horizontalSpacing", 1);
            cardPane.add(tablePane);

            TablePane.Row tablePaneRow = new TablePane.Row(1, true);
            tablePane.getRows().add(tablePaneRow);
View Full Code Here

        // Set the derived colors
        titleBarBevelColor = TerraTheme.brighten(titleBarBackgroundColor);

        // Create the title bar components
        titleBarTablePane = new TablePane();
        titleBarTablePane.getColumns().add(new TablePane.Column(1, true));
        titleBarTablePane.getColumns().add(new TablePane.Column(-1));

        titleBarTablePane.getStyles().put("padding", new Insets(3));
        titleBarTablePane.getStyles().put("horizontalSpacing", 3);
View Full Code Here

    @SuppressWarnings("unchecked")
    private TreeNode analyseObjectTree(Object container) {
        // We don't want the RowSequence object to show up in the tree, it doesn't look neat
        if (container instanceof TablePane) {
            TreeBranch branch = new TreeBranch(nameForObject(container));
            TablePane table = (TablePane) container;
            for (TablePane.Row row : table.getRows()) {
                TreeNode childBranch = analyseObjectTree(row);
                branch.add(childBranch);
            }
            setComponentIconOnTreeNode(container, branch);
            return branch;
View Full Code Here

TOP

Related Classes of org.apache.pivot.wtk.TablePane$Column

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.