MULTIROW
}
- private static final int CELL_KEY = 0;
+ protected static final int CELL_KEY = 0;
- private static final int CELL_HEADER = 1;
+ protected static final int CELL_HEADER = 1;
- private static final int CELL_ICON = 2;
+ protected static final int CELL_ICON = 2;
- private static final int CELL_ITEMID = 3;
+ protected static final int CELL_ITEMID = 3;
- private static final int CELL_FIRSTCOL = 4;
+ protected static final int CELL_FIRSTCOL = 4;
/**
* Left column alignment. <b>This is the default behaviour. </b>
private MultiSelectMode multiSelectMode = MultiSelectMode.DEFAULT;
private HeaderClickHandler headerClickHandler;
-
+
private FooterClickHandler footerClickHandler;
/* Table constructors */
final int pagelen = getPageLength();
final int colHeadMode = getColumnHeaderMode();
final boolean colheads = colHeadMode != COLUMN_HEADER_MODE_HIDDEN;
- final boolean rowheads = getRowHeaderMode() != ROW_HEADER_MODE_HIDDEN;
final Object[][] cells = getVisibleCells();
final boolean iseditable = isEditable();
int rows;
if (colheads) {
target.addAttribute("colheaders", true);
}
- if (rowheads) {
+ if (getRowHeaderMode() != ROW_HEADER_MODE_HIDDEN) {
target.addAttribute("rowheaders", true);
}
if (columnFootersVisible) {
continue;
}
- paintRow(target, rowheads, cells, iseditable, actionSet,
- iscomponent, indexInRowbuffer, itemId);
+ paintRow(target, cells, iseditable, actionSet, iscomponent,
+ indexInRowbuffer, itemId);
}
target.endTag("rows");
}
}
- private void paintRow(PaintTarget target, final boolean rowheads,
- final Object[][] cells, final boolean iseditable,
- final Set<Action> actionSet, final boolean[] iscomponent,
- int indexInRowbuffer, final Object itemId) throws PaintException {
+ private void paintRow(PaintTarget target, final Object[][] cells,
+ final boolean iseditable, final Set<Action> actionSet,
+ final boolean[] iscomponent, int indexInRowbuffer,
+ final Object itemId) throws PaintException {
target.startTag("tr");
- renderRowAttributes(target, rowheads, cells, actionSet,
- indexInRowbuffer, itemId);
+ paintRowAttributes(target, cells, actionSet, indexInRowbuffer, itemId);
// cells
int currentColumn = 0;
target.endTag("tr");
}
- private void renderRowAttributes(PaintTarget target,
- final boolean rowheads, final Object[][] cells,
+ private void paintRowAttributes(PaintTarget target, final Object[][] cells,
final Set<Action> actionSet, int indexInRowbuffer,
final Object itemId) throws PaintException {
// tr attributes
- if (rowheads) {
- if (cells[CELL_ICON][indexInRowbuffer] != null) {
- target.addAttribute("icon",
- (Resource) cells[CELL_ICON][indexInRowbuffer]);
- }
- if (cells[CELL_HEADER][indexInRowbuffer] != null) {
- target.addAttribute("caption",
- (String) cells[CELL_HEADER][indexInRowbuffer]);
- }
- }
+
+ paintRowIcon(target, cells, indexInRowbuffer);
+ paintRowHeader(target, cells, indexInRowbuffer);
target.addAttribute("key", Integer
.parseInt(cells[CELL_KEY][indexInRowbuffer].toString()));
target.addAttribute("rowstyle", rowStyle);
}
}
- renderRowAttributes(target, itemId);
+ paintRowAttributes(target, itemId);
+ }
+
+ protected void paintRowHeader(PaintTarget target, Object[][] cells,
+ int indexInRowbuffer) throws PaintException {
+ if (getRowHeaderMode() != ROW_HEADER_MODE_HIDDEN) {
+ if (cells[CELL_HEADER][indexInRowbuffer] != null) {
+ target.addAttribute("caption",
+ (String) cells[CELL_HEADER][indexInRowbuffer]);
+ }
+ }
+
+ }
+
+ protected void paintRowIcon(PaintTarget target, final Object[][] cells,
+ int indexInRowbuffer) throws PaintException {
+ if (getRowHeaderMode() != ROW_HEADER_MODE_HIDDEN
+ && cells[CELL_ICON][indexInRowbuffer] != null) {
+ target.addAttribute("icon",
+ (Resource) cells[CELL_ICON][indexInRowbuffer]);
+ }
}
/**
* @param target
* @param itemId
*/
- protected void renderRowAttributes(PaintTarget target, Object itemId)
+ protected void paintRowAttributes(PaintTarget target, Object itemId)
throws PaintException {
}
/**
* Gets the property id of the column which header was pressed
- *
+ *
* @return The column propety id
*/
public Object getPropertyId() {
/**
* Returns the details of the mouse event like the mouse coordinates,
* button pressed etc.
- *
+ *
* @return The mouse details
*/
public MouseEventDetails getEventDetails() {
return details;
}
}
-
+
/**
* Click event fired when clicking on the Table footers. The event includes
* a reference the the Table the event originated from, the property id of
*/
public static class FooterClickEvent extends Component.Event {
public static final Method FOOTER_CLICK_METHOD;
-
+
static {
try {
// Set the header click method
throw new java.lang.RuntimeException();
}
}
-
+
// The property id of the column which header was pressed
private Object columnPropertyId;
-
+
// The mouse details
private MouseEventDetails details;
-
+
/**
* Constructor
+ *
* @param source
- * The source of the component
+ * The source of the component
* @param propertyId
- * The propertyId of the column
+ * The propertyId of the column
* @param details
- * The mouse details of the click
+ * The mouse details of the click
*/
public FooterClickEvent(Component source, Object propertyId,
MouseEventDetails details) {
super(source);
columnPropertyId = propertyId;
- this.details = details;
+ this.details = details;
}
-
+
/**
* Gets the property id of the column which header was pressed
- *
+ *
* @return The column propety id
*/
public Object getPropertyId() {
/**
* Returns the details of the mouse event like the mouse coordinates,
* button pressed etc.
- *
+ *
* @return The mouse details
*/
public MouseEventDetails getEventDetails() {
/**
* Called when a user clicks a header column cell
- *
+ *
* @param event
* The event which contains information about the column and
* the mouse click event
* column cell.
*/
public interface FooterClickHandler {
-
+
/**
* Called when a user clicks a footer column cell
*
* The handler will receive events which contains information about which
* column was clicked and some details about the mouse event.
* </p>
- *
+ *
* @param handler
* The handler which should handle the header click events.
*/
/**
* Returns the header click handler which receives click events from the
* columns header cells when they are clicked on.
- *
+ *
* @return
*/
public HeaderClickHandler getHeaderClickHandler() {
/**
* Gets the footer caption beneath the rows
- *
+ *
* @param propertyId
* The propertyId of the column *
* @return The caption of the footer or NULL if not set
/**
* Sets the column footer caption. The column footer caption is the text
* displayed beneath the column if footers have been set visible.
- *
+ *
* @param propertyId
* The properyId of the column
- *
+ *
* @param footer
* The caption of the footer
*/
* The footer can be used to add column related data like sums to the bottom
* of the Table using setColumnFooter(Object propertyId, String footer).
* </p>
- *
+ *
* @param visible
* Should the footer be visible
*/
- public void setFooterVisible(boolean visible){
+ public void setFooterVisible(boolean visible) {
columnFootersVisible = visible;
// Assures the visual refresh
/**
* Is the footer currently visible?
- *
+ *
* @return Returns true if visible else false
*/
public boolean isFooterVisible() {