You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

VTree.java 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. /*
  2. @ITMillApache2LicenseForJavaFiles@
  3. */
  4. package com.vaadin.terminal.gwt.client.ui;
  5. import java.util.HashMap;
  6. import java.util.HashSet;
  7. import java.util.Iterator;
  8. import java.util.Set;
  9. import com.google.gwt.dom.client.NativeEvent;
  10. import com.google.gwt.user.client.DOM;
  11. import com.google.gwt.user.client.Element;
  12. import com.google.gwt.user.client.Event;
  13. import com.google.gwt.user.client.Window;
  14. import com.google.gwt.user.client.ui.FlowPanel;
  15. import com.google.gwt.user.client.ui.SimplePanel;
  16. import com.google.gwt.user.client.ui.UIObject;
  17. import com.google.gwt.user.client.ui.Widget;
  18. import com.vaadin.terminal.gwt.client.ApplicationConnection;
  19. import com.vaadin.terminal.gwt.client.BrowserInfo;
  20. import com.vaadin.terminal.gwt.client.MouseEventDetails;
  21. import com.vaadin.terminal.gwt.client.Paintable;
  22. import com.vaadin.terminal.gwt.client.UIDL;
  23. import com.vaadin.terminal.gwt.client.Util;
  24. import com.vaadin.terminal.gwt.client.ui.dd.VAbstractDropHandler;
  25. import com.vaadin.terminal.gwt.client.ui.dd.VAcceptCallback;
  26. import com.vaadin.terminal.gwt.client.ui.dd.VDragAndDropManager;
  27. import com.vaadin.terminal.gwt.client.ui.dd.VDragEvent;
  28. import com.vaadin.terminal.gwt.client.ui.dd.VDropHandler;
  29. import com.vaadin.terminal.gwt.client.ui.dd.VHasDropHandler;
  30. import com.vaadin.terminal.gwt.client.ui.dd.VTransferable;
  31. import com.vaadin.terminal.gwt.client.ui.dd.VerticalDropLocation;
  32. /**
  33. *
  34. */
  35. public class VTree extends FlowPanel implements Paintable, VHasDropHandler {
  36. public static final String CLASSNAME = "v-tree";
  37. public static final String ITEM_CLICK_EVENT_ID = "itemClick";
  38. private Set<String> selectedIds = new HashSet<String>();
  39. private ApplicationConnection client;
  40. private String paintableId;
  41. private boolean selectable;
  42. private boolean isMultiselect;
  43. private String currentMouseOverKey;
  44. private final HashMap<String, TreeNode> keyToNode = new HashMap<String, TreeNode>();
  45. /**
  46. * This map contains captions and icon urls for actions like: * "33_c" ->
  47. * "Edit" * "33_i" -> "http://dom.com/edit.png"
  48. */
  49. private final HashMap<String, String> actionMap = new HashMap<String, String>();
  50. private boolean immediate;
  51. private boolean isNullSelectionAllowed = true;
  52. private boolean disabled = false;
  53. private boolean readonly;
  54. private boolean rendering;
  55. private int dragModes;
  56. private VAbstractDropHandler dropHandler;
  57. public VTree() {
  58. super();
  59. setStyleName(CLASSNAME);
  60. }
  61. private void updateActionMap(UIDL c) {
  62. final Iterator it = c.getChildIterator();
  63. while (it.hasNext()) {
  64. final UIDL action = (UIDL) it.next();
  65. final String key = action.getStringAttribute("key");
  66. final String caption = action.getStringAttribute("caption");
  67. actionMap.put(key + "_c", caption);
  68. if (action.hasAttribute("icon")) {
  69. // TODO need some uri handling ??
  70. actionMap.put(key + "_i", client.translateVaadinUri(action
  71. .getStringAttribute("icon")));
  72. }
  73. }
  74. }
  75. public String getActionCaption(String actionKey) {
  76. return actionMap.get(actionKey + "_c");
  77. }
  78. public String getActionIcon(String actionKey) {
  79. return actionMap.get(actionKey + "_i");
  80. }
  81. public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
  82. // Ensure correct implementation and let container manage caption
  83. if (client.updateComponent(this, uidl, true)) {
  84. return;
  85. }
  86. rendering = true;
  87. this.client = client;
  88. if (uidl.hasAttribute("partialUpdate")) {
  89. handleUpdate(uidl);
  90. rendering = false;
  91. return;
  92. }
  93. paintableId = uidl.getId();
  94. immediate = uidl.hasAttribute("immediate");
  95. disabled = uidl.getBooleanAttribute("disabled");
  96. readonly = uidl.getBooleanAttribute("readonly");
  97. isNullSelectionAllowed = uidl.getBooleanAttribute("nullselect");
  98. clear();
  99. for (final Iterator i = uidl.getChildIterator(); i.hasNext();) {
  100. final UIDL childUidl = (UIDL) i.next();
  101. if ("actions".equals(childUidl.getTag())) {
  102. updateActionMap(childUidl);
  103. continue;
  104. } else if ("-ac".equals(childUidl.getTag())) {
  105. updateDropHandler(childUidl);
  106. continue;
  107. }
  108. final TreeNode childTree = new TreeNode();
  109. if (childTree.ie6compatnode != null) {
  110. this.add(childTree);
  111. }
  112. childTree.updateFromUIDL(childUidl, client);
  113. if (childTree.ie6compatnode == null) {
  114. this.add(childTree);
  115. }
  116. }
  117. final String selectMode = uidl.getStringAttribute("selectmode");
  118. selectable = !"none".equals(selectMode);
  119. isMultiselect = "multi".equals(selectMode);
  120. selectedIds = uidl.getStringArrayVariableAsSet("selected");
  121. if (uidl.hasAttribute("dragModes")) {
  122. dragModes = uidl.getIntAttribute("dragModes");
  123. }
  124. rendering = false;
  125. }
  126. private void updateTreeRelatedDragData(VDragEvent drag) {
  127. currentMouseOverKey = findCurrentMouseOverKey(drag.getElementOver());
  128. drag.getDropDetails().put("itemIdOver", currentMouseOverKey);
  129. if (currentMouseOverKey != null) {
  130. String detail = getDropDetail(drag.getCurrentGwtEvent());
  131. Boolean overTreeNode = null;
  132. TreeNode treeNode = keyToNode.get(currentMouseOverKey);
  133. if (treeNode != null && !treeNode.isLeaf()
  134. && "MIDDLE".equals(detail)) {
  135. overTreeNode = true;
  136. }
  137. drag.getDropDetails().put("itemIdOverIsNode", overTreeNode);
  138. drag.getDropDetails().put("detail", detail);
  139. }
  140. }
  141. private String findCurrentMouseOverKey(Element elementOver) {
  142. TreeNode treeNode = Util.findWidget(elementOver, TreeNode.class);
  143. return treeNode == null ? null : treeNode.key;
  144. }
  145. private void updateDropHandler(UIDL childUidl) {
  146. if (dropHandler == null) {
  147. dropHandler = new VAbstractDropHandler() {
  148. @Override
  149. public void dragEnter(VDragEvent drag) {
  150. }
  151. @Override
  152. protected void dragAccepted(final VDragEvent drag) {
  153. }
  154. @Override
  155. public void dragOver(final VDragEvent currentDrag) {
  156. final Object oldIdOver = currentDrag.getDropDetails().get(
  157. "itemIdOver");
  158. final String oldDetail = (String) currentDrag
  159. .getDropDetails().get("detail");
  160. updateTreeRelatedDragData(currentDrag);
  161. final String detail = getDropDetail(currentDrag
  162. .getCurrentGwtEvent());
  163. boolean nodeHasChanged = (currentMouseOverKey != null && currentMouseOverKey != oldIdOver)
  164. || (currentMouseOverKey == null && oldIdOver != null);
  165. boolean detailHasChanded = (detail != null && !detail
  166. .equals(oldDetail))
  167. || (detail == null && oldDetail != null);
  168. if (nodeHasChanged || detailHasChanded) {
  169. ApplicationConnection.getConsole().log(
  170. "Change in Transferable " + currentMouseOverKey
  171. + " " + detail);
  172. final String newKey = currentMouseOverKey;
  173. validate(new VAcceptCallback() {
  174. public void accepted(VDragEvent event) {
  175. if (newKey != null) {
  176. keyToNode.get(newKey).emphasis(detail);
  177. }
  178. }
  179. }, currentDrag);
  180. if (oldIdOver != null
  181. && oldIdOver != currentMouseOverKey) {
  182. TreeNode treeNode = keyToNode.get(oldIdOver);
  183. if (treeNode != null) {
  184. treeNode.emphasis(null);
  185. }
  186. }
  187. }
  188. }
  189. @Override
  190. public void dragLeave(VDragEvent drag) {
  191. cleanUp();
  192. }
  193. private void cleanUp() {
  194. if (currentMouseOverKey != null) {
  195. keyToNode.get(currentMouseOverKey).emphasis(null);
  196. currentMouseOverKey = null;
  197. }
  198. }
  199. @Override
  200. public boolean drop(VDragEvent drag) {
  201. cleanUp();
  202. return super.drop(drag);
  203. }
  204. @Override
  205. public Paintable getPaintable() {
  206. return VTree.this;
  207. }
  208. public ApplicationConnection getApplicationConnection() {
  209. return client;
  210. }
  211. };
  212. }
  213. dropHandler.updateAcceptRules(childUidl);
  214. }
  215. public String getDropDetail(NativeEvent event) {
  216. TreeNode treeNode = keyToNode.get(currentMouseOverKey);
  217. if (treeNode == null) {
  218. return null;
  219. }
  220. VerticalDropLocation verticalDropLocation = VerticalDropLocation.get(
  221. treeNode.nodeCaptionDiv, event.getClientY(), 0.2);
  222. return verticalDropLocation.toString();
  223. }
  224. private void handleUpdate(UIDL uidl) {
  225. final TreeNode rootNode = keyToNode.get(uidl
  226. .getStringAttribute("rootKey"));
  227. if (rootNode != null) {
  228. if (!rootNode.getState()) {
  229. // expanding node happened server side
  230. rootNode.setState(true, false);
  231. }
  232. rootNode.renderChildNodes(uidl.getChildIterator());
  233. }
  234. }
  235. public void setSelected(TreeNode treeNode, boolean selected) {
  236. if (selected) {
  237. if (!isMultiselect) {
  238. while (selectedIds.size() > 0) {
  239. final String id = selectedIds.iterator().next();
  240. final TreeNode oldSelection = keyToNode.get(id);
  241. if (oldSelection != null) {
  242. // can be null if the node is not visible (parent
  243. // collapsed)
  244. oldSelection.setSelected(false);
  245. }
  246. selectedIds.remove(id);
  247. }
  248. }
  249. treeNode.setSelected(true);
  250. selectedIds.add(treeNode.key);
  251. } else {
  252. if (!isNullSelectionAllowed) {
  253. if (!isMultiselect || selectedIds.size() == 1) {
  254. return;
  255. }
  256. }
  257. selectedIds.remove(treeNode.key);
  258. treeNode.setSelected(false);
  259. }
  260. client.updateVariable(paintableId, "selected", selectedIds
  261. .toArray(new String[selectedIds.size()]), immediate);
  262. }
  263. public boolean isSelected(TreeNode treeNode) {
  264. return selectedIds.contains(treeNode.key);
  265. }
  266. protected class TreeNode extends SimplePanel implements ActionOwner {
  267. public static final String CLASSNAME = "v-tree-node";
  268. String key;
  269. private String[] actionKeys = null;
  270. private boolean childrenLoaded;
  271. private Element nodeCaptionDiv;
  272. protected Element nodeCaptionSpan;
  273. private FlowPanel childNodeContainer;
  274. private boolean open;
  275. private Icon icon;
  276. private Element ie6compatnode;
  277. private Event mouseDownEvent;
  278. public TreeNode() {
  279. constructDom();
  280. sinkEvents(Event.ONCLICK | Event.ONDBLCLICK | Event.MOUSEEVENTS
  281. | Event.ONCONTEXTMENU);
  282. }
  283. public void emphasis(String string) {
  284. String base = "v-tree-node-drag-";
  285. UIObject.setStyleName(getElement(), base + "top", "TOP"
  286. .equals(string));
  287. UIObject.setStyleName(getElement(), base + "bottom", "BOTTOM"
  288. .equals(string));
  289. UIObject.setStyleName(getElement(), base + "center", "MIDDLE"
  290. .equals(string));
  291. base = "v-tree-node-caption-drag-";
  292. UIObject.setStyleName(nodeCaptionDiv, base + "top", "TOP"
  293. .equals(string));
  294. UIObject.setStyleName(nodeCaptionDiv, base + "bottom", "BOTTOM"
  295. .equals(string));
  296. UIObject.setStyleName(nodeCaptionDiv, base + "center", "MIDDLE"
  297. .equals(string));
  298. }
  299. @Override
  300. public void onBrowserEvent(Event event) {
  301. super.onBrowserEvent(event);
  302. if (disabled) {
  303. return;
  304. }
  305. final int type = DOM.eventGetType(event);
  306. final Element target = DOM.eventGetTarget(event);
  307. if (client.hasEventListeners(VTree.this, ITEM_CLICK_EVENT_ID)
  308. && target == nodeCaptionSpan
  309. && (type == Event.ONDBLCLICK || type == Event.ONMOUSEUP)) {
  310. fireClick(event);
  311. }
  312. if (type == Event.ONCLICK) {
  313. if (getElement() == target || ie6compatnode == target) {
  314. // state change
  315. toggleState();
  316. } else if (!readonly && target == nodeCaptionSpan) {
  317. // caption click = selection change && possible click event
  318. toggleSelection();
  319. }
  320. DOM.eventCancelBubble(event, true);
  321. } else if (type == Event.ONCONTEXTMENU) {
  322. showContextMenu(event);
  323. }
  324. if (dragModes != 0 || dropHandler != null) {
  325. if (type == Event.ONMOUSEDOWN) {
  326. if (nodeCaptionDiv.isOrHasChild(event.getTarget())) {
  327. ApplicationConnection.getConsole().log(
  328. "TreeNode m down");
  329. event.preventDefault(); // prevent text selection
  330. mouseDownEvent = event;
  331. }
  332. } else if (type == Event.ONMOUSEMOVE
  333. || type == Event.ONMOUSEOUT) {
  334. if (mouseDownEvent != null) {
  335. ApplicationConnection.getConsole().log(
  336. "TreeNode drag start " + event.getType());
  337. // start actual drag on slight move when mouse is down
  338. VTransferable t = new VTransferable();
  339. t.setDragSource(VTree.this);
  340. t.setData("itemId", key);
  341. VDragEvent drag = VDragAndDropManager.get().startDrag(
  342. t, mouseDownEvent, true);
  343. drag.createDragImage(nodeCaptionDiv, true);
  344. event.stopPropagation();
  345. mouseDownEvent = null;
  346. }
  347. } else if (type == Event.ONMOUSEUP) {
  348. mouseDownEvent = null;
  349. }
  350. if (type == Event.ONMOUSEOVER) {
  351. mouseDownEvent = null;
  352. currentMouseOverKey = key;
  353. event.stopPropagation();
  354. }
  355. }
  356. }
  357. private void fireClick(Event evt) {
  358. // non-immediate iff an immediate select event is going to happen
  359. boolean imm = !immediate
  360. || !selectable
  361. || (!isNullSelectionAllowed && isSelected() && selectedIds
  362. .size() == 1);
  363. MouseEventDetails details = new MouseEventDetails(evt);
  364. client.updateVariable(paintableId, "clickedKey", key, false);
  365. client.updateVariable(paintableId, "clickEvent",
  366. details.toString(), imm);
  367. }
  368. private void toggleSelection() {
  369. if (selectable) {
  370. VTree.this.setSelected(this, !isSelected());
  371. }
  372. }
  373. private void toggleState() {
  374. setState(!getState(), true);
  375. }
  376. protected void constructDom() {
  377. // workaround for a very weird IE6 issue #1245
  378. if (BrowserInfo.get().isIE6()) {
  379. ie6compatnode = DOM.createDiv();
  380. setStyleName(ie6compatnode, CLASSNAME + "-ie6compatnode");
  381. DOM.setInnerText(ie6compatnode, " ");
  382. DOM.appendChild(getElement(), ie6compatnode);
  383. DOM.sinkEvents(ie6compatnode, Event.ONCLICK);
  384. }
  385. nodeCaptionDiv = DOM.createDiv();
  386. DOM.setElementProperty(nodeCaptionDiv, "className", CLASSNAME
  387. + "-caption");
  388. Element wrapper = DOM.createDiv();
  389. nodeCaptionSpan = DOM.createSpan();
  390. DOM.appendChild(getElement(), nodeCaptionDiv);
  391. DOM.appendChild(nodeCaptionDiv, wrapper);
  392. DOM.appendChild(wrapper, nodeCaptionSpan);
  393. childNodeContainer = new FlowPanel();
  394. childNodeContainer.setStylePrimaryName(CLASSNAME + "-children");
  395. setWidget(childNodeContainer);
  396. }
  397. public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
  398. setText(uidl.getStringAttribute("caption"));
  399. key = uidl.getStringAttribute("key");
  400. keyToNode.put(key, this);
  401. if (uidl.hasAttribute("al")) {
  402. actionKeys = uidl.getStringArrayAttribute("al");
  403. }
  404. if (uidl.getTag().equals("node")) {
  405. if (uidl.getChildCount() == 0) {
  406. childNodeContainer.setVisible(false);
  407. } else {
  408. renderChildNodes(uidl.getChildIterator());
  409. childrenLoaded = true;
  410. }
  411. } else {
  412. addStyleName(CLASSNAME + "-leaf");
  413. }
  414. addStyleName(CLASSNAME);
  415. if (uidl.hasAttribute("style")) {
  416. addStyleName(CLASSNAME + "-" + uidl.getStringAttribute("style"));
  417. Widget.setStyleName(nodeCaptionDiv, CLASSNAME + "-caption-"
  418. + uidl.getStringAttribute("style"), true);
  419. childNodeContainer.addStyleName(CLASSNAME + "-children-"
  420. + uidl.getStringAttribute("style"));
  421. }
  422. if (uidl.getBooleanAttribute("expanded") && !getState()) {
  423. setState(true, false);
  424. }
  425. if (uidl.getBooleanAttribute("selected")) {
  426. setSelected(true);
  427. // ensure that identifier is in selectedIds array (this may be a
  428. // partial update)
  429. selectedIds.add(key);
  430. }
  431. if (uidl.hasAttribute("icon")) {
  432. if (icon == null) {
  433. icon = new Icon(client);
  434. DOM.insertBefore(DOM.getFirstChild(nodeCaptionDiv), icon
  435. .getElement(), nodeCaptionSpan);
  436. }
  437. icon.setUri(uidl.getStringAttribute("icon"));
  438. } else {
  439. if (icon != null) {
  440. DOM.removeChild(DOM.getFirstChild(nodeCaptionDiv), icon
  441. .getElement());
  442. icon = null;
  443. }
  444. }
  445. if (BrowserInfo.get().isIE6() && isAttached()) {
  446. fixWidth();
  447. }
  448. }
  449. public boolean isLeaf() {
  450. return getStyleName().contains("leaf");
  451. }
  452. private void setState(boolean state, boolean notifyServer) {
  453. if (open == state) {
  454. return;
  455. }
  456. if (state) {
  457. if (!childrenLoaded && notifyServer) {
  458. client.updateVariable(paintableId, "requestChildTree",
  459. true, false);
  460. }
  461. if (notifyServer) {
  462. client.updateVariable(paintableId, "expand",
  463. new String[] { key }, true);
  464. }
  465. addStyleName(CLASSNAME + "-expanded");
  466. childNodeContainer.setVisible(true);
  467. } else {
  468. removeStyleName(CLASSNAME + "-expanded");
  469. childNodeContainer.setVisible(false);
  470. if (notifyServer) {
  471. client.updateVariable(paintableId, "collapse",
  472. new String[] { key }, true);
  473. }
  474. }
  475. open = state;
  476. if (!rendering) {
  477. Util.notifyParentOfSizeChange(VTree.this, false);
  478. }
  479. }
  480. private boolean getState() {
  481. return open;
  482. }
  483. private void setText(String text) {
  484. DOM.setInnerText(nodeCaptionSpan, text);
  485. }
  486. private void renderChildNodes(Iterator i) {
  487. childNodeContainer.clear();
  488. childNodeContainer.setVisible(true);
  489. while (i.hasNext()) {
  490. final UIDL childUidl = (UIDL) i.next();
  491. // actions are in bit weird place, don't mix them with children,
  492. // but current node's actions
  493. if ("actions".equals(childUidl.getTag())) {
  494. updateActionMap(childUidl);
  495. continue;
  496. }
  497. final TreeNode childTree = new TreeNode();
  498. if (ie6compatnode != null) {
  499. childNodeContainer.add(childTree);
  500. }
  501. childTree.updateFromUIDL(childUidl, client);
  502. if (ie6compatnode == null) {
  503. childNodeContainer.add(childTree);
  504. }
  505. }
  506. childrenLoaded = true;
  507. }
  508. public boolean isChildrenLoaded() {
  509. return childrenLoaded;
  510. }
  511. public Action[] getActions() {
  512. if (actionKeys == null) {
  513. return new Action[] {};
  514. }
  515. final Action[] actions = new Action[actionKeys.length];
  516. for (int i = 0; i < actions.length; i++) {
  517. final String actionKey = actionKeys[i];
  518. final TreeAction a = new TreeAction(this, String.valueOf(key),
  519. actionKey);
  520. a.setCaption(getActionCaption(actionKey));
  521. a.setIconUrl(getActionIcon(actionKey));
  522. actions[i] = a;
  523. }
  524. return actions;
  525. }
  526. public ApplicationConnection getClient() {
  527. return client;
  528. }
  529. public String getPaintableId() {
  530. return paintableId;
  531. }
  532. /**
  533. * Adds/removes Vaadin specific style name. This method ought to be
  534. * called only from VTree.
  535. *
  536. * @param selected
  537. */
  538. protected void setSelected(boolean selected) {
  539. // add style name to caption dom structure only, not to subtree
  540. setStyleName(nodeCaptionDiv, "v-tree-node-selected", selected);
  541. }
  542. protected boolean isSelected() {
  543. return VTree.this.isSelected(this);
  544. }
  545. public void showContextMenu(Event event) {
  546. if (!readonly && !disabled) {
  547. if (actionKeys != null) {
  548. int left = event.getClientX();
  549. int top = event.getClientY();
  550. top += Window.getScrollTop();
  551. left += Window.getScrollLeft();
  552. client.getContextMenu().showAt(this, left, top);
  553. }
  554. event.cancelBubble(true);
  555. event.preventDefault();
  556. }
  557. }
  558. /*
  559. * We need to fix the width of TreeNodes so that the float in
  560. * ie6compatNode does not wrap (see ticket #1245)
  561. */
  562. private void fixWidth() {
  563. nodeCaptionDiv.getStyle().setProperty("styleFloat", "left");
  564. nodeCaptionDiv.getStyle().setProperty("display", "inline");
  565. nodeCaptionDiv.getStyle().setProperty("marginLeft", "0");
  566. final int captionWidth = ie6compatnode.getOffsetWidth()
  567. + nodeCaptionDiv.getOffsetWidth();
  568. setWidth(captionWidth + "px");
  569. }
  570. @Override
  571. public void onAttach() {
  572. super.onAttach();
  573. if (ie6compatnode != null) {
  574. fixWidth();
  575. }
  576. }
  577. }
  578. public VDropHandler getDropHandler() {
  579. return dropHandler;
  580. }
  581. }