List of usage examples for com.google.gwt.user.client.ui FormPanel FormPanel
public FormPanel()
From source file:com.edgenius.wiki.gwt.client.widgets.InviteDialog.java
License:Open Source License
public InviteDialog() { this.setText(Msg.consts.invite_friends()); this.setIcon(new Image(IconBundle.I.get().email())); final FormPanel form = new FormPanel(); form.setMethod(FormPanel.METHOD_POST); form.addSubmitHandler(this); form.setStyleName(Css.FORM);//from w ww.j a v a 2s . c o m form.setWidget(panel); panel.add(message); panel.add(new Label(Msg.consts.friends_email())); panel.add(emailBox); panel.add(new Label(Msg.consts.msg_to_friends())); panel.add(contentBox); ButtonBar btnBar = getButtonBar(); Button send = new Button(Msg.consts.send()); Button cancel = new Button(Msg.consts.cancel()); send.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { form.submit(); } }); cancel.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { InviteDialog.this.hidebox(); } }); btnBar.add(cancel); btnBar.add(send); panel.setSize("100%", "100%"); emailBox.setStyleName(Css.LONG_INPUT); contentBox.setStyleName(Css.LONG_TEXTBOX); panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); panel.setCellHorizontalAlignment(emailBox, HasHorizontalAlignment.ALIGN_CENTER); panel.setCellHorizontalAlignment(contentBox, HasHorizontalAlignment.ALIGN_CENTER); this.setWidget(form); }
From source file:com.eduworks.gwt.client.pagebuilder.PageAssembler.java
License:Apache License
/** preserves event handlers on element to be wrapped */ public static Widget elementToWidget(Element e, String typ) { Widget result = null;/*from w w w . ja va2 s.c o m*/ if (e != null) { int eventsSunk = DOM.getEventsSunk(e); EventListener el = DOM.getEventListener(e); if (typ == TEXT) result = TextBox.wrap(e); else if (typ == TEXT_AREA) result = TextArea.wrap(e); else if (typ == PASSWORD) result = PasswordTextBox.wrap(e); else if (typ == LABEL) result = Label.wrap(e); else if (typ == A) result = Anchor.wrap(e); else if (typ == IMAGE) result = Image.wrap(e); else if (typ == SELECT) result = ListBox.wrap(e); else if (typ == HIDDEN) result = Hidden.wrap(e); else if (typ == FILE) result = FileUpload.wrap(e); else if (typ == FORM) result = FormPanel.wrap(e, true); else if (typ == FRAME) result = Frame.wrap(e); else if (typ == SUBMIT) result = SubmitButton.wrap(e); else if (typ == BUTTON) result = Button.wrap(e); else if (typ == CHECK_BOX) result = SimpleCheckBox.wrap(e); DOM.sinkEvents(e, eventsSunk); DOM.setEventListener(e, el); } else { if (typ == TEXT) result = new TextBox(); else if (typ == TEXT_AREA) result = new TextArea(); else if (typ == PASSWORD) result = new PasswordTextBox(); else if (typ == LABEL) result = new Label(); else if (typ == A) result = new Anchor(); else if (typ == SELECT) result = new ListBox(); else if (typ == IMAGE) result = new Image(); else if (typ == HIDDEN) result = new Hidden(); else if (typ == FILE) result = new FileUpload(); else if (typ == FORM) result = new FormPanel(); else if (typ == FRAME) result = new Frame(); else if (typ == SUBMIT) result = new SubmitButton(); else if (typ == BUTTON) result = new Button(); else if (typ == CHECK_BOX) result = SimpleCheckBox.wrap(e); } return result; }
From source file:com.eduworks.gwt.client.pagebuilder.PageAssembler.java
License:Apache License
/** preserves event handlers on element to be wrapped */ public static Widget elementToWidget(String elementName, String typ) { Widget result = null;// ww w . j av a2 s . c o m Element e = DOM.getElementById(elementName); if (e != null) { int eventsSunk = DOM.getEventsSunk(e); EventListener el = DOM.getEventListener(e); if (typ == TEXT) result = TextBox.wrap(e); else if (typ == TEXT_AREA) result = TextArea.wrap(e); else if (typ == PASSWORD) result = PasswordTextBox.wrap(e); else if (typ == LABEL) result = Label.wrap(e); else if (typ == A) result = Anchor.wrap(e); else if (typ == SELECT) result = ListBox.wrap(e); else if (typ == IMAGE) result = Image.wrap(e); else if (typ == HIDDEN) result = Hidden.wrap(e); else if (typ == FILE) result = FileUpload.wrap(e); else if (typ == FORM) result = FormPanel.wrap(e, true); else if (typ == FRAME) result = Frame.wrap(e); else if (typ == SUBMIT) result = SubmitButton.wrap(e); else if (typ == BUTTON) result = Button.wrap(e); else if (typ == CHECK_BOX) result = SimpleCheckBox.wrap(e); DOM.sinkEvents(e, eventsSunk); DOM.setEventListener(e, el); } else { if (typ == TEXT) result = new TextBox(); else if (typ == TEXT_AREA) result = new TextArea(); else if (typ == PASSWORD) result = new PasswordTextBox(); else if (typ == LABEL) result = new Label(); else if (typ == A) result = new Anchor(); else if (typ == IMAGE) result = new Image(); else if (typ == SELECT) result = new ListBox(); else if (typ == HIDDEN) result = new Hidden(); else if (typ == FILE) result = new FileUpload(); else if (typ == FORM) result = new FormPanel(); else if (typ == FRAME) result = new Frame(); else if (typ == SUBMIT) result = new SubmitButton(); else if (typ == BUTTON) result = new Button(); else if (typ == CHECK_BOX) result = SimpleCheckBox.wrap(e); } return result; }
From source file:com.ephesoft.gxt.admin.client.presenter.batchclass.BatchClassMenuPresenter.java
License:Open Source License
/** * Export batch class./*ww w . jav a2s .c o m*/ * * @param exportBatchClassEvent the export batch class event */ @EventHandler public void exportBatchClass(ExportBatchClassEvent exportBatchClassEvent) { final BatchClassDTO batchClassDTO = controller.getSelectedBatchClass(); if (null != exportBatchClassEvent && null != batchClassDTO) { final DialogWindow dialogWindow = new DialogWindow(true, null); WidgetUtil.setID(dialogWindow, "exportBatchClass_view"); final ExportBatchClassView exportBatchClassView = new ExportBatchClassView(); final ExportBatchClassPresenter<ExportBatchClassView> exportBatchClassPresenter = new ExportBatchClassPresenter<ExportBatchClassView>( controller, exportBatchClassView); exportBatchClassView.setDialogBox(dialogWindow); exportBatchClassView.setExportBatchClassIdentifier(batchClassDTO.getIdentifier()); dialogWindow.setFocusWidget(exportBatchClassView.getImportLearnedFilesRadio()); exportBatchClassPresenter.bind(); dialogWindow.center(); dialogWindow.setDialogListener(new DialogAdapter() { @Override public void onOkClick() { final FormPanel exportPanel = new FormPanel(); exportBatchClassView.getDialogBox().hide(); view.setExportFormPanel(exportPanel); view.addFormPanelEvents(exportBatchClassView.getImportLearnedFilesRadio().getValue(), batchClassDTO.getIdentifier()); exportPanel.submit(); } @Override public void onCloseClick() { dialogWindow.hide(); } @Override public void onCancelClick() { dialogWindow.hide(); } }); exportBatchClassPresenter.showBatchClassExportView(); } else { Message.display( LocaleDictionary.getLocaleDictionary().getConstantValue(BatchClassConstants.BATCH_CLASS_EXPORT), LocaleDictionary.getLocaleDictionary() .getMessageValue(BatchClassMessages.NO_BATCH_CLASS_SELECTED_FOR_PROCESSING)); } }
From source file:com.ephesoft.gxt.admin.client.presenter.document.DocumentTypeMenuPresenter.java
License:Open Source License
@EventHandler public void handleExportDocumentType(ExportSelectedDocumentsListEvent exportSelectedDocuments) { if (null != exportSelectedDocuments && !CollectionUtil.isEmpty(exportSelectedDocuments.getDocumentTypeDTOList())) { if (!controller.getSelectedBatchClass().isDirty()) { List<DocumentTypeDTO> documentList = exportSelectedDocuments.getDocumentTypeDTOList(); StringBuilder identifierList = new StringBuilder(); for (DocumentTypeDTO docTypeDTO : documentList) { identifierList.append(docTypeDTO.getIdentifier() + ";"); }//from w ww . j ava2 s . c o m final DialogWindow dialogWindow = new DialogWindow(); WidgetUtil.setID(dialogWindow, "exportDocumentType_view"); final FormPanel exportPanel = new FormPanel(); view.setExportFormPanel(exportPanel); view.addFormPanelEvents(identifierList.toString()); exportPanel.submit(); controller.getDocumentTypeView().getDocumentTypeGridView().deSelectAllModels(); controller.setSelectedDocumentType(null); exportSelectedDocuments.setDocumentTypeDTOList(null); controller.getDocumentTypeView().getDocumentTypeGridView().refresh(); } else { applyBatchClassBeforeOperation( LocaleDictionary.getConstantValue(BatchClassConstants.EXPORT_DOCUMENT_TYPE)); } } else { DialogUtil.showMessageDialog( LocaleDictionary.getConstantValue(BatchClassConstants.WARNING_TITLE), LocaleDictionary .getMessageValue(BatchClassMessages.SELECT_AT_LEAST_ONE_DOCUMENT_TYPE_TO_EXPORT), DialogIcon.WARNING); } }
From source file:com.ephesoft.gxt.admin.client.presenter.indexFiled.IndexFieldMenuPresenter.java
License:Open Source License
@EventHandler public void handleExportIndexField(ExportSelectedIndexFieldEvent exportSelectedIndexFields) { if (null != exportSelectedIndexFields) { List<FieldTypeDTO> indexFieldList = exportSelectedIndexFields.getIndexFieldDTOList(); if (null != indexFieldList) { if (!controller.getSelectedBatchClass().isDirty()) { StringBuilder identifierList = new StringBuilder(); for (FieldTypeDTO fieldTypeDTO : indexFieldList) { identifierList.append(fieldTypeDTO.getIdentifier() + ";"); }/*w ww. j av a 2s .c om*/ final DialogWindow dialogWindow = new DialogWindow(); WidgetUtil.setID(dialogWindow, "exportIndexField_view"); final FormPanel exportPanel = new FormPanel(); view.setExportFormPanel(exportPanel); view.addFormPanelEvents(identifierList.toString()); exportPanel.submit(); controller.getIndexFieldView().getIndexFieldGridView().deSelectAllModels(); controller.setSelectedFieldType(null); controller.getIndexFieldView().getIndexFieldGridView().refresh(); } else { applyBatchClassBeforeOperation( LocaleDictionary.getConstantValue(BatchClassConstants.EXPORT_INDEX_FIELD)); } } else { DialogUtil.showMessageDialog(LocaleDictionary.getConstantValue(BatchClassConstants.WARNING_TITLE), LocaleDictionary.getMessageValue(BatchClassMessages.PLEASE_SELECT_INDEX_FIELDS_TO_EXPORT), DialogIcon.WARNING); } } }
From source file:com.ephesoft.gxt.batchinstance.client.view.BatchInstanceDetailView.java
License:Open Source License
private void initializeFormPanel() { batchInstanceLogFilePath = new Hidden(BatchInfoConstants.BI_LOG_FILE_PATH); batchInstanceIdentifierField = new Hidden(BatchInfoConstants.BATCH_INSTANCE_IDENTIFIER); logFileDownloadPanel = new FormPanel(); logFliePathPanel = new VerticalPanel(); logFileDownloadPanel.add(logFliePathPanel); logFileDownloadPanel.setMethod(FormPanel.METHOD_POST); logFileDownloadPanel.setAction(LOG_FILE_DOWNLOAD_ACTION); batchInstanceLogFilePath = new Hidden(BatchInfoConstants.BI_LOG_FILE_PATH); logFliePathPanel.add(batchInstanceIdentifierField); logFliePathPanel.add(batchInstanceLogFilePath); logFileDownloadPanel.addSubmitHandler(new SubmitHandler() { @Override/*w ww . j a v a 2 s .com*/ public void onSubmit(final SubmitEvent event) { } }); logFileDownloadPanel.addSubmitCompleteHandler(new SubmitCompleteHandler() { @Override public void onSubmitComplete(final SubmitCompleteEvent event) { if (event.getResults().toLowerCase().indexOf(BatchInstanceConstants.ERROR) > -1) { DialogUtil.showMessageDialog( LocaleDictionary.getConstantValue(LocaleCommonConstants.ERROR_TITLE), LocaleDictionary.getMessageValue(BatchInstanceMessages.LOG_FILE_DOWNLOAD_ERROR_MESSAGE), DialogIcon.ERROR); // return; } } }); }
From source file:com.ephesoft.gxt.systemconfig.client.view.application.regexpool.RegexPoolOptionsView.java
License:Open Source License
/** * instantiate RegexPoolOptions View//from w w w .j ava2s . co m */ public RegexPoolOptionsView() { super(); initWidget(binder.createAndBindUi(this)); exportFormPanel = new FormPanel(); intializeMenuItems(); regexPoolMenuBar.addItem(exportRegexPoolMenuItem); regexPoolMenuBar.addItem(openMenuItem); regexPoolMenuBar.addItem(addMenuItem); regexPoolMenuBar.addItem(deleteMenuItem); intializeSelectionHandlers(); regexPoolMenuBarPanel.addStyleName("menubarPanelRegexPool"); regexPoolMenuBarPanel.add(exportFormPanel); setWidgetIds(); regexPoolMenuBar.addStyleName("menuBarRegexPool"); regexPoolMenuBar.setFocusOnHoverEnabled(false); setFormPanel(); }
From source file:com.google.appinventor.client.utils.Uploader.java
License:Open Source License
/** * Creates a new uploader.// w w w . ja v a 2 s. com */ private Uploader() { // Because we're going to add a FileUpload widget, we'll need to set the // form to use the POST method, and multipart MIME encoding. form = new FormPanel(); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setMethod(FormPanel.METHOD_POST); form.setSize("0px", "0px"); form.setVisible(false); // Add an event handler to the form. form.addFormHandler(new FormHandler() { @Override public void onSubmit(FormSubmitEvent event) { // nothing } @Override public void onSubmitComplete(FormSubmitCompleteEvent 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). String results = event.getResults(); // If the submit completely failed, results will be null. if (results == null) { callback.onFailure(new RuntimeException("Upload error")); } else { // results contains the UploadResponse value as a String. It was written on the server // side in the doPost method in ode/server/UploadServlet.java. UploadResponse uploadResponse = UploadResponse.extractUploadResponse(results); if (uploadResponse != null) { callback.onSuccess(uploadResponse); } else { callback.onFailure(new RuntimeException("Upload error")); } } } }); RootPanel.get().add(form); }
From source file:com.google.gerrit.client.account.ContactPanelShort.java
License:Apache License
private void doRegisterNewEmail() { if (!canRegisterNewEmail()) { return;/* www .j a va 2 s.com*/ } final AutoCenterDialogBox box = new AutoCenterDialogBox(true, true); final VerticalPanel body = new VerticalPanel(); final NpTextBox inEmail = new NpTextBox(); inEmail.setVisibleLength(60); final Button register = new Button(Util.C.buttonSendRegisterNewEmail()); final Button cancel = new Button(Util.C.buttonCancel()); final FormPanel form = new FormPanel(); form.addSubmitHandler(new FormPanel.SubmitHandler() { @Override public void onSubmit(final SubmitEvent event) { event.cancel(); final String addr = inEmail.getText().trim(); if (!addr.contains("@")) { new ErrorDialog(Util.C.invalidUserEmail()).center(); return; } inEmail.setEnabled(false); register.setEnabled(false); AccountApi.registerEmail("self", addr, new GerritCallback<NativeString>() { @Override public void onSuccess(NativeString result) { box.hide(); if (Gerrit.getConfig().getAuthType() == AuthType.DEVELOPMENT_BECOME_ANY_ACCOUNT) { currentEmail = addr; if (emailPick.getItemCount() == 0) { final Account me = Gerrit.getUserAccount(); me.setPreferredEmail(addr); onSaveSuccess(me); } else { save.setEnabled(true); } updateEmailList(); } } @Override public void onFailure(final Throwable caught) { inEmail.setEnabled(true); register.setEnabled(true); if (caught.getMessage().startsWith(EmailException.MESSAGE)) { final ErrorDialog d = new ErrorDialog( caught.getMessage().substring(EmailException.MESSAGE.length())); d.setText(Util.C.errorDialogTitleRegisterNewEmail()); d.center(); } else { super.onFailure(caught); } } }); } }); form.setWidget(body); register.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { form.submit(); } }); cancel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { box.hide(); } }); final FlowPanel buttons = new FlowPanel(); buttons.setStyleName(Gerrit.RESOURCES.css().patchSetActions()); buttons.add(register); buttons.add(cancel); if (Gerrit.getConfig().getAuthType() != AuthType.DEVELOPMENT_BECOME_ANY_ACCOUNT) { body.add(new HTML(Util.C.descRegisterNewEmail())); } body.add(inEmail); body.add(buttons); box.setText(Util.C.titleRegisterNewEmail()); box.setWidget(form); box.center(); inEmail.setFocus(true); }