import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.dom.client.NodeList;
import com.google.gwt.dom.client.Style;
-import com.google.gwt.dom.client.TableCellElement;
-import com.google.gwt.dom.client.TableRowElement;
-import com.google.gwt.dom.client.TableSectionElement;
import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.dom.client.Style.Visibility;
+import com.google.gwt.dom.client.TableCellElement;
+import com.google.gwt.dom.client.TableRowElement;
+import com.google.gwt.dom.client.TableSectionElement;
import com.google.gwt.event.dom.client.BlurEvent;
import com.google.gwt.event.dom.client.BlurHandler;
import com.google.gwt.event.dom.client.FocusEvent;
}
// Send the selected row ranges
- client.updateVariable(paintableId, "selectedRanges", ranges
- .toArray(new String[selectedRowRanges.size()]), false);
+ client.updateVariable(paintableId, "selectedRanges",
+ ranges.toArray(new String[selectedRowRanges.size()]), false);
}
// Send the selected rows
- client.updateVariable(paintableId, "selected", selectedRowKeys
- .toArray(new String[selectedRowKeys.size()]), immediate);
+ client.updateVariable(paintableId, "selected",
+ selectedRowKeys.toArray(new String[selectedRowKeys.size()]),
+ immediate);
}
updateFooter(uidl.getStringArrayAttribute("vcolorder"));
if (!recalcWidths && initializedAndAttached) {
- updateBody(rowData, uidl.getIntAttribute("firstrow"), uidl
- .getIntAttribute("rows"));
+ updateBody(rowData, uidl.getIntAttribute("firstrow"),
+ uidl.getIntAttribute("rows"));
if (headerChangedDuringUpdate) {
lazyAdjustColumnWidths.schedule(1);
} else {
}
scrollBody = createScrollBody();
- scrollBody.renderInitialRows(rowData, uidl
- .getIntAttribute("firstrow"), uidl.getIntAttribute("rows"));
+ scrollBody.renderInitialRows(rowData,
+ uidl.getIntAttribute("firstrow"),
+ uidl.getIntAttribute("rows"));
scrollBodyPanel.add(scrollBody);
initialContentReceived = true;
if (isAttached()) {
scrollBody.reLayoutComponents();
}
- updatePageLength();
+ if (enabled && isVisible()) {
+ updatePageLength();
+ }
/*
* Fix "natural" height if height is not set. This must be after width
.getChild(floatingCopyOfHeaderCell, 1);
DOM.setElementProperty(floatingCopyOfHeaderCell, "className",
CLASSNAME + "-header-drag");
- updateFloatingCopysPosition(DOM.getAbsoluteLeft(td), DOM
- .getAbsoluteTop(td));
+ updateFloatingCopysPosition(DOM.getAbsoluteLeft(td),
+ DOM.getAbsoluteTop(td));
DOM.appendChild(RootPanel.get().getElement(),
floatingCopyOfHeaderCell);
}
if (client.hasEventListeners(VScrollTable.this,
HEADER_CLICK_EVENT_ID)) {
MouseEventDetails details = new MouseEventDetails(event);
- client.updateVariable(paintableId, "headerClickEvent", details
- .toString(), false);
+ client.updateVariable(paintableId, "headerClickEvent",
+ details.toString(), false);
client.updateVariable(paintableId, "headerClickCID", cid,
immediate);
}
// cols)
final int hw = ((Element) getElement().getLastChild())
- .getOffsetWidth()
- + scrollBody.getCellExtraWidth();
+ .getOffsetWidth() + scrollBody.getCellExtraWidth();
if (columnIndex < 0) {
columnIndex = 0;
for (Iterator<Widget> it = tHead.iterator(); it
private void focusSlot(int index) {
removeSlotFocus();
if (index > 0) {
- DOM.setElementProperty(DOM.getFirstChild(DOM.getChild(tr,
- index - 1)), "className", CLASSNAME + "-resizer "
- + CLASSNAME + "-focus-slot-right");
+ DOM.setElementProperty(
+ DOM.getFirstChild(DOM.getChild(tr, index - 1)),
+ "className", CLASSNAME + "-resizer " + CLASSNAME
+ + "-focus-slot-right");
} else {
- DOM.setElementProperty(DOM.getFirstChild(DOM
- .getChild(tr, index)), "className", CLASSNAME
- + "-resizer " + CLASSNAME + "-focus-slot-left");
+ DOM.setElementProperty(
+ DOM.getFirstChild(DOM.getChild(tr, index)),
+ "className", CLASSNAME + "-resizer " + CLASSNAME
+ + "-focus-slot-left");
}
focusedSlot = index;
}
return;
}
if (focusedSlot == 0) {
- DOM.setElementProperty(DOM.getFirstChild(DOM.getChild(tr,
- focusedSlot)), "className", CLASSNAME + "-resizer");
+ DOM.setElementProperty(
+ DOM.getFirstChild(DOM.getChild(tr, focusedSlot)),
+ "className", CLASSNAME + "-resizer");
} else if (focusedSlot > 0) {
- DOM.setElementProperty(DOM.getFirstChild(DOM.getChild(tr,
- focusedSlot - 1)), "className", CLASSNAME + "-resizer");
+ DOM.setElementProperty(
+ DOM.getFirstChild(DOM.getChild(tr, focusedSlot - 1)),
+ "className", CLASSNAME + "-resizer");
}
focusedSlot = -1;
}
for (int i = 0; i < cols.length; i++) {
final String cid = (String) cols[i];
final HeaderCell c = getHeaderCell(cid);
- final VisibleColumnAction a = new VisibleColumnAction(c
- .getColKey());
+ final VisibleColumnAction a = new VisibleColumnAction(
+ c.getColKey());
a.setCaption(c.getCaption());
if (!c.isEnabled()) {
a.setCollapsed(true);
if (client.hasEventListeners(VScrollTable.this,
FOOTER_CLICK_EVENT_ID)) {
MouseEventDetails details = new MouseEventDetails(event);
- client.updateVariable(paintableId, "footerClickEvent", details
- .toString(), false);
+ client.updateVariable(paintableId, "footerClickEvent",
+ details.toString(), false);
client.updateVariable(paintableId, "footerClickCID", cid,
immediate);
}
// cols)
final int hw = ((Element) getElement().getLastChild())
- .getOffsetWidth()
- + scrollBody.getCellExtraWidth();
+ .getOffsetWidth() + scrollBody.getCellExtraWidth();
if (columnIndex < 0) {
columnIndex = 0;
for (Iterator<Widget> it = tHead.iterator(); it
if (row.isSelected()) {
row.addStyleName("v-selected");
}
- tBodyElement.insertBefore(row.getElement(), tBodyElement
- .getFirstChild());
+ tBodyElement.insertBefore(row.getElement(),
+ tBodyElement.getFirstChild());
adopt(row);
renderedRows.add(0, row);
}
public boolean remove(Widget w) {
if (childWidgets.contains(w)) {
orphan(w);
- DOM.removeChild(DOM.getParent(w.getElement()), w
- .getElement());
+ DOM.removeChild(DOM.getParent(w.getElement()),
+ w.getElement());
childWidgets.remove(w);
return true;
} else {
// select event, even though nullselectionallowed wont let
// the change trough. Will need to be updated if that is
// changed.
- client
- .updateVariable(
- paintableId,
- "clickEvent",
- details.toString(),
- !(event.getButton() == Event.BUTTON_LEFT
- && !doubleClick
- && selectMode > Table.SELECT_MODE_NONE && immediate));
+ client.updateVariable(
+ paintableId,
+ "clickEvent",
+ details.toString(),
+ !(event.getButton() == Event.BUTTON_LEFT
+ && !doubleClick
+ && selectMode > Table.SELECT_MODE_NONE && immediate));
}
}
final Action[] actions = new Action[actionKeys.length];
for (int i = 0; i < actions.length; i++) {
final String actionKey = actionKeys[i];
- final TreeAction a = new TreeAction(this, String
- .valueOf(rowKey), actionKey);
+ final TreeAction a = new TreeAction(this,
+ String.valueOf(rowKey), actionKey);
a.setCaption(getActionCaption(actionKey));
a.setIconUrl(getActionIcon(actionKey));
actions[i] = a;
this.height = height;
super.setHeight(height);
setContainerHeight();
- if (initializedAndAttached) {
+ if (initializedAndAttached && isVisible() && enabled) {
updatePageLength();
}
if (!rendering) {
String s = uidl.getStringAttribute("caption");
if (uidl.hasAttribute("icon")) {
s = "<img src=\""
- + client
- .translateVaadinUri(uidl.getStringAttribute("icon"))
+ + client.translateVaadinUri(uidl.getStringAttribute("icon"))
+ "\" alt=\"icon\" class=\"v-icon\">" + s;
}
return s;
+ scrollBodyPanel.getElement().getOffsetHeight();
if (rowTop > scrollBottom - focusedRow.getOffsetHeight()) {
scrollBodyPanel.setScrollPosition(scrollBodyPanel
- .getScrollPosition()
- + focusedRow.getOffsetHeight());
+ .getScrollPosition() + focusedRow.getOffsetHeight());
} else if (rowTop < scrollTop) {
scrollBodyPanel.setScrollPosition(scrollBodyPanel
- .getScrollPosition()
- - focusedRow.getOffsetHeight());
+ .getScrollPosition() - focusedRow.getOffsetHeight());
}
return true;
// Down navigation
if (selectMode == SELECT_MODE_NONE && keycode == getNavigationDownKey()) {
scrollBodyPanel.setScrollPosition(scrollBodyPanel
- .getScrollPosition()
- + scrollingVelocity);
+ .getScrollPosition() + scrollingVelocity);
return true;
} else if (keycode == getNavigationDownKey()) {
if (selectMode == SELECT_MODE_MULTI && moveFocusDown()) {
// Up navigation
if (selectMode == SELECT_MODE_NONE && keycode == getNavigationUpKey()) {
scrollBodyPanel.setScrollPosition(scrollBodyPanel
- .getScrollPosition()
- - scrollingVelocity);
+ .getScrollPosition() - scrollingVelocity);
return true;
} else if (keycode == getNavigationUpKey()) {
if (selectMode == SELECT_MODE_MULTI && moveFocusUp()) {
if (keycode == getNavigationLeftKey()) {
// Left navigation
scrollBodyPanel.setHorizontalScrollPosition(scrollBodyPanel
- .getHorizontalScrollPosition()
- - scrollingVelocity);
+ .getHorizontalScrollPosition() - scrollingVelocity);
return true;
} else if (keycode == getNavigationRightKey()) {
// Right navigation
scrollBodyPanel.setHorizontalScrollPosition(scrollBodyPanel
- .getHorizontalScrollPosition()
- + scrollingVelocity);
+ .getHorizontalScrollPosition() + scrollingVelocity);
return true;
}
int rowHeight = (int) scrollBody.getRowHeight();
int offset = pageLength * rowHeight - rowHeight;
scrollBodyPanel.setScrollPosition(scrollBodyPanel
- .getScrollPosition()
- + offset);
+ .getScrollPosition() + offset);
if (selectMode > SELECT_MODE_NONE) {
if (!moveFocusDown(pageLength - 2)) {
final int lastRendered = scrollBody.getLastRendered();
int rowHeight = (int) scrollBody.getRowHeight();
int offset = pageLength * rowHeight - rowHeight;
scrollBodyPanel.setScrollPosition(scrollBodyPanel
- .getScrollPosition()
- - offset);
+ .getScrollPosition() - offset);
if (selectMode > SELECT_MODE_NONE) {
if (!moveFocusUp(pageLength - 2)) {
final int firstRendered = scrollBody.getFirstRendered();
*/
public void onKeyPress(KeyPressEvent event) {
if (hasFocus) {
- if (handleNavigation(event.getNativeEvent().getKeyCode(), event
- .isControlKeyDown()
- || event.isMetaKeyDown(), event.isShiftKeyDown())) {
+ if (handleNavigation(event.getNativeEvent().getKeyCode(),
+ event.isControlKeyDown() || event.isMetaKeyDown(),
+ event.isShiftKeyDown())) {
event.preventDefault();
}
*/
public void onKeyDown(KeyDownEvent event) {
if (hasFocus) {
- if (handleNavigation(event.getNativeEvent().getKeyCode(), event
- .isControlKeyDown()
- || event.isMetaKeyDown(), event.isShiftKeyDown())) {
+ if (handleNavigation(event.getNativeEvent().getKeyCode(),
+ event.isControlKeyDown() || event.isMetaKeyDown(),
+ event.isShiftKeyDown())) {
event.preventDefault();
}