private void setup() { // destroy dated tagLayouts if (tagLayouts != null) { for (LocatableHLayout tagLayout : tagLayouts) { removeMember(tagLayout); tagLayout.destroy(); } } // remove remaining members for (Canvas canvas : getMembers()) { removeMember(canvas); } // [re]build addMember(tagTitleLabel); tagLayouts = createTagLayouts(); for (LocatableHLayout tagLayout : tagLayouts) { addMember(tagLayout); } if (!readOnly) { addMember(addImg); tagInputDialog.place(addImg); } markForRedraw(); }
private ArrayList<LocatableHLayout> createTagLayouts() { ArrayList<LocatableHLayout> tagLayouts = new ArrayList<LocatableHLayout>(tags.size()); for (final Tag tag : tags) { LocatableHLayout tagLayout = new LocatableHLayout(extendLocatorId(tag.getName())); tagLayout.setHeight(18); tagLayout.setHeight(16); HTMLFlow tagString = new HTMLFlow( "<nobr><a href=\"" + LinkManager.getTagLink(tag.toString()) + "\">" + tag.toString() + "</a></nobr>"); tagString.setAutoWidth(); tagLayout.addMember(tagString); if (!readOnly) { final LayoutSpacer spacer = new LayoutSpacer(); spacer.setHeight(16); spacer.setWidth(16); final Img remove = new LocatableImg( tagLayout.extendLocatorId("Remove"), "[skin]/images/actions/remove.png", 16, 16); remove.setTooltip(MSG.view_tags_tooltip_1()); remove.addClickHandler( new ClickHandler() { public void onClick(ClickEvent clickEvent) { tags.remove(tag); save(); } }); tagLayout.addMember(remove); tagLayout.addMember(spacer); remove.hide(); tagLayout.addMouseOverHandler( new MouseOverHandler() { public void onMouseOver(MouseOverEvent mouseOverEvent) { remove.show(); spacer.hide(); } }); tagLayout.addMouseOutHandler( new MouseOutHandler() { public void onMouseOut(MouseOutEvent mouseOutEvent) { spacer.show(); remove.hide(); } }); } tagLayouts.add(tagLayout); } return tagLayouts; }