Graphical bug with TreeTable and DragAndDropWrapper

Hi,

I’m facing a graphical problem that makes me crazy.

I’m building a TreeTable. Each item has got a DragAndDropWrapper to be able to drag and drop files from desktop for example.
I’ve got 4 properties in my tree :
icon, id, name and draganddropwrapper.

I’m building my tree like it:


				// there is no item in the tree so i create the first
				tree.addContainerProperty(PROPERTY_DRAGANDDROPWRAPPER, DragAndDropWrapper.class, null);
				tree.addContainerProperty(PROPERTY_ICON, Resource.class, null);
				tree.addContainerProperty(PROPERTY_NAME, String.class, null);
				tree.addContainerProperty(PROPERTY_ID, String.class, null);

				itemID = tree.addItem();
				item = tree.getItem(itemID);
				LOGGER.info("New item id = {}", itemID.toString());
				tree.setChildrenAllowed(itemID, true);

				// get the directory name with substring
				String resultat = path.substring(path.lastIndexOf("/")).replaceFirst("/", "") + FILESEPARATOR;

				item.getItemProperty(PROPERTY_NAME).setValue(resultat);
				item.getItemProperty(PROPERTY_ID).setValue(itemID);
				item.getItemProperty(PROPERTY_ICON).setValue(
						DataManagementPortlet.getInternalThemeResource("/images/icon-directory_16x16.png"));

				// label for D&DW
				Label label = new Label(resultat);
				label.setData(itemID);
				DragAndDropWrapper dragAndDropWrapper = new DragAndDropWrapper(label);
				dragAndDropWrapper.setData(itemID);
				dragAndDropWrapper.setDropHandler(this);
				item.getItemProperty(PROPERTY_DRAGANDDROPWRAPPER).setValue(dragAndDropWrapper);
			}
			if (results.size() > 0) {
				Collections.sort(results);
				for (String result : results) {
					if (LOGGER.isDebugEnabled()) {
						LOGGER.debug("Adding {} to {}", result,
								item.getItemProperty(DataManagementTreeTable.PROPERTY_NAME).getValue());
					}
					((DataManagementTreeTable) tree).addItemToNode(tree, item, itemID, result);
				}
			}

then:


	public void addItemToNode(TreeTable tree, Item targetItem, Object targetItemID, String value) {
		// Allow children for the target item, and expand it
		LOGGER.info("item = {}", targetItem);
		tree.setChildrenAllowed(targetItemID, true);
		LOGGER.info("Expanding this item");
		tree.setCollapsed(targetItemID, false);

		// Create new item, set parent, disallow children (= leaf node)
		Object itemId = tree.addItem();
		LOGGER.info("New item id = {}", itemId.toString());
		tree.setParent(itemId, targetItemID);
		tree.setChildrenAllowed(itemId, false);

		// Set the name for this item (we use it as item caption)
		Item item = tree.getItem(itemId);
		Property name = item.getItemProperty(DataManagementTreeTable.PROPERTY_NAME);
		name.setValue(value);
		Property id = item.getItemProperty(DataManagementTreeTable.PROPERTY_ID);
		id.setValue(itemId);

		Label label = new Label(value);
		label.setData(itemId);
		DragAndDropWrapper dragAndDropWrapper = new DragAndDropWrapper(label);
		dragAndDropWrapper.setData(itemId);
		dragAndDropWrapper.setDropHandler(this);
		item.getItemProperty(DataManagementTreeTable.PROPERTY_DRAGANDDROPWRAPPER).setValue(dragAndDropWrapper);

		if (isDirectory(value)) {
			// it's a dir, so children are allowed
			tree.setChildrenAllowed(itemId, true);
			// update hashmap (only if it's directory, otherwise we don't care
			hashmap.put(itemId, false);
			item.getItemProperty(PROPERTY_ICON).setValue(
					DataManagementPortlet.getInternalThemeResource("/images/icon-directory_16x16.png"));
		}
	}

I only want to display the column DragAndDropWrapper. However, until now I was also displaying the column ID in order to facilitate debugging.
The layout was correct as shown in the first attachment.


tree.setVisibleColumns(new Object[] { DataManagementTreeTable.PROPERTY_ID, DataManagementTreeTable.PROPERTY_DRAGANDDROPWRAPPER });

Now I only want to display the column DragAndDropWrapper. But I’ve got a graphical bug : the height of each row is doubled and the D&DWrapper is below the icon… as shown in the second attachment.


tree.setVisibleColumns(new Object[] { DataManagementTreeTable.PROPERTY_DRAGANDDROPWRAPPER });

Please, could you help me ?

Regards.
12089.png
12090.png