public Bottom() { setWidth100(); setHeight(20); Label about = new Label("Information Center 08. Copyright 2010 - 2011. "); about.setWidth100(); about.setHeight100(); about.setAlign(Alignment.RIGHT); about.setStyleName("abouttext"); setMembers(about); addShowContextMenuHandler( new ShowContextMenuHandler() { @Override public void onShowContextMenu(ShowContextMenuEvent event) { event.cancel(); } }); }
private Label createPDFLabel() { Label toPDF = new Label(i18n.toPDF()); toPDF.setWrap(false); toPDF.setAutoFit(true); toPDF.setPadding(3); toPDF.setWidth100(); toPDF.setStyleName("n52_sensorweb_client_exportEntry"); toPDF.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { controller.exportTo(ExportType.PDF_ALL_IN_ONE); exportMenu.hide(); } }); return toPDF; }
public UpgradeLevelLayout(int x, int y) { this.setWidth(500); this.setHeight(300); this.setMembersMargin(5); this.setPadding(5); this.setBackgroundColor("#FFFFFF"); this.setBorder("1px solid #CCCCCC"); this.setOpacity(85); this.moveTo(x, y + 20); Label titleLabel = new Label("<b>User Levels:</b>"); titleLabel.setIcon(CoreConstants.ICON_USER_INFO); titleLabel.setHeight(30); this.addMember(titleLabel); HTMLPane pane = new HTMLPane(); pane.setWidth100(); pane.setHeight100(); pane.setOverflow(Overflow.AUTO); pane.setContentsURL("./documentation/user/user_levels.html"); pane.setContentsType(ContentsType.PAGE); this.addMember(pane); Label closeLabel = new Label("Close"); closeLabel.setIcon(CoreConstants.ICON_CLOSE); closeLabel.setHeight(25); closeLabel.setWidth100(); closeLabel.setAlign(Alignment.RIGHT); closeLabel.setCursor(Cursor.HAND); closeLabel.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { destroy(); } }); this.addMember(closeLabel); }
private VLayout createDisplayLabel() { String message = "Search for value sets. Select the value sets by checking the checkbox and then click Add to add them."; i_label = new Label("<b>" + message + "<b>"); i_label.setWidth100(); i_label.setHeight(30); i_label.setMargin(2); i_label.setValign(VerticalAlignment.CENTER); i_label.setBackgroundColor(BACKGROUND_COLOR); final VLayout vLayoutLayoutSpacers = new VLayout(); vLayoutLayoutSpacers.setWidth100(); vLayoutLayoutSpacers.setHeight(30); vLayoutLayoutSpacers.setBackgroundColor(BACKGROUND_COLOR); vLayoutLayoutSpacers.setLayoutMargin(6); vLayoutLayoutSpacers.setMembersMargin(6); vLayoutLayoutSpacers.addMember(i_label); return vLayoutLayoutSpacers; }
public Canvas getSearchCanvas() { final VLayout mainLayout = new VLayout(20); mainLayout.setWidth100(); mainLayout.setHeight100(); mainLayout.setPadding(5); Label titleBar = new Label(MESSAGES.geometricSearchWidgetFreeDrawingSearchTitle()); titleBar.setBackgroundColor("#E0E9FF"); titleBar.setWidth100(); titleBar.setHeight(20); titleBar.setPadding(5); HLayout geomsButtonBar = new HLayout(); geomsButtonBar.setWidth100(); geomsButtonBar.setAutoHeight(); geomsButtonBar.setMembersMargin(10); HLayout actionsButtonBar = new HLayout(); actionsButtonBar.setWidth100(); actionsButtonBar.setAutoHeight(); actionsButtonBar.setMembersMargin(10); btnPoint = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingPoint()); btnPoint.setIcon(WidgetLayout.iconPointCreate); btnPoint.setWidth( btnPoint.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset); btnPoint.setActionType(SelectionType.RADIO); btnPoint.setRadioGroup("drawType"); btnPoint.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { onDrawPoint(); } }); btnLine = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingLine()); btnLine.setIcon(WidgetLayout.iconLineCreate); btnLine.setWidth( btnLine.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset); btnLine.setActionType(SelectionType.RADIO); btnLine.setRadioGroup("drawType"); btnLine.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { onDrawLine(); } }); btnPolygon = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingPolygon()); btnPolygon.setIcon(WidgetLayout.iconPolygonCreate); btnPolygon.setWidth( btnPolygon.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset); btnPolygon.setActionType(SelectionType.RADIO); btnPolygon.setRadioGroup("drawType"); btnPolygon.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { onDrawPolygon(); } }); btnUndo = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingUndo()); btnUndo.setIcon(WidgetLayout.iconUndo); btnUndo.setWidth( btnUndo.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset); btnUndo.setDisabled(true); btnUndo.setShowDisabledIcon(false); btnUndo.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { onUndo(); } }); btnRedo = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingRedo()); btnRedo.setIcon(WidgetLayout.iconRedo); btnRedo.setWidth( btnRedo.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset); btnRedo.setDisabled(true); btnRedo.setShowDisabledIcon(false); btnRedo.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { onRedo(); } }); frmBuffer = new DynamicForm(); frmBuffer.setWidth100(); spiBuffer = new SpinnerItem(); spiBuffer.setTitle(MESSAGES.geometricSearchWidgetBufferLabel()); spiBuffer.setDefaultValue(5); spiBuffer.setMin(0); spiBuffer.setWidth(60); spiBuffer.addChangedHandler( new ChangedHandler() { public void onChanged(ChangedEvent event) { updateView(); } }); frmBuffer.setFields(spiBuffer); // ---------------------------------------------------------- geomsButtonBar.addMember(btnPoint); geomsButtonBar.addMember(btnLine); geomsButtonBar.addMember(btnPolygon); actionsButtonBar.addMember(btnUndo); actionsButtonBar.addMember(btnRedo); mainLayout.addMember(titleBar); mainLayout.addMember(geomsButtonBar); mainLayout.addMember(actionsButtonBar); mainLayout.addMember(frmBuffer); return mainLayout; }
public UserDetailTabPane(DataSource userDS, final ItemListGrid userListGrid) { this.userListGrid = userListGrid; setStyleName("defaultBorder"); userViewer = new DetailViewer(); userViewer.setDataSource(userDS); userViewer.setWidth100(); userViewer.setMargin(25); userViewer.setEmptyMessage("Select an user to view its details"); editorLabel = new Label(); editorLabel.setWidth100(); editorLabel.setHeight100(); editorLabel.setAlign(Alignment.CENTER); editorLabel.setContents("Select an user to edit, or insert a new user into"); insertLabel = new Label(); insertLabel.setWidth100(); insertLabel.setHeight100(); insertLabel.setAlign(Alignment.CENTER); insertLabel.setContents("Insert a new user into"); // update form editorForm = new DynamicForm(); editorForm.setWidth(650); editorForm.setMargin(25); editorForm.setNumCols(4); editorForm.setCellPadding(5); editorForm.setAutoFocus(false); editorForm.setDataSource(userDS); editorForm.setUseAllDataSourceFields(true); userId = new StaticTextItem("userId", "User ID"); userName = new TextItem("userName", "User Name"); password = new PasswordItem("password", "Password"); enabled = new CheckboxItem("enabled", "Enabled"); userName.setRequired(true); password.setRequired(true); ButtonItem saveButton = new ButtonItem("saveUser", "Update user info."); saveButton.setAlign(Alignment.CENTER); saveButton.setWidth(100); saveButton.setColSpan(4); saveButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { // editorForm.saveData(); if (userId.getValue() == null) { return; } if (!editorForm.validate(false)) { return; } User user = new User(); user.setUserId((String) userId.getValue()); user.setUserName(userName.getValueAsString()); user.setPassword(password.getValueAsString()); user.setEnabled(enabled.getValueAsBoolean()); userService.updateUser( user, new AsyncCallback<Void>() { public void onFailure(Throwable caught) { SC.say("Error", "Server side error occured. Contact your administrator."); } public void onSuccess(Void noAnswer) { SC.say("Updated", "User info. is updated."); userListGrid.invalidateCache(); } }); } }); editorForm.setFields(userId, userName, password, enabled, saveButton); editorForm.setColWidths(100, 200, 100, 200); // insert form insertForm = new DynamicForm(); insertForm.setWidth(650); insertForm.setMargin(25); insertForm.setNumCols(4); insertForm.setCellPadding(5); insertForm.setAutoFocus(false); insertForm.setDataSource(userDS); insertForm.setUseAllDataSourceFields(true); userId4add = new TextItem("userId", "User ID"); userName4add = new TextItem("userName", "User Name"); password4add = new PasswordItem("password", "Password"); enabled4add = new CheckboxItem("enabled", "Enabled"); enabled4add.setValue(true); userId4add.setRequired(true); userName4add.setRequired(true); password4add.setRequired(true); ButtonItem addButton = new ButtonItem("addUser", "Add user info."); addButton.setAlign(Alignment.CENTER); addButton.setWidth(100); addButton.setColSpan(4); addButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { if (!insertForm.validate(false)) { return; } User user = new User(); user.setUserId(userId4add.getValueAsString()); user.setUserName(userName4add.getValueAsString()); user.setPassword(password4add.getValueAsString()); user.setEnabled(enabled4add.getValueAsBoolean()); userService.addUser( user, new AsyncCallback<Void>() { public void onFailure(Throwable caught) { SC.say("Error", "Server side error occured. Contact your administrator."); } public void onSuccess(Void noAnswer) { SC.say("Added", "User info. is added."); userListGrid.invalidateCache(); insertForm.clearValues(); } }); } }); insertForm.setFields(userId4add, userName4add, password4add, enabled4add, addButton); insertForm.setColWidths(100, 200, 100, 200); // tab Tab viewTab = new Tab("View"); viewTab.setIcon("silk/application_form.png"); viewTab.setWidth(70); viewTab.setPane(userViewer); Tab editTab = new Tab("Edit"); editTab.setIcon("demoApp/icon_edit.png"); editTab.setWidth(70); editTab.setPane(editorForm); Tab insertTab = new Tab("Add"); insertTab.setIcon("demoApp/icon_add.png"); insertTab.setWidth(70); insertTab.setPane(insertForm); setTabs(viewTab, editTab, insertTab); addTabSelectedHandler( new TabSelectedHandler() { public void onTabSelected(TabSelectedEvent event) { updateDetails(); } }); }
private void init(final ListGridRecord sampleRecord, final boolean add) { final Form form = new Form(nameItem, mudpitItem, categoryItem); form.setWrapItemTitles(false); nameItem.setValue(sampleRecord.getAttributeAsString("Name")); nameItem.addChangedHandler( new ChangedHandler() { public void onChanged(final ChangedEvent event) { checkOk(); } }); mudpitItem.setValue(sampleRecord.getAttributeAsBoolean("Mudpit")); categoryItem.setValue(sampleRecord.getAttributeAsString("Category")); final Label label = new Label(CONSTANTS.scaffoldWizardSampleSearchLabel()); label.setWidth100(); label.setHeight(12); final TreeOptions treeOptions = new TreeOptions(); treeOptions.setInitialItems( locationFactory.getTropixObjectSourceRootItems(TropixObjectTreeItemExpanders.get(types))); treeOptions.setShowPredicate(getShowItemPredicate()); treeOptions.setSelectionPredicate(LocationPredicates.getTropixObjectNotFolderPredicate()); treeOptions.setSelectionType(SelectionType.MULTIPlE); @SuppressWarnings("unchecked") final Collection<TreeItem> selectedItems = (Collection<TreeItem>) sampleRecord.getAttributeAsObject("Selection"); treeOptions.setExpandIds(Locations.getAncestorIds(selectedItems)); treeOptions.setSelectedItems(selectedItems); final TreeComponent tree = treeComponentFactory.get(treeOptions); tree.addMultiSelectionListener(this); final TreeGrid treeGrid = tree.get(); treeGrid.setTooltip("Hold the control key to select multiple items."); final VLayout layout = new VLayout(); layout.addMember(form); layout.addMember(label); layout.addMember(treeGrid); layout.setSize("500px", "500px"); okButton = SmartUtils.getButton( add ? "Add" : "Update", null, new Command() { public void execute() { sampleRecord.setAttribute("Name", (String) nameItem.getValue()); sampleRecord.setAttribute("Category", (String) categoryItem.getValue()); sampleRecord.setAttribute("Mudpit", (Boolean) mudpitItem.getValue()); sampleRecord.setAttribute("Selection", selection); if (add) { dataSource.addData(sampleRecord); records.add(sampleRecord); } listGrid.markForRedraw(); get().markForDestroy(); checkValid(); } }); final Button cancelButton = SmartUtils.getCancelButton(this); final Layout opsLayout = new CanvasWithOpsLayout<VLayout>(layout, okButton, cancelButton); final Window window = PopOutWindowBuilder.titled((add ? "Add" : "Update") + " Sample") .withContents(opsLayout) .autoSized() .get(); setWidget(window); checkOk(); get().draw(); }
private HLayout createSearchLayout() { HLayout searchLayout = new HLayout(); searchLayout.setWidth100(); searchLayout.setHeight(20); searchLayout.setMembersMargin(15); i_searchForm = new DynamicForm(); i_searchForm.setWidth(250); i_searchForm.setHeight100(); i_searchForm.setAlign(Alignment.LEFT); i_searchForm.setAutoFocus(true); i_searchTextItem = new TextItem(); i_searchTextItem.setTitle("Search"); i_searchTextItem.setWidth(200); i_searchTextItem.setHint(SEARCH_HINT); i_searchTextItem.setShowHintInField(true); i_searchTextItem.setCanFocus(true); i_searchTextItem.setSelectOnFocus(true); i_searchTextItem.addKeyUpHandler( new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { event.getKeyName(); // ignore the arrow keys if (isValidSearchText()) { i_searchListGrid.getData(i_searchTextItem.getValueAsString()); i_addButton.setDisabled(true); } } }); i_searchForm.setFields(i_searchTextItem); // add button to a Vlayout so we can position it correctly with the form // search text. VLayout buttonVlayout = new VLayout(); buttonVlayout.setWidth(40); buttonVlayout.setAlign(VerticalAlignment.CENTER); buttonVlayout.setMargin(2); i_clearButton = new IButton(CLEAR_BUTTON_TITLE); i_clearButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { i_searchTextItem.setValue(""); i_rowsRetrievedLabel.setContents(""); i_searchListGrid.clearData(); i_addButton.setDisabled(true); } }); buttonVlayout.addMember(i_clearButton); // add Label to a Vlayout so we can position it correctly with the form // search text. VLayout labelVlayout = new VLayout(); labelVlayout.setWidth(100); labelVlayout.setAlign(VerticalAlignment.BOTTOM); labelVlayout.setMargin(2); i_rowsRetrievedLabel = new Label(); i_rowsRetrievedLabel.setWrap(false); i_rowsRetrievedLabel.setWidth100(); i_rowsRetrievedLabel.setHeight(23); labelVlayout.addMember(i_rowsRetrievedLabel); searchLayout.addMember(i_searchForm); searchLayout.addMember(buttonVlayout); searchLayout.addMember(labelVlayout); return searchLayout; }
// private final MapServiceInfoAsync mapServiceInfo = GWT.create(MapServiceInfo.class); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public Authorization(final AsyncCallback<String> callback) { super(WINDOW_TITLE, WIDTH, HEIGHT, callback); this.setShowMinimizeButton(false); VLayout layout = new VLayout(); layout.layoutChildren(null); accountForm = new DynamicForm(); accountForm.setWidth100(); accountForm.setPadding(5); // backGround.setBorder("1px solid #ff0"); TextItem login = new TextItem(CONTROL_LOGIN); login.setTitle(CAPTION_LOGIN); PasswordItem password = new PasswordItem(CONTROL_PASSWORD); password.setTitle(CAPTION_PASSWORD); password.addKeyPressHandler( new KeyPressHandler() { public void onKeyPress(KeyPressEvent keyPressEvent) { // com.google.gwt.user.client.Window.alert("" + // keyPressEvent.getKeyName()); if (keyPressEvent.getKeyName().equalsIgnoreCase("ENTER")) onOkClick(); } }); accountForm.setFields(login, password); Label linkRegistration = null; if (GWTViewer.config.withRegistration()) { linkRegistration = new Label(); linkRegistration.setAlign(Alignment.RIGHT); linkRegistration.setStyleName(CSS_LABEL_LINK); linkRegistration.setHeight(20); linkRegistration.setWidth(265); linkRegistration.setContents(REGISTRATION); linkRegistration.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { callback.onSuccess(CMD_REGISTRATION); closeForm(); } }); } labelException = new Label(); labelException.setAlign(Alignment.CENTER); labelException.setStyleName(CSS_LABEL_ERROR); labelException.setHeight(35); labelException.setWidth100(); labelException.setMargin(5); // labelException.setBorder("1px solid #0aa"); labelException.setContents(""); HLayout controlPanel = new HLayout(); controlPanel.setHeight("30px"); controlPanel.setLayoutLeftMargin(55); Button btnOk = null; btnOk = new Button("Ok"); btnOk.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { onOkClick(); } }); Button btnClose = new Button(CAPTION_CLOSE); btnClose.setTop(10); btnClose.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { closeForm(); } }); controlPanel.addMember(btnOk); controlPanel.addMember(btnClose); layout.addMember(accountForm); if (linkRegistration != null) layout.addMember(linkRegistration); layout.addMember(labelException); layout.addMember(controlPanel); addItem(layout); }