@Override protected void onRender(Element parent, int pos) { super.onRender(parent, pos); VerticalPanel vp = new VerticalPanel(); vp.setSpacing(10); vp.add(createStandard()); vp.add(createMulti()); vp.add(createMulti2()); vp.add(createMixed()); add(vp); };
@Override protected void onRender(Element parent, int index) { super.onRender(parent, index); numberRenderer = new NumberCellRenderer<Grid<Stock>>(currency); change = new GridCellRenderer<Stock>() { public String render( Stock model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<Stock> store, Grid<Stock> grid) { double val = (Double) model.get(property); String style = val < 0 ? "red" : "green"; return "<span style='color:" + style + "'>" + number.format(val) + "</span>"; } }; gridNumber = new GridCellRenderer<Stock>() { public String render( Stock model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<Stock> store, Grid<Stock> grid) { return numberRenderer.render(null, property, model.get(property)); } }; vp = new VerticalPanel(); vp.setSpacing(20); createGrid(false); createGrid(true); add(vp); }
@Override public void addComponent() { VerticalPanel verticalPanel = new VerticalPanel(); verticalPanel.setSpacing(10); FieldSet fieldSet = new FieldSet(); fieldSet.setHeading("Share Project to Users"); fieldSet.setWidth(GPProjectManagementWidget.COMPONENT_WIDTH - 25); this.projectNameLabel = new Label(); this.projectNameLabel.setStyleAttribute("font-size", "13"); this.ownerLabel = new Label(); this.ownerLabel.setStyleAttribute("font-size", "13"); this.organizationLabel = new Label(); this.organizationLabel.setStyleAttribute("font-size", "13"); fieldSet.add(this.projectNameLabel, new MarginData(10)); fieldSet.add(ownerLabel, new MarginData(10)); fieldSet.add(organizationLabel, new MarginData(10)); verticalPanel.add(fieldSet); // LayoutContainer labelListContainer = new LayoutContainer(new BorderLayout()); labelListContainer.setHeight(20); labelListContainer.setStyleAttribute("background-color", "white"); labelListContainer.setWidth(GPProjectManagementWidget.COMPONENT_WIDTH - 25); Label organizationUserLabel = new Label("Organization Users:"); organizationUserLabel.setStyleAttribute("font-size", "13"); organizationUserLabel.setStyleAttribute("font-weight", "bold"); labelListContainer.add(organizationUserLabel, new BorderLayoutData(Style.LayoutRegion.WEST)); Label projectSharedUserLabel = new Label("Project Shared Users:"); projectSharedUserLabel.setStyleAttribute("font-size", "13"); projectSharedUserLabel.setStyleAttribute("font-weight", "bold"); labelListContainer.add(projectSharedUserLabel, new BorderLayoutData(Style.LayoutRegion.EAST)); verticalPanel.add(labelListContainer); // final DualListField<GPSimpleUser> lists = new DualListField<GPSimpleUser>(); lists.setMode(Mode.INSERT); lists.setHeight("" + GPProjectManagementWidget.COMPONENT_HEIGHT / 1.75); lists.setStyleAttribute("margin-left", "11px"); lists.setHideLabel(Boolean.TRUE); ListField<GPSimpleUser> from = lists.getFromList(); from.setDisplayField(GPSimpleUserKeyValue.NAME.toString()); this.fromStore = new ListStore<GPSimpleUser>(); from.setStore(this.fromStore); ListField<GPSimpleUser> to = lists.getToList(); to.setDisplayField(GPSimpleUserKeyValue.NAME.toString()); this.toStore = new ListStore<GPSimpleUser>(); to.setStore(this.toStore); Button cancelButton = new Button( "GoTo Search Project", BasicWidgetResources.ICONS.gear(), new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { ShareProjectPanel.this.reset(); projectManagementWidget.showSearchProjectPanel(); } }); super.addButton(cancelButton); saveButton = new Button( "Save", BasicWidgetResources.ICONS.save(), new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { toStore.commitChanges(); List<Long> accountIDsProject = Lists.newArrayListWithCapacity(toStore.getModels().size()); IGPAccountDetail accountDetail = Registry.get(UserSessionEnum.ACCOUNT_DETAIL_IN_SESSION.name()); boolean test = false; for (GPSimpleUser user : toStore.getModels()) { if (user.getId().equals(accountDetail.getId())) { test = true; } accountIDsProject.add(user.getId()); } final boolean isShared = test; ShareProjectPanel.this.reset(); LayerRemote.Util.getInstance() .shareProjectToUsers( project.getId(), accountIDsProject, new AsyncCallback<Boolean>() { @Override public void onFailure(Throwable caught) { System.out.println("Error on saving user to share project"); } @Override public void onSuccess(Boolean result) { // System.out.println("Project is Shared: // " + isShared); if (project.isDefaultProject()) { GPClientProject projInSession = Registry.get(UserSessionEnum.CURRENT_PROJECT_ON_TREE.name()); if (isShared) { projInSession.setShared(Boolean.TRUE); } else { projInSession.setShared(Boolean.FALSE); } } project.setShared(Boolean.TRUE); loadData(project); } }); } }); super.addButton(saveButton); super.add(verticalPanel); super.add(lists, new FormData("98%")); LayoutContainer filterContainer = new LayoutContainer(new BorderLayout()); this.fromFilter = this.createServerFilter(this.fromFilter, fromStore, "Organization Users"); filterContainer.add(this.fromFilter, new BorderLayoutData(Style.LayoutRegion.WEST)); this.toFilter = this.createServerFilter(this.toFilter, toStore, "Sharing User List"); filterContainer.add(this.toFilter, new BorderLayoutData(Style.LayoutRegion.EAST)); filterContainer.setStyleAttribute("margin", "11px"); super.add(filterContainer); }
private void createUploadComponent(String uploadAction, final GPExtensions... extensions) { uploaderProgressBar = new UploaderProgressBar(); formPanel.setAction(GWT.getModuleBaseURL() + uploadAction); formPanel.setEncoding(FormPanel.ENCODING_MULTIPART); formPanel.setMethod(FormPanel.METHOD_POST); this.verticalPanel = new VerticalPanel(); this.queryParameter = new Hidden(); this.verticalPanel.add(queryParameter); formPanel.setWidget(verticalPanel); fileUpload = new FileUpload(); fileUpload.setName("uploadFormElement"); verticalPanel.add(fileUpload); buttonSubmit = new Button( ButtonsConstants.INSTANCE.submitText(), new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { uploaderProgressBar.show("Uploading..."); formPanel.submit(); if ((fileUpload.getFilename() != null) && isValidExtensions(fileUpload.getFilename(), extensions)) { LayoutManager.getInstance() .getStatusMap() .setBusy(BasicWidgetConstants.INSTANCE.GPFileUploader_uploadInProgressText()); } } }); verticalPanel.add(buttonSubmit); // Add an event handler to the form. formPanel.addSubmitHandler( new FormPanel.SubmitHandler() { @Override public void onSubmit(SubmitEvent event) { // This event is fired just before the form is submitted. We can // take this opportunity to perform validation if (!isValidExtensions(fileUpload.getFilename(), extensions)) { uploaderProgressBar.hide(); LayoutManager.getInstance() .getStatusMap() .setStatus( BasicWidgetConstants.INSTANCE.GPFileUploader_failedStatusText(), EnumSearchStatus.STATUS_NO_SEARCH.toString()); GeoPlatformMessage.errorMessage( BasicWidgetConstants.INSTANCE.GPFileUploader_failedErrorMessageTitleText(), BasicWidgetConstants.INSTANCE.GPFileUploader_failedErrorKindFileBodyText()); event.cancel(); formPanel.reset(); } } }); formPanel.addSubmitCompleteHandler( new FormPanel.SubmitCompleteHandler() { @Override public void onSubmitComplete(SubmitCompleteEvent event) { // When the form submission is successfully completed, // this event is fired. Assuming the service returned a // response of type text/html, we can get the result text here // (see the FormPanel documentation for further explanation) htmlResult = event.getResults(); System.out.println("HTML Result: " + htmlResult); // Execute this code only if the session is still alive if (htmlResult.contains("Session Timeout")) { GPHandlerManager.fireEvent(new GPLoginEvent(null)); } else if (!htmlResult.contains("HTTP ERROR")) { formPanel.reset(); htmlResult = htmlResult.replaceAll("<pre>", ""); htmlResult = htmlResult.replaceAll("</pre>", ""); htmlResult = htmlResult.replaceAll( "<pre style=\"word-wrap: break-word; white-space: pre-wrap;\">", ""); if (GPSharedUtils.isNotEmpty(htmlResult)) { // logger.info("HTMLResult: " + htmlResult); uploadEvent.setResult(htmlResult); GPHandlerManager.fireEvent(uploadEvent); // done.enable(); // mapPreviewWidget.drawAoiOnMap(wkt); LayoutManager.getInstance() .getStatusMap() .setStatus( BasicWidgetConstants.INSTANCE.GPFileUploader_successStatusText(), EnumSearchStatus.STATUS_SEARCH.toString()); } else { LayoutManager.getInstance() .getStatusMap() .setStatus( BasicWidgetConstants.INSTANCE.GPFileUploader_failedStatusText(), EnumSearchStatus.STATUS_NO_SEARCH.toString()); } } else { GeoPlatformMessage.errorMessage( BasicWidgetConstants.INSTANCE.GPFileUploader_failedErrorMessageTitleText(), BasicWidgetConstants.INSTANCE.GPFileUploader_failedErrorGenericBodyText()); LayoutManager.getInstance() .getStatusMap() .setStatus( BasicWidgetConstants.INSTANCE.GPFileUploader_failedStatusText(), EnumSearchStatus.STATUS_NO_SEARCH.toString()); } uploaderProgressBar.hide(); } }); }
protected void onRender(Element target, int index) { super.onRender(target, index); final FitLayout fl = new FitLayout(); LayoutContainer layoutContainer = new LayoutContainer(); layoutContainer.setBorders(false); layoutContainer.setLayout(fl); VerticalPanel vp = new VerticalPanel(); vp.setSpacing(3); ContentPanel cpGrid = new ContentPanel(); cpGrid.setHeaderVisible(true); cpGrid.setHeading("Lista Dipendenti."); cpGrid.setBorders(false); cpGrid.setFrame(true); cpGrid.setHeight((h - 65)); cpGrid.setWidth(w - 250); cpGrid.setScrollMode(Scroll.AUTO); cpGrid.setLayout(new FitLayout()); cpGrid.setButtonAlign(HorizontalAlignment.CENTER); Resizable r = new Resizable(cpGrid); btnPrint = new Button(); btnPrint.setEnabled(true); btnPrint.setIcon(AbstractImagePrototype.create(MyImages.INSTANCE.print24())); btnPrint.setIconAlign(IconAlign.TOP); btnPrint.setToolTip("Stampa"); btnPrint.setSize(26, 26); btnPrint.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { SessionManagementService.Util.getInstance() .setDatiReportCostiDip( "RIEP.COSTI", store.getModels(), new AsyncCallback<Boolean>() { @Override public void onFailure(Throwable caught) { Window.alert("Error on setNomeReport()"); } @Override public void onSuccess(Boolean result) { if (result) fp.submit(); else Window.alert( "Problemi durante il settaggio dei parametri in Sessione (http)"); } }); } }); btnAdd = new Button(); btnAdd.setStyleAttribute("padding-left", "2px"); btnAdd.setIcon(AbstractImagePrototype.create(MyImages.INSTANCE.add())); btnAdd.setIconAlign(IconAlign.TOP); btnAdd.setSize(26, 26); btnAdd.setToolTip("Nuova Offerta"); btnAdd.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { RiepilogoCostiDipendentiModel am = new RiepilogoCostiDipendentiModel( 0, 0, "", "0.00", "", "0", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "", "", ""); gridRiepilogo.stopEditing(); store.insert(am, 0); gridRiepilogo.startEditing(store.indexOf(am), 0); } }); btnConfirm = new Button(); btnConfirm.setEnabled(true); btnConfirm.setIcon(AbstractImagePrototype.create(MyImages.INSTANCE.confirm())); btnConfirm.setIconAlign(IconAlign.TOP); btnConfirm.setToolTip("Conferma modifiche"); btnConfirm.setSize(26, 26); btnConfirm.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { RiepilogoCostiDipendentiModel c = new RiepilogoCostiDipendentiModel(); for (Record record : store.getModifiedRecords()) { c = (RiepilogoCostiDipendentiModel) record.getModel(); AdministrationService.Util.getInstance() .editDatiCostiAzienda( c, new AsyncCallback<Boolean>() { @Override public void onFailure(Throwable caught) { Window.alert("Errore di connessione on insertNewOffertaWithRda();"); } @Override public void onSuccess(Boolean result) { if (result) { caricaTabellaDati(); } else { Window.alert( "error: Impossibile effettuare l'inserimento/modifica dei dati!"); } } }); } } }); if ((ruolo.compareTo("PM") == 0)) { btnConfirm.disable(); btnAdd.disable(); } smplcmbxSede = new SimpleComboBox<String>(); smplcmbxSede.setFieldLabel("Sede"); smplcmbxSede.setWidth(65); smplcmbxSede.setEmptyText("Sede.."); smplcmbxSede.setAllowBlank(false); smplcmbxSede.add("T"); smplcmbxSede.add("B"); smplcmbxSede.setStyleAttribute("padding-left", "2px"); smplcmbxSede.addListener( Events.Select, new Listener<BaseEvent>() { @Override public void handleEvent(BaseEvent be) { caricaTabellaDati(); } }); // caricaTabellaDati(); cm = new ColumnModel(createColumns()); gridRiepilogo = new EditorGrid<RiepilogoCostiDipendentiModel>(store, cm); gridRiepilogo.setBorders(false); gridRiepilogo.setColumnLines(true); gridRiepilogo.setStripeRows(true); gridRiepilogo.setItemId("grid"); gridRiepilogo.setSelectionModel(csm); fp.setMethod(FormPanel.METHOD_POST); fp.setAction(url); fp.addSubmitCompleteHandler(new FormSubmitCompleteHandler()); fp.add(btnPrint); ContentPanel cp = new ContentPanel(); cp.setHeaderVisible(false); cp.add(fp); ToolBar tlBar = new ToolBar(); tlBar.add(smplcmbxSede); tlBar.add(btnAdd); tlBar.add(btnConfirm); tlBar.add(new SeparatorToolItem()); tlBar.add(cp); cpGrid.setTopComponent(tlBar); cpGrid.add(gridRiepilogo); layoutContainer.add(cpGrid, new FitData(3, 3, 3, 3)); add(layoutContainer); }
Widget initwidget() { VerticalPanel v = new VerticalPanel(); v.setSpacing(2); TabPanel tabpanel = new TabPanel(); tabpanel.setPlain(true); tabpanel.setHeight(450); tabpanel.setWidth(760); TabItem t1 = new TabItem(); t1.setText("配偶"); VerticalPanel vt1 = new VerticalPanel(); vt1.setSpacing(2); vt1.add(createbcode_Spouse_Form()); t1.add(vt1); t1.setScrollMode(Scroll.AUTO); TabItem t2 = new TabItem(); t2.setText("家庭成员"); VerticalPanel vt2 = new VerticalPanel(); vt2.setSpacing(2); vt2.add(create_bcode_famify_Grid()); t2.add(vt2); t2.setScrollMode(Scroll.AUTO); TabItem t3 = new TabItem(); t3.setText("紧急联络方式"); VerticalPanel vt3 = new VerticalPanel(); vt3.setSpacing(2); vt3.add(create_bcode_contact_Grid()); t3.add(vt3); t3.setScrollMode(Scroll.AUTO); tabpanel.add(t3); tabpanel.add(t2); tabpanel.add(t1); v.add(tabpanel); this.add(v); return null; }
private Widget initWeigetx() { VerticalPanel vpanel = new VerticalPanel(); vpanel.add(createGrid()); return vpanel; }
private void createGrid(boolean widget) { List<ColumnConfig> configs = new ArrayList<ColumnConfig>(); ColumnConfig column = new ColumnConfig(); column.setId("name"); column.setHeader("Company"); column.setWidth(200); configs.add(column); column = new ColumnConfig(); column.setId("symbol"); column.setHeader("Symbol"); column.setWidth(100); configs.add(column); column = new ColumnConfig(); column.setId("last"); column.setHeader("Last"); column.setAlignment(HorizontalAlignment.RIGHT); column.setWidth(75); column.setRenderer(gridNumber); configs.add(column); column = new ColumnConfig("change", "Change", 100); column.setAlignment(HorizontalAlignment.RIGHT); column.setRenderer(change); configs.add(column); column = new ColumnConfig("date", 125); if (widget) { Button btn = new Button("Updated"); btn.addListener( Events.OnClick, new Listener<ButtonEvent>() { public void handleEvent(ButtonEvent be) { // stop column from getting click and causing sort be.cancelBubble(); } }); btn.setStyleAttribute("float", "left"); column.setWidget(btn, "Last Updated"); } else { column.setAlignment(HorizontalAlignment.RIGHT); column.setHeader("Last Updated"); } column.setDateTimeFormat(DateTimeFormat.getFormat("MM/dd/yyyy")); configs.add(column); ListStore<Stock> store = new ListStore<Stock>(); store.add(TestData.getStocks()); ColumnModel cm = new ColumnModel(configs); cm.addHeaderGroup(0, 0, new HeaderGroupConfig("Header Grouping Example", 1, 5)); cm.addHeaderGroup(1, 2, new HeaderGroupConfig("Stock Performance", 1, 2)); if (widget) { Slider s = new Slider(); s.setWidth(100); // ugly, but centers slider FlexTable tbl = new FlexTable(); tbl.setWidth("100%"); tbl.setHTML(0, 0, " "); tbl.setHTML( 0, 1, "<span style='white-space: nowrap;font-size: 11px'>Slide Me: </span>"); tbl.setWidget(0, 2, s); tbl.setHTML(0, 3, " "); tbl.getCellFormatter().setWidth(0, 0, "50%"); tbl.getCellFormatter().setWidth(0, 3, "50%"); cm.addHeaderGroup(1, 0, new HeaderGroupConfig(tbl, 1, 2)); } else { cm.addHeaderGroup(1, 0, new HeaderGroupConfig("Stock Information", 1, 2)); } ContentPanel cp = new ContentPanel(); cp.setBodyBorder(false); cp.setIcon(Resources.ICONS.table()); cp.setHeading(widget ? "Column Grouping with Widget" : "Column Grouping"); cp.setButtonAlign(HorizontalAlignment.CENTER); cp.setLayout(new FitLayout()); cp.setSize(600, 300); Grid<Stock> grid = new Grid<Stock>(store, cm); grid.setStyleAttribute("borderTop", "none"); grid.getView().setForceFit(true); grid.setBorders(true); cp.add(grid); vp.add(cp); }