public Canvas getViewPanel() { final TabSet tabSet = new TabSet(); tabSet.setTabBarPosition(Side.TOP); // required so that the select item doesnt touch the tab pane tabSet.setTabBarThickness(25); tabSet.setTabBarAlign(Side.LEFT); tabSet.setWidth(400); tabSet.setHeight(200); final Tab statusTab = new Tab("Status"); final Canvas statusPane = new Canvas(); statusTab.setPane(statusPane); tabSet.addTab(statusTab); SelectItem selectItem = new SelectItem(); selectItem.setValueMap("Development", "Staging", "Production"); selectItem.setShowTitle(false); selectItem.setDefaultValue("Development"); selectItem.addChangeHandler( new ChangeHandler() { public void onChange(ChangeEvent event) { statusPane.setContents( event.getValue() + ": <span style='color:green;font-weight:bold'>Normal</span><br>"); } }); DynamicForm form = new DynamicForm(); // form.setHeight(1); form.setPadding(0); form.setMargin(0); form.setCellPadding(1); form.setNumCols(1); form.setFields(selectItem); tabSet.setTabBarControls(TabBarControls.TAB_SCROLLER, TabBarControls.TAB_PICKER, form); return tabSet; }
/** Instantiates a new digital object menu view. */ @Inject public DigitalObjectMenuView(final LangConstants lang, final EventBus eventBus) { this.lang = lang; this.eventBus = eventBus; layout = new VLayout(); layout.setHeight100(); layout.setWidth100(); layout.setOverflow(Overflow.AUTO); relatedGrid = new ListGrid(); relatedGrid.setWidth100(); relatedGrid.setHeight100(); relatedGrid.setShowSortArrow(SortArrow.CORNER); relatedGrid.setShowAllRecords(true); relatedGrid.setAutoFetchData(false); relatedGrid.setCanHover(true); relatedGrid.setCanSort(false); ListGridField field1 = new ListGridField("relation", lang.relation()); field1.setWidth("40%"); ListGridField field2 = new ListGridField("uuid", "PID"); field2.setWidth("*"); relatedGrid.setFields(field1, field2); sectionRelated = new SectionStackSection(); sectionRelated.setID(SECTION_RELATED_ID); sectionRelated.setTitle(lang.referencedBy()); sectionRelated.setResizeable(true); sectionRelated.setItems(relatedGrid); sectionRelated.setExpanded(false); sideNavGrid = new ListGrid() { @Override protected Canvas getRollOverCanvas(Integer rowNum, Integer colNum) { final ListGridRecord rollOverRecord = this.getRecord(rowNum); if (rollOverCanvas == null) { rollOverCanvas = new HLayout(); rollOverCanvas.setSnapTo("TR"); rollOverCanvas.setWidth(50); rollOverCanvas.setHeight(22); } if (rollOverCanvas.getChildren().length > 0) { rollOverCanvas.removeChild(rollOverCanvas.getChildren()[0]); } final String lockOwner = rollOverRecord.getAttributeAsString(Constants.ATTR_LOCK_OWNER); if (lockOwner != null) { ImgButton lockImg = new ImgButton(); lockImg.setShowDown(false); lockImg.setShowRollOver(false); lockImg.setLayoutAlign(Alignment.CENTER); if ("".equals(lockOwner)) { lockImg.setSrc("icons/16/lock_lock_all.png"); } else if (lockOwner.length() > 0) { lockImg.setSrc("icons/16/lock_lock_all_red.png"); } lockImg.setPrompt(lang.lockInfoButton()); lockImg.setHeight(16); lockImg.setWidth(16); lockImg.addClickHandler( new com.smartgwt.client.widgets.events.ClickHandler() { @Override public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) { EditorSC.objectIsLock( lang, new LockInfo( lockOwner, rollOverRecord.getAttributeAsString(Constants.ATTR_LOCK_DESCRIPTION), rollOverRecord.getAttributeAsStringArray( Constants.ATTR_TIME_TO_EXP_LOCK))); } }); rollOverCanvas.addChild(lockImg); } return rollOverCanvas; } }; sideNavGrid.setShowSelectionCanvas(false); sideNavGrid.setWidth100(); sideNavGrid.setHeight100(); sideNavGrid.setShowSortArrow(SortArrow.CORNER); sideNavGrid.setShowAllRecords(true); sideNavGrid.setAutoFetchData(true); sideNavGrid.setCanHover(true); sideNavGrid.setHoverOpacity(75); sideNavGrid.setHoverStyle("interactImageHover"); sideNavGrid.setShowRollOverCanvas(true); final DynamicForm form = new DynamicForm(); form.setHeight(1); form.setWidth(60); form.setNumCols(1); selectItem.setWidth(60); selectItem.setShowTitle(false); selectItem.setValueMap(lang.me(), lang.all()); selectItem.setDefaultValue(lang.me()); selectItem.setHoverOpacity(75); selectItem.setHoverStyle("interactImageHover"); selectItem.addItemHoverHandler( new ItemHoverHandler() { @Override public void onItemHover(ItemHoverEvent event) { selectItem.setPrompt( DigitalObjectMenuView.this.lang.showModifiedHint() + selectItem.getValue()); } }); selectItem.addChangedHandler( new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { getUiHandlers().refreshRecentlyModified(); } }); form.setFields(selectItem); form.setTitle("by:"); sectionRecentlyModified = new SectionStackSection(); sectionRecentlyModified.setTitle(lang.recentlyModified()); sectionRecentlyModified.setResizeable(true); sectionRecentlyModified.setItems(sideNavGrid); sectionRecentlyModified.setControls(form); sectionRecentlyModified.setExpanded(true); sectionStack = new SectionStack(); sectionStack.addSection(sectionRelated); sectionStack.addSection(sectionRecentlyModified); sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE); sectionStack.setAnimateSections(true); sectionStack.setWidth100(); sectionStack.setHeight100(); sectionStack.setOverflow(Overflow.HIDDEN); layout.addMember(sectionStack); }