}
body.clear();
+ TreeNode childTree = null;
for (final Iterator<?> i = uidl.getChildIterator(); i.hasNext();) {
final UIDL childUidl = (UIDL) i.next();
if ("actions".equals(childUidl.getTag())) {
updateDropHandler(childUidl);
continue;
}
- final TreeNode childTree = new TreeNode();
+ childTree = new TreeNode();
if (childTree.ie6compatnode != null) {
body.add(childTree);
}
if (childTree.ie6compatnode == null) {
body.add(childTree);
}
+ childTree.addStyleDependentName("root");
+ childTree.childNodeContainer.addStyleDependentName("root");
+ }
+ if (childTree != null) {
+ childTree.addStyleDependentName("last");
+ childTree.childNodeContainer.addStyleDependentName("last");
}
final String selectMode = uidl.getStringAttribute("selectmode");
selectable = !"none".equals(selectMode);
VerticalDropLocation curDetail = (VerticalDropLocation) event
.getDropDetails().get("detail");
if (curDetail == detail
- && newKey.equals(currentMouseOverKey)) {
+ && newKey
+ .equals(currentMouseOverKey)) {
keyToNode.get(newKey).emphasis(detail);
}
/*
* Sends the selection to the server
*/
private void sendSelectionToServer() {
- client.updateVariable(paintableId, "selected",
- selectedIds.toArray(new String[selectedIds.size()]), immediate);
+ client.updateVariable(paintableId, "selected", selectedIds
+ .toArray(new String[selectedIds.size()]), immediate);
selectionHasChanged = false;
}
if (selectable) {
// caption click = selection change && possible click
// event
- if (handleClickSelection(
- event.getCtrlKey() || event.getMetaKey(),
- event.getShiftKey())) {
+ if (handleClickSelection(event.getCtrlKey()
+ || event.getMetaKey(), event.getShiftKey())) {
event.preventDefault();
}
} else {
&& (type == Event.ONTOUCHSTART || event
.getButton() == NativeEvent.BUTTON_LEFT)) {
mouseDownEvent = event; // save event for possible
- // dd operation
+ // dd operation
if (type == Event.ONMOUSEDOWN) {
event.preventDefault(); // prevent text
- // selection
+ // selection
} else {
/*
* FIXME We prevent touch start event to be used
|| !selectable
|| (!isNullSelectionAllowed && isSelected() && selectedIds
.size() == 1);
- client.updateVariable(paintableId, "clickedKey", key, false);
- client.updateVariable(paintableId, "clickEvent",
- details.toString(), imm);
+ client
+ .updateVariable(paintableId, "clickedKey", key,
+ false);
+ client.updateVariable(paintableId, "clickEvent", details
+ .toString(), imm);
}
};
if (treeHasFocus) {
}
protected void constructDom() {
+ addStyleName(CLASSNAME);
// workaround for a very weird IE6 issue #1245
if (BrowserInfo.get().isIE6()) {
ie6compatnode = DOM.createDiv();
} else {
addStyleName(CLASSNAME + "-leaf");
}
- addStyleName(CLASSNAME);
if (uidl.hasAttribute("style")) {
addStyleName(CLASSNAME + "-" + uidl.getStringAttribute("style"));
Widget.setStyleName(nodeCaptionDiv, CLASSNAME + "-caption-"
if (icon == null) {
onloadHandled = false;
icon = new Icon(client);
- DOM.insertBefore(DOM.getFirstChild(nodeCaptionDiv),
- icon.getElement(), nodeCaptionSpan);
+ DOM.insertBefore(DOM.getFirstChild(nodeCaptionDiv), icon
+ .getElement(), nodeCaptionSpan);
}
icon.setUri(uidl.getStringAttribute("icon"));
} else {
if (icon != null) {
- DOM.removeChild(DOM.getFirstChild(nodeCaptionDiv),
- icon.getElement());
+ DOM.removeChild(DOM.getFirstChild(nodeCaptionDiv), icon
+ .getElement());
icon = null;
}
}
if (ie6compatnode == null) {
childNodeContainer.add(childTree);
}
+ if (!i.hasNext()) {
+ childTree.addStyleDependentName(childTree.isLeaf()
+ ? "leaf-last" : "last");
+ childTree.childNodeContainer.addStyleDependentName("last");
+ }
}
childrenLoaded = true;
}
// keypress event
keyCode = CHARCODE_SPACE;
}
- if (handleKeyNavigation(keyCode,
- event.isControlKeyDown() || event.isMetaKeyDown(),
- event.isShiftKeyDown())) {
+ if (handleKeyNavigation(keyCode, event.isControlKeyDown()
+ || event.isMetaKeyDown(), event.isShiftKeyDown())) {
event.preventDefault();
event.stopPropagation();
}
* .event.dom.client.KeyDownEvent)
*/
public void onKeyDown(KeyDownEvent event) {
- if (handleKeyNavigation(event.getNativeEvent().getKeyCode(),
- event.isControlKeyDown() || event.isMetaKeyDown(),
- event.isShiftKeyDown())) {
+ if (handleKeyNavigation(event.getNativeEvent().getKeyCode(), event
+ .isControlKeyDown()
+ || event.isMetaKeyDown(), event.isShiftKeyDown())) {
event.preventDefault();
event.stopPropagation();
}
ArrayList<Integer> positions = new ArrayList<Integer>();
while (treeNode.getParentNode() != null) {
- positions.add(0,
- treeNode.getParentNode().getChildren().indexOf(treeNode));
+ positions.add(0, treeNode.getParentNode().getChildren().indexOf(
+ treeNode));
treeNode = treeNode.getParentNode();
}
positions.add(0, getRootNodes().indexOf(treeNode));