* target.
*/
if (cellStyleGenerator != null) {
- String cellStyle = cellStyleGenerator
- .getStyle(itemId, columnId);
+ String cellStyle = cellStyleGenerator.getStyle(this, itemId,
+ columnId);
if (cellStyle != null && !cellStyle.equals("")) {
target.addAttribute("style-" + columnIdMap.key(columnId),
cellStyle);
* to the target.
*/
if (cellStyleGenerator != null) {
- String rowStyle = cellStyleGenerator.getStyle(itemId, null);
+ String rowStyle = cellStyleGenerator.getStyle(this, itemId, null);
if (rowStyle != null && !rowStyle.equals("")) {
target.addAttribute("rowstyle", rowStyle);
}
/**
* Called by Table when a cell (and row) is painted.
*
+ * @param source
+ * the source Table
* @param itemId
* The itemId of the painted cell
* @param propertyId
* name will be v-table-cell-content-[style name], or
* v-table-row-[style name] for rows)
*/
- public abstract String getStyle(Object itemId, Object propertyId);
+ public abstract String getStyle(Table source, Object itemId,
+ Object propertyId);
}
@Override
}
if (itemStyleGenerator != null) {
- String stylename = itemStyleGenerator.getStyle(itemId);
+ String stylename = itemStyleGenerator
+ .getStyle(this, itemId);
if (stylename != null) {
target.addAttribute(TreeConstants.ATTRIBUTE_NODE_STYLE,
stylename);
/**
* Called by Tree when an item is painted.
*
+ * @param source
+ * the source Tree
* @param itemId
* The itemId of the item to be painted
* @return The style name to add to this item. (the CSS class name will
* be v-tree-node-[style name]
*/
- public abstract String getStyle(Object itemId);
+ public abstract String getStyle(Tree source, Object itemId);
}
// Overriden so javadoc comes from Container.Hierarchical
import com.vaadin.ui.Embedded;
import com.vaadin.ui.HorizontalSplitPanel;
import com.vaadin.ui.Label;
-import com.vaadin.ui.UI.LegacyWindow;
import com.vaadin.ui.Tree;
import com.vaadin.ui.Tree.ItemStyleGenerator;
+import com.vaadin.ui.UI.LegacyWindow;
import com.vaadin.ui.VerticalLayout;
public class Components extends Application.LegacyApplication {
naviTree.setItemStyleGenerator(new ItemStyleGenerator() {
@Override
- public String getStyle(Object itemId) {
+ public String getStyle(Tree source, Object itemId) {
Class<?> cls = (Class<?>) itemId;
if (!isAbstract(cls)) {
return "blue";
CellStyleGenerator g = new CellStyleGenerator() {
@Override
- public String getStyle(Object itemId, Object propertyId) {
+ public String getStyle(Table source, Object itemId,
+ Object propertyId) {
if (propertyId != null && propertyId.equals("red")) {
return "red";
} else if (itemId.equals("blue") && propertyId == null) {
c.setCellStyleGenerator(new CellStyleGenerator() {
@Override
- public String getStyle(Object itemId, Object propertyId) {
+ public String getStyle(Table source, Object itemId,
+ Object propertyId) {
if (cellStyleInfo.appliesTo(itemId, propertyId)) {
return cellStyleInfo.styleName;
}
tree.setItemStyleGenerator(new Tree.ItemStyleGenerator() {
@Override
- public String getStyle(Object itemId) {
+ public String getStyle(Tree source, Object itemId) {
// simple return itemId as css style name
return itemId.toString();
}
private ItemStyleGenerator rootGreenSecondLevelRed = new com.vaadin.ui.Tree.ItemStyleGenerator() {
@Override
- public String getStyle(Object itemId) {
+ public String getStyle(Tree source, Object itemId) {
Hierarchical c = (Container.Hierarchical) getComponent()
.getContainerDataSource();
if (c.isRoot(itemId)) {
private ItemStyleGenerator evenItemsBold = new com.vaadin.ui.Tree.ItemStyleGenerator() {
@Override
- public String getStyle(Object itemId) {
+ public String getStyle(Tree source, Object itemId) {
Hierarchical c = (Container.Hierarchical) getComponent()
.getContainerDataSource();
int idx = 0;
import com.vaadin.data.Container.Hierarchical;
import com.vaadin.data.util.HierarchicalContainer;
import com.vaadin.tests.components.table.Tables;
+import com.vaadin.ui.Table;
import com.vaadin.ui.Table.CellStyleGenerator;
import com.vaadin.ui.Tree.CollapseEvent;
import com.vaadin.ui.Tree.CollapseListener;
private CellStyleGenerator rootGreenSecondLevelRed = new com.vaadin.ui.Table.CellStyleGenerator() {
@Override
- public String getStyle(Object itemId, Object propertyId) {
+ public String getStyle(Table source, Object itemId, Object propertyId) {
if (propertyId != null) {
return null;
}
private CellStyleGenerator evenItemsBold = new CellStyleGenerator() {
@Override
- public String getStyle(Object itemId, Object propertyId) {
+ public String getStyle(Table source, Object itemId, Object propertyId) {
if (propertyId != null) {
return null;
}
import com.vaadin.event.Action.Handler;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.UI.LegacyWindow;
import com.vaadin.ui.Table;
+import com.vaadin.ui.UI.LegacyWindow;
import com.vaadin.ui.VerticalLayout;
public class Ticket1857 extends Application.LegacyApplication implements
if (cellStylesEnabler.getValue().booleanValue()) {
t.setCellStyleGenerator(new Table.CellStyleGenerator() {
@Override
- public String getStyle(Object itemId, Object propertyId) {
+ public String getStyle(Table source, Object itemId,
+ Object propertyId) {
Object cell = t.getContainerProperty(itemId,
propertyId).getValue();
if (!(cell instanceof Integer)) {
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Component;
import com.vaadin.ui.Label;
-import com.vaadin.ui.UI.LegacyWindow;
import com.vaadin.ui.Table;
import com.vaadin.ui.Table.CellStyleGenerator;
import com.vaadin.ui.Table.ColumnGenerator;
+import com.vaadin.ui.UI.LegacyWindow;
public class Ticket2125 extends Application.LegacyApplication {
});
table.setCellStyleGenerator(new CellStyleGenerator() {
@Override
- public String getStyle(Object itemId, Object propertyId) {
+ public String getStyle(Table source, Object itemId,
+ Object propertyId) {
if (new Integer(4).equals(itemId)) {
if (propertyId == null) {
return "MYROW";
import com.vaadin.data.Item;
import com.vaadin.ui.Component;
import com.vaadin.ui.Label;
-import com.vaadin.ui.UI.LegacyWindow;
import com.vaadin.ui.Table;
import com.vaadin.ui.Table.CellStyleGenerator;
import com.vaadin.ui.Table.ColumnGenerator;
+import com.vaadin.ui.UI.LegacyWindow;
public class Ticket2208 extends Application.LegacyApplication {
t.setCellStyleGenerator(new CellStyleGenerator() {
@Override
- public String getStyle(Object itemId, Object propertyId) {
+ public String getStyle(Table source, Object itemId,
+ Object propertyId) {
if ("col 1 (red)".equals(propertyId)) {
return "red";
}