All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.thesett.text.api.model.TextTableModel Maven / Gradle / Ivy

There is a newer version: 0.9.117
Show newest version
/*
 * Copyright The Sett Ltd, 2005 to 2014.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.thesett.text.api.model;

import java.util.Map;

import com.thesett.common.util.doublemaps.DoubleKeyedMap;
import com.thesett.text.api.TextTableListener;

/**
 * TextTableModel is a {@link TextGridModel} that additionally divides its grid area into addressable rows and columns.
 *
 * 

* * * * * *
CRC Card
Responsibilities Collaborations *
Add or remove strings to table cells.
Provide the table size.
Monitor maximum text width of columns.
Provide ability to register listeners for changes to the table.
Allow table columns and rows to be labelled.
* * @author Rupert Smith */ public interface TextTableModel extends DoubleKeyedMap { /** * Provides the count of the number of rows in the table. * * @return The count of the number of rows in the table. */ int getRowCount(); /** * Provides the count of the number of columns in the table. * * @return The count of the number of columns in the table. */ int getColumnCount(); /** * Provides the maximum width of the specified column. * * @param col The column offset to get. * * @return The maximum column width. */ int getMaxColumnSize(int col); /** * Adds a listener for updates to this model. * * @param listener The listener for updates to this model. */ void addTextTableListener(TextTableListener listener); /** * Removes a listener for updates to this model. * * @param listener The listener to remove. */ void removeTextTableListener(TextTableListener listener); /** * Applies a label to a whole column. * * @param label The label to apply. * @param column The column to use the label with. */ void labelColumn(String label, int column); /** * Applies a label to a whole row. * * @param label The label to apply. * @param row The row to use the label with. */ void labelRow(String label, int row); /** * Applies a label to an individual cell. * * @param label The label to apply. * @param col The column of the cell to label. * @param row The row of the cell to label. */ void labelCell(String label, int col, int row); /** * Provides a view onto this table, where the columns are labelled instead of referred to by offset. * * @return A view onto this table, where the columns are labelled. */ DoubleKeyedMap withColumnLabels(); /** * Provides a view onto this table, where the rows are labelled instead of referred to by offset. * * @return A view onto this table, where the rows are labelled. */ DoubleKeyedMap withRowLabels(); /** * Provides a view onto this table, where the rows and columns are labelled instead of referred to by offsets. * * @return A view onto this table, where the rows and columns are labelled. */ DoubleKeyedMap withLabels(); /** * Provides a view onto this table, where individual cells are labelled instead of referred to by offsets. * * @return A view onto this table, where the individual cells are labelled. */ Map withCellLabels(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy