diff options
author | Matti Tahvonen <matti.tahvonen@itmill.com> | 2010-07-15 15:13:33 +0000 |
---|---|---|
committer | Matti Tahvonen <matti.tahvonen@itmill.com> | 2010-07-15 15:13:33 +0000 |
commit | 948d434c4ad949bdd75062497ade27a0ab732c8b (patch) | |
tree | 13979ef1153852e8afd6c8fd036a28526005c1bd | |
parent | bd39623a20d457db1082e942555ec0dfd7110e5f (diff) | |
download | vaadin-framework-948d434c4ad949bdd75062497ade27a0ab732c8b.tar.gz vaadin-framework-948d434c4ad949bdd75062497ade27a0ab732c8b.zip |
formatted the source file
svn changeset:14209/svn branch:6.4
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java | 130 |
1 files changed, 68 insertions, 62 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java index 8aa9be6a24..6957c5c6b8 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java @@ -485,14 +485,13 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, } // 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); } @@ -752,8 +751,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, 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 { @@ -774,9 +773,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, } 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()) { @@ -1799,8 +1797,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, .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); } @@ -1832,8 +1830,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, 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, true); } } @@ -2019,7 +2017,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, // 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 @@ -2306,15 +2305,13 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, 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; } @@ -2324,13 +2321,11 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, 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; } @@ -2437,8 +2432,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, 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); @@ -2710,8 +2705,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, 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, true); } } @@ -2745,7 +2740,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, // 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 @@ -3254,8 +3250,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, 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); } @@ -3706,8 +3702,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, 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 { @@ -3740,13 +3736,14 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, // 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)); } } @@ -4121,8 +4118,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, 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; @@ -4521,7 +4518,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, 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; @@ -4836,10 +4834,12 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, + 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; @@ -4864,7 +4864,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, // 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()) { @@ -4880,7 +4881,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, // 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()) { @@ -4895,13 +4897,15 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, 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; } @@ -4928,7 +4932,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, 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(); @@ -4950,7 +4955,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, 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(); @@ -5013,9 +5019,9 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, */ 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(); } @@ -5041,9 +5047,9 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, */ 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(); } |