diff -r 000000000000 -r 61163b28edca frameworkplugins/com.nokia.s60tools.ui/src/com/nokia/s60tools/ui/S60ToolsTableColumnData.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/frameworkplugins/com.nokia.s60tools.ui/src/com/nokia/s60tools/ui/S60ToolsTableColumnData.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,228 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +package com.nokia.s60tools.ui; + +import org.eclipse.swt.SWT; + +/** + * Defines necessary information for a single + * column. This class is used for constructing + * S60ToolsTable instance. + * @see com.nokia.s60tools.ui.S60ToolsTable + * @see com.nokia.s60tools.ui.S60ToolsViewerSorter + */ +public class S60ToolsTableColumnData { + + /** + * Column's header text. + */ + private final String columnHeader; + + /** + * Column width. + */ + private final int columnWidth; + + /** + * Column index (from zero onwards). + */ + private final int columnIndex; + + /** + * Sorting criteria for the column. + */ + private final int columnSortCriteria; + + /** + * true if we want to show item count for this column, + * and false if not (default is false). + */ + private final boolean showItemCount; + + /** + * Default column style unless otherwise defined during construction. + */ + private static final int DEFAULT_COLUMN_STYLE = SWT.LEFT; + + /** + * Column style bits. + */ + private int columnsStyle = DEFAULT_COLUMN_STYLE; + + /** + * Constructor using default sorting criteria (no sorting). + * @param columnHeader Column's header text. + * @param columnWidth Column width. + * @param columnIndex Column index (from zero onwards). + * @see com.nokia.s60tools.ui.S60ToolsViewerSorter + */ + public S60ToolsTableColumnData(String columnHeader, int columnWidth, int columnIndex) { + this.columnHeader = columnHeader; + this.columnWidth = columnWidth; + this.columnIndex = columnIndex; + this.showItemCount = false; + this.columnSortCriteria = S60ToolsViewerSorter.CRITERIA_NO_SORT; + } + + + /** + * Constructor using default sorting criteria (no sorting). + * @param columnHeader Column's header text. + * @param columnWidth Column width. + * @param columnIndex Column index (from zero onwards). + * @param showItemCount true if we want to show item count for this column, + * and false if not. + * @see com.nokia.s60tools.ui.S60ToolsViewerSorter + */ + public S60ToolsTableColumnData(String columnHeader, int columnWidth, int columnIndex, + boolean showItemCount) { + this.columnHeader = columnHeader; + this.columnWidth = columnWidth; + this.columnIndex = columnIndex; + this.showItemCount = showItemCount; + this.columnSortCriteria = S60ToolsViewerSorter.CRITERIA_NO_SORT; + } + + /** + * Constructor using given sorting criteria. + * @param columnHeader Column's header text. + * @param columnWidth Column width. + * @param columnIndex Column index (from zero onwards). + * @param columnSortCriteria Sorting criteria for the column. + */ + public S60ToolsTableColumnData(String columnHeader, int columnWidth, + int columnIndex, int columnSortCriteria) { + this.columnHeader = columnHeader; + this.columnWidth = columnWidth; + this.columnIndex = columnIndex; + this.showItemCount = false; + this.columnSortCriteria = columnSortCriteria; + } + + /** + * Constructor using given sorting criteria and item count showing status. + * @param columnHeader Column's header text. + * @param columnWidth Column width. + * @param columnIndex Column index (from zero onwards). + * @param columnSortCriteria Sorting criteria for the column. + * @param showItemCount true if we want to show item count for this column, + * and false if not. + */ + public S60ToolsTableColumnData(String columnHeader, int columnWidth, + int columnIndex, int columnSortCriteria, + boolean showItemCount) { + this.columnHeader = columnHeader; + this.columnWidth = columnWidth; + this.columnIndex = columnIndex; + this.columnSortCriteria = columnSortCriteria; + this.showItemCount = showItemCount; + } + + /** + * Constructor using given sorting criteria and style bits. + * @param columnHeader Column's header text. + * @param columnWidth Column width. + * @param columnIndex Column index (from zero onwards). + * @param columnSortCriteria Sorting criteria for the column. + * @param columnsStyle Column style bits, if other than default value. + */ + public S60ToolsTableColumnData(String columnHeader, int columnWidth, + int columnIndex, int columnSortCriteria, + int columnsStyle) { + this.columnHeader = columnHeader; + this.columnWidth = columnWidth; + this.columnIndex = columnIndex; + this.columnSortCriteria = columnSortCriteria; + this.showItemCount = false; + this.columnsStyle = columnsStyle; + } + + /** + * Constructor using given sorting criteria, item count showing status, and style bits. + * @param columnHeader Column's header text. + * @param columnWidth Column width. + * @param columnIndex Column index (from zero onwards). + * @param columnSortCriteria Sorting criteria for the column. + * @param showItemCount true if we want to show item count for this column, + * and false if not. + * @param columnsStyle Column style bits, if other than default value. + */ + public S60ToolsTableColumnData(String columnHeader, int columnWidth, + int columnIndex, int columnSortCriteria, + boolean showItemCount, + int columnsStyle) { + this.columnHeader = columnHeader; + this.columnWidth = columnWidth; + this.columnIndex = columnIndex; + this.columnSortCriteria = columnSortCriteria; + this.showItemCount = showItemCount; + this.columnsStyle = columnsStyle; + } + + /** + * Gets column header. + * @return Returns the columnHeader. + */ + public String getColumnHeader() { + return columnHeader; + } + + + /** + * Gets column width. + * @return Returns the columnWidth. + */ + public int getColumnWidth() { + return columnWidth; + } + + /** + * Gets column index (from zero onwards). + * @return Returns the columnIndex. + */ + public int getColumnIndex() { + return columnIndex; + } + + /** + * Gets sorting criteria for the column. + * @return Returns the columnSortCriteria. + */ + public int getColumnSortCriteria() { + return columnSortCriteria; + } + + + /** + * Returns item count showing status. + * @return true if we want to show item count for this column, + * and false if not. + */ + public boolean isShowItemCount() { + return showItemCount; + } + + /** + * Gets style bits for the column. + * @return style bits for the column. + */ + public int getColumnsStyle() { + return columnsStyle; + } +}