import com.google.gwt.dom.client.NodeList;
import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.Display;
+import com.google.gwt.dom.client.Style.Overflow;
import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.dom.client.Style.Visibility;
.removeStyleName(getStylePrimaryName() + "-body-wrapper");
scrollBodyPanel.removeStyleName(getStylePrimaryName() + "-body");
+ if (scrollBody != null) {
+ scrollBody.removeStyleName(getStylePrimaryName()
+ + "-body-noselection");
+ }
+
super.setStyleName(style);
scrollBodyPanel.addStyleName(getStylePrimaryName() + "-body-wrapper");
tHead.updateStyleNames(getStylePrimaryName());
tFoot.updateStyleNames(getStylePrimaryName());
+
+ if (scrollBody != null) {
+ scrollBody.updateStyleNames(getStylePrimaryName());
+ }
}
void sizeInit() {
sizeNeedsInit = false;
- // Ensure stylenames are set
- setStyleName(getStyleName());
-
scrollBody.setContainerHeight();
/*
setText(headerText);
- DOM.appendChild(td, colResizeWidget);
+ td.appendChild(colResizeWidget);
// ensure no clipping initially (problem on column additions)
- DOM.setStyleAttribute(captionContainer, "overflow", "visible");
+ captionContainer.getStyle().setOverflow(Overflow.VISIBLE);
- DOM.appendChild(td, captionContainer);
+ td.appendChild(sortIndicator);
+ td.appendChild(captionContainer);
DOM.sinkEvents(td, Event.MOUSEEVENTS | Event.ONDBLCLICK
| Event.ONCONTEXTMENU | Event.TOUCHEVENTS);
protected void updateStyleNames(String primaryStyleName) {
colResizeWidget.setClassName(primaryStyleName + "-resizer");
sortIndicator.setClassName(primaryStyleName + "-sort-indicator");
- captionContainer.setClassName(primaryStyleName + "-sort-indicator");
+ captionContainer.setClassName(primaryStyleName
+ + "-caption-container");
if (sorted) {
if (sortAscending) {
setStyleName(primaryStyleName + "-header-cell-asc");
captionContainer.removeClassName(ALIGN_PREFIX + "center");
captionContainer.removeClassName(ALIGN_PREFIX + "right");
captionContainer.removeClassName(ALIGN_PREFIX + "left");
+
switch (align) {
case ALIGN_CENTER:
captionContainer.addClassName(ALIGN_PREFIX + "center");
break;
default:
captionContainer.addClassName(ALIGN_PREFIX + "left");
- break;
+ break;
}
+
}
public void disableAutoWidthCalculation() {
}
public void setAlign(char c) {
- align = c;
updateStyleNames(VScrollTable.this.getStylePrimaryName());
+ align = c;
}
public char getAlign() {
RowHeadersHeaderCell() {
super(ROW_HEADER_COLUMN_KEY, "");
+ updateStyleNames(VScrollTable.this.getStylePrimaryName());
}
@Override
availableCells.put(ROW_HEADER_COLUMN_KEY,
new RowHeadersHeaderCell());
-
- updateStyleNames(VScrollTable.this.getStylePrimaryName());
}
protected void updateStyleNames(String primaryStyleName) {
if (rows.getLength() == 0) {
/* need to temporary add empty row and detect */
VScrollTableRow scrollTableRow = new VScrollTableRow();
+ scrollTableRow.updateStyleNames(VScrollTable.this
+ .getStylePrimaryName());
tBodyElement.appendChild(scrollTableRow.getElement());
detectExtrawidth();
tBodyElement.removeChild(scrollTableRow.getElement());
private TooltipInfo tooltipInfo = null;
private Map<TableCellElement, TooltipInfo> cellToolTips = new HashMap<TableCellElement, TooltipInfo>();
private boolean isDragging = false;
+ private String rowStyle = null;
private VScrollTableRow(int rowKey) {
this.rowKey = rowKey;
*/
getElement().getStyle().setProperty("visibility", "hidden");
- String rowStyle = uidl.getStringAttribute("rowstyle");
- if (rowStyle != null) {
- addStyleName(VScrollTable.this.getStylePrimaryName()
- + "-row-" + rowStyle);
- }
+ rowStyle = uidl.getStringAttribute("rowstyle");
+ updateStyleNames(VScrollTable.this.getStylePrimaryName());
String rowDescription = uidl.getStringAttribute("rowdescr");
if (rowDescription != null && !rowDescription.equals("")) {
}
protected void updateStyleNames(String primaryStyleName) {
+ setStyleName(primaryStyleName + "-row");
+ if (rowStyle != null) {
+ addStyleName(primaryStyleName + "-row-" + rowStyle);
+ }
+ for (int i = 0; i < rowElement.getChildCount(); i++) {
+ TableCellElement cell = (TableCellElement) rowElement
+ .getChild(i);
+ updateCellStyleNames(cell, primaryStyleName);
+ }
}
public TooltipInfo getTooltipInfo() {
*/
public VScrollTableRow() {
this(0);
- addStyleName(VScrollTable.this.getStylePrimaryName() + "-row");
addCell(null, "_", 'b', "", true, false);
}
String style, boolean textIsHTML, boolean sorted,
String description, final TableCellElement td) {
final Element container = DOM.createDiv();
- String className = VScrollTable.this.getStylePrimaryName()
- + "-cell-content";
+ container.setClassName(VScrollTable.this.getStylePrimaryName()
+ + "-cell-wrapper");
+
+ td.setClassName(VScrollTable.this.getStylePrimaryName()
+ + "-cell-content");
+
if (style != null && !style.equals("")) {
- className += " " + VScrollTable.this.getStylePrimaryName()
- + "-cell-content-" + style;
+ td.addClassName(VScrollTable.this.getStylePrimaryName()
+ + "-cell-content-" + style);
}
+
if (sorted) {
- className += " " + VScrollTable.this.getStylePrimaryName()
- + "-cell-content-sorted";
+ td.addClassName(VScrollTable.this.getStylePrimaryName()
+ + "-cell-content-sorted");
}
- td.setClassName(className);
- container.setClassName(VScrollTable.this.getStylePrimaryName()
- + "-cell-wrapper");
+
if (textIsHTML) {
container.setInnerHTML(text);
} else {
getElement().appendChild(td);
}
+ protected void updateCellStyleNames(TableCellElement td,
+ String primaryStyleName) {
+ Element container = td.getFirstChild().cast();
+ container.setClassName(primaryStyleName + "-cell-wrapper");
+
+ /*
+ * Replace old primary style name with new one
+ */
+ String className = td.getClassName();
+ String oldPrimaryName = className.split("-cell-content")[0];
+ td.setClassName(className.replaceAll(oldPrimaryName,
+ primaryStyleName));
+ }
+
public void addCell(UIDL rowUidl, Widget w, char align,
String style, boolean sorted) {
final TableCellElement td = DOM.createTD().cast();