public AssetCanvas(final FormItem formItem) { setWidth(100); setAlign(Alignment.CENTER); previewContainer = new Canvas(); addMember(previewContainer); previewContainer.setWidth(100); previewContainer.setHeight(100); previewContainer.setBorder("1px solid #a6abb4"); imageUpdateButton = new IButton("Update Artifact"); imageUpdateButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { String formItemName = formItem.getName(); ((DynamicEntityDataSource) formItem.getForm().getDataSource()) .getFormItemCallbackHandlerManager() .getFormItemCallback(formItemName) .execute(formItem); } }); addMember(imageUpdateButton); if (formItem.getDisabled()) { imageUpdateButton.setVisible(false); } }
public PortalColumn() { // leave some space between portlets setMembersMargin(4); // Provide a visible border for framing of columns (especially when empty) and add padding to // make // the border easier to see for dragging // setBorder("2px solid #999999"); // Allow column specific vertical scrolling to see off-screen portlets. Takes up real estate but // allows // a user to see specific portlets in each column at the same time. // setOverflow(Overflow.AUTO); // enable predefined component animation setAnimateMembers(true); setAnimateMemberTime(300); // enable drop handling for moving portlet windows within or between columns setCanAcceptDrop(true); // change appearance of drag placeholder and drop indicator setDropLineThickness(4); Canvas dropLineProperties = new Canvas(); dropLineProperties.setBackgroundColor("#4A5D75"); setDropLineProperties(dropLineProperties); setShowDragPlaceHolder(true); Canvas placeHolderProperties = new Canvas(); placeHolderProperties.setBorder("2px solid #4A5D75"); setPlaceHolderProperties(placeHolderProperties); // Allow column resizing (width only) setCanDragResize(true); // Use Left side drag resize because right side seems to conflict with vertical scroll bars. setResizeFrom("L"); // Do not use the resize bar. It looks good but does not behave as well as the border dragging, // and does // not seem to play as well with the resize handlers. Maybe in the future... // setShowResizeBar(true); // True is the default, just capturing this call here for any future tweaking // setRedrawOnResize(true); }
protected void addPortlet(String portletKey, String portletName) { DashboardPortlet storedPortlet = new DashboardPortlet(portletName, portletKey, 250); storedDashboard.addPortlet(storedPortlet); String locatorId = getPortletLocatorId(portalLayout, storedPortlet); final PortletWindow newPortletWindow = new PortletWindow(locatorId, this, storedPortlet, context); newPortletWindow.setTitle(portletName); newPortletWindow.setHeight(350); newPortletWindow.setVisible(false); portletWindows.add(newPortletWindow); portalLayout.addPortletWindow(newPortletWindow, storedPortlet.getColumn()); PortalColumn portalColumn = portalLayout.getPortalColumn(storedPortlet.getColumn()); // also insert a blank spacer element, which will trigger the built-in // animateMembers layout animation final LayoutSpacer placeHolder = new LayoutSpacer(); // placeHolder.setRect(newPortlet.getRect()); portalColumn.addMember(placeHolder); // add to top // create an outline around the clicked button final Canvas outline = new Canvas(); outline.setLeft(editForm.getAbsoluteLeft() + addPortlet.getLeft()); outline.setTop(editForm.getAbsoluteTop()); outline.setWidth(addPortlet.getWidth()); outline.setHeight(addPortlet.getHeight()); outline.setBorder("2px solid 8289A6"); outline.draw(); outline.bringToFront(); outline.animateRect( newPortletWindow.getPageLeft(), newPortletWindow.getPageTop(), newPortletWindow.getVisibleWidth(), newPortletWindow.getViewportHeight(), new AnimationCallback() { public void execute(boolean earlyFinish) { // callback at end of animation - destroy placeholder and outline; show the new portlet placeHolder.destroy(); outline.destroy(); newPortletWindow.show(); } }, 750); save(); }