MTable

Description

MTable is a table to display a data collection.

It accepts different types of columns (Integer, Double, Date, Currency, eMail and so on).

Data :

  • can be sorted by a click action on the header of a column,
  • can be formatted
  • can be edited

A simple example

1// A MTable with some different columns
2MTable table = new MTable(container, "persons");
3table.addColumn("Name", 100, "name");
4table.addColumn("Surname", 90, "surname");
5table.addColumn("Age", 70, "age", DataType.INTEGER);
6table.addTextEditColumn("Birthday", 100, "birthDate", DataType.DATE);
7table.addTextEditColumn("Married", 100, "married", DataType.BOOLEAN);
8table.addTextEditColumn("Email", 150, "email", DataType.EMAIL);

API

  • Constructors
MTable(MonoiContainer parent) Constructs a new instance of this class given its parent container
MTable(MonoiContainer parent, String collectionDataPath) Constructs a new instance of this class given its parent container and a path of data selected
  • Methods
boolean add(Object targetData) Adds a data into MTable
void add(Object targetData, int rowIndex) Adds a data into Mtable with a specific row
void addCheckBoxColumn(String title, int width, String dataPath) Adds a new CheckBox column in the table with a specified configuration who has the title ,the width and the dataPath
void addColumn(ColumnConfig config) Adds a new column in the table with a configuration given
void addColumn(String title, int width, String dataPath) Adds a new column in the table with a specified configuration who has the title,the width and the dataPath
void addColumn(String title, int width, String dataPath, Alignment align) Adds a new column in the table with a specified configuration who has the title , the width,the dataPath and the alignment
void addColumn(String title, int width, String dataPath, Alignment align, DataType defaultDataTypes) Adds a new column in the table with a specified, configuration who has the title , the width ,the dataPath, the alignment and data's type
void addColumn(String title, int width, String dataPath, DataType datatype) Adds a new column in the table with a specified configuration who has the title, the width, the dataPath and data's type
void addColumn(String title, int width, String dataPath, ImageDescriptor imageDescriptor, SelectionListener selectionListener) Adds a new column in the table with a specified configuration who has the title , the dataPath, the ImageDescriptor and the SelectionListener
void addComboColumn(String title, int width, String dataPath, Object[] values, String displayPath) Adds a new Combo column in the table with a specified, configuration who has the title , the width, the dataPath, some values and the displayPath
void addComboColumn(String title, int width, String dataPath, String[] values) Adds a new Combo column in the table with a specified, configuration who has the title , the width , the dataPath, some values
void addComboColumn(String title, int width, String dataPath, Object[] values, String displayPath, Alignment dataAlignement) Adds a new Combo column in the table with a specified, configuration who has the title , the width , the dataPath, some values ,the displayPath and the alignment
void addTextEditColumn(String title, int width, String dataPath) Adds a new TextEdit column in the table with a specified configuration who has the title, the width and the dataPath
void addTextEditColumn(String title, int width, String dataPath, Alignment align, DataType defaultDataTypes) Adds a new TextEdit column in the table with a specified configuration who has the title , the width , the dataPath,the alignment and the DataType
void addTextEditColumn(String title, int width, String dataPath, DataType defaultDataTypes) Adds a new TextEdit column in the table with a specified configuration who has the title, the width, the dataPath and the DataType
void clear() Clears the table
void deselectAll() Deselect all
MTableActionSet getActions() Gets the table's actions
Context getContext() Gets the main context
Object getData() Gets table's data
Object getData(int rowIndex) Gets the row's data with a specific row
Object getDataAt(int index) Gets an element with index
int getItemsCount() Gets the items' count
MTableModel getModel() Gets the table's model
Object getSelectedData() Gets the data selected
Object[] getSelectedDatas() Gets the datas multi-selected
int getSelectionIndex() Gets the selection's index
String getSelectionPath() Gets the selection's path
TableViewer getTableViewer() Gets the tableviewer
Table getTargetComponent() Gets the target component
Object getValue() Gets the table's valu
boolean isColumnSortable(int colIndex) True if column is sortable
void remove(Object targetData) Removes a data
void removeSelectedIItems() Removes some items selected
void replace(Object oldData, Object newData) Replaces the old data with a new data
void select(int dataRowIndex) Selects a row with index
void setActivateTableCursor( boolean activateTableCursor) Sets activateTableCursor
void setBordered(boolean border) Sets table's border
void setCollectionDataPath (String colDataPath) Sets the collectionData's path
void setCollectionDataPath (String colDataPath, boolean absolute) Sets the collectionData's path and assign the path's absoluteness
void setColumnSortable(int colIndex, boolean sortable) Sets the sort with column's index
void setContext(Context context) Sets context
void setFilterCondition(String condition) Sets the filter's condition
void setModel(MTableModel model) Sets table's model
void setRowColor(Object object, Color color) Sets row's color
void setSelectedData(Object object) Sets the selection's data
void setSelectionIndex(int index) Sets the selection's index
void setSelectionPath(String selectionPath) Sets the selection's path
void setSize(int width, int height) Sets table's size
void showDeleteMenu(boolean enabled) Show DeleteMenu
Object[][] toDataArray() Alter to data array
void updateCell(int cellRowIndex, int cellColumnIndex, Object value) Update the specific cell with a new value and refresh the table
void updateCell(int cellRowIndex, int cellColumnIndex, Object value, boolean refresh) Update the specific cell with a new value, and refresh the table if true
void updateSelectionPath(Object data) Update the selection's path
void updateTableHeight() Update the table's height
String toString() Gets the table's value in String
  • See also superclasses
    • MonoiComponent, MonoiDataComponent and MonoiCollectionComponent

MTable.jpg (32 kB) Frédéric ESNAULT, 02/27/2012 12:32 pm