Search in sources :

Example 11 with FormPanel

use of com.google.gwt.user.client.ui.FormPanel in project data-access by pentaho.

the class GwtDatasourceEditorEntryPoint method showEditAnalysisDialog.

public void showEditAnalysisDialog(final DialogListener listener, final IDatasourceInfo datasourceInfo) {
    final DialogListener<AnalysisImportDialogModel> importDialoglistener = new DialogListener<AnalysisImportDialogModel>() {

        public void onDialogCancel() {
            final AnalysisImportDialogController controller = importDialog.getAnalysisImportDialogController();
            final FormPanel analysisDataFormPanel = controller.getFormPanel();
            controller.removeHiddenPanels();
            controller.buildAndSetParameters();
            analysisDataFormPanel.removeFromParent();
            RootPanel.get().add(analysisDataFormPanel);
        }

        public void onDialogAccept(final AnalysisImportDialogModel importDialogModel) {
            final AnalysisImportDialogController controller = importDialog.getAnalysisImportDialogController();
            final FormPanel analysisDataFormPanel = controller.getFormPanel();
            controller.removeHiddenPanels();
            controller.buildAndSetParameters(true);
            analysisDataFormPanel.removeFromParent();
            RootPanel.get().add(analysisDataFormPanel);
            analysisDataFormPanel.addSubmitCompleteHandler(new SubmitCompleteHandler() {

                @Override
                public void onSubmitComplete(SubmitCompleteEvent event) {
                    String results = event.getResults();
                    String message = controller.convertToNLSMessage(results, controller.getFileName());
                    if (!SUCCESS_3.equals(results)) {
                        if (OVERWRITE_8.equals(results) || OVERWRITE__CATALOG_7.equals(results)) {
                            overwriteFileDialog(analysisDataFormPanel, message, controller);
                        } else {
                            listener.onDialogError(message);
                        }
                    } else {
                        analysisDataFormPanel.removeFromParent();
                        listener.onDialogAccept(null);
                    }
                }
            });
            analysisDataFormPanel.submit();
        }

        public void onDialogReady() {
        }

        public void onDialogError(String errorMessage) {
            listener.onDialogError(errorMessage);
        }
    };
    final AsyncConstructorListener<GwtImportDialog> constructorListener = new AsyncConstructorListener<GwtImportDialog>() {

        public void asyncConstructorDone(GwtImportDialog dialog) {
            dialog.showAnalysisImportDialog(importDialoglistener, datasourceInfo);
        }
    };
    if (importDialog == null) {
        importDialog = new GwtImportDialog(constructorListener);
    } else {
        importDialog.showAnalysisImportDialog(importDialoglistener, datasourceInfo);
    }
}
Also used : AnalysisImportDialogController(org.pentaho.platform.dataaccess.datasource.ui.importing.AnalysisImportDialogController) FormPanel(com.google.gwt.user.client.ui.FormPanel) DialogListener(org.pentaho.ui.xul.util.DialogController.DialogListener) SubmitCompleteEvent(com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent) SubmitCompleteHandler(com.google.gwt.user.client.ui.FormPanel.SubmitCompleteHandler) GwtImportDialog(org.pentaho.platform.dataaccess.datasource.ui.importing.GwtImportDialog) AsyncConstructorListener(org.pentaho.ui.xul.gwt.util.AsyncConstructorListener) AnalysisImportDialogModel(org.pentaho.platform.dataaccess.datasource.ui.importing.AnalysisImportDialogModel)

Example 12 with FormPanel

use of com.google.gwt.user.client.ui.FormPanel in project data-access by pentaho.

the class GwtDatasourceEditorEntryPoint method showMetadataImportDialog.

public void showMetadataImportDialog(final DialogListener listener) {
    final DialogListener<MetadataImportDialogModel> importDialoglistener = new DialogListener<MetadataImportDialogModel>() {

        public void onDialogCancel() {
            final MetadataImportDialogController controller = importDialog.getMetadataImportDialogController();
            final FormPanel analysisDataFormPanel = controller.getFormPanel();
            controller.removeHiddenPanels();
            controller.buildAndSetParameters();
            analysisDataFormPanel.removeFromParent();
            RootPanel.get().add(analysisDataFormPanel);
        }

        public void onDialogAccept(final MetadataImportDialogModel importDialogModel) {
            final MetadataImportDialogController controller = importDialog.getMetadataImportDialogController();
            final FormPanel metaDataFormPanel = controller.getFormPanel();
            controller.removeHiddenPanels();
            controller.buildAndSetParameters();
            metaDataFormPanel.removeFromParent();
            RootPanel.get().add(metaDataFormPanel);
            controller.setImportCompleteCallback(new MetadataImportDialogController.ImportCompleteCallback() {

                @Override
                public void onImportSuccess() {
                    listener.onDialogAccept(null);
                }

                @Override
                public void onImportCancel() {
                    listener.onDialogCancel();
                }
            });
            metaDataFormPanel.submit();
        }

        public void onDialogReady() {
        }

        @Override
        public void onDialogError(String errorMessage) {
            listener.onDialogError(errorMessage);
        }
    };
    final AsyncConstructorListener<GwtImportDialog> constructorListener = new AsyncConstructorListener<GwtImportDialog>() {

        public void asyncConstructorDone(GwtImportDialog dialog) {
            dialog.showMetadataImportDialog(importDialoglistener);
        }
    };
    if (importDialog == null) {
        importDialog = new GwtImportDialog(constructorListener);
    } else {
        importDialog.showMetadataImportDialog(importDialoglistener);
    }
}
Also used : FormPanel(com.google.gwt.user.client.ui.FormPanel) MetadataImportDialogController(org.pentaho.platform.dataaccess.datasource.ui.importing.MetadataImportDialogController) DialogListener(org.pentaho.ui.xul.util.DialogController.DialogListener) MetadataImportDialogModel(org.pentaho.platform.dataaccess.datasource.ui.importing.MetadataImportDialogModel) GwtImportDialog(org.pentaho.platform.dataaccess.datasource.ui.importing.GwtImportDialog) AsyncConstructorListener(org.pentaho.ui.xul.gwt.util.AsyncConstructorListener)

Example 13 with FormPanel

use of com.google.gwt.user.client.ui.FormPanel in project data-access by pentaho.

the class MetadataImportDialogController method createWorkingForm.

private void createWorkingForm() {
    if (formPanel == null) {
        formPanel = new FormPanel();
        formPanel.setMethod(FormPanel.METHOD_POST);
        formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
        formPanel.setAction(UPLOAD_URL);
        formPanel.getElement().getStyle().setProperty("position", "absolute");
        formPanel.getElement().getStyle().setProperty("visibility", "hidden");
        formPanel.getElement().getStyle().setProperty("overflow", "hidden");
        formPanel.getElement().getStyle().setProperty("clip", "rect(0px,0px,0px,0px)");
        mainFormPanel = new FlowPanel();
        formPanel.add(mainFormPanel);
        propertiesFileImportPanel = new FlowPanel();
        mainFormPanel.add(propertiesFileImportPanel);
        formDomainIdText = new TextBox();
        formDomainIdText.setName("domainId");
        mainFormPanel.add(formDomainIdText);
        metadataFileUpload = new FileUpload();
        metadataFileUpload.setName("metadataFile");
        metadataFileUpload.getElement().setId("metaFileUpload");
        metadataFileUpload.addChangeHandler(new ChangeHandler() {

            @Override
            public void onChange(ChangeEvent event) {
                String filename = ((FileUpload) event.getSource()).getFilename();
                if (filename != null && filename.trim().length() > 0) {
                    metaFileLocation.setValue(filename);
                    importDialogModel.setUploadedFile(filename);
                    acceptButton.setDisabled(!isValid());
                } else {
                    metaFileLocation.setValue(resBundle.getString("importDialog.SELECT_METAFILE_LABEL", "browse for metadata file"));
                    importDialogModel.setUploadedFile(null);
                    acceptButton.setDisabled(!isValid());
                }
            }
        });
        mainFormPanel.add(metadataFileUpload);
        formPanel.addSubmitCompleteHandler(createSubmitCompleteHandler());
        VerticalPanel vp = (VerticalPanel) hiddenArea.getManagedObject();
        vp.add(formPanel);
    }
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) FormPanel(com.google.gwt.user.client.ui.FormPanel) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) PropertyChangeEvent(java.beans.PropertyChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) TextBox(com.google.gwt.user.client.ui.TextBox) FileUpload(com.google.gwt.user.client.ui.FileUpload)

Example 14 with FormPanel

use of com.google.gwt.user.client.ui.FormPanel in project gwt-test-utils by gwt-test-utils.

the class FormPanelPatcher method submit.

@PatchMethod
static void submit(FormPanel formPanel) {
    FormPanel.SubmitEvent event = new FormPanel.SubmitEvent();
    formPanel.fireEvent(event);
    if (!event.isCanceled()) {
        FormPanelImpl impl = GwtReflectionUtils.getPrivateFieldValue(formPanel, "impl");
        Element synthesizedFrame = GwtReflectionUtils.getPrivateFieldValue(formPanel, "synthesizedFrame");
        FormPanel.SubmitCompleteEvent completeEvent = createCompleteSubmitEvent(getResultsHtml(impl, synthesizedFrame));
        formPanel.fireEvent(completeEvent);
    }
}
Also used : FormPanel(com.google.gwt.user.client.ui.FormPanel) SubmitCompleteEvent(com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent) FormPanelImpl(com.google.gwt.user.client.ui.impl.FormPanelImpl) Element(com.google.gwt.dom.client.Element) PatchMethod(com.googlecode.gwt.test.patchers.PatchMethod)

Example 15 with FormPanel

use of com.google.gwt.user.client.ui.FormPanel in project pentaho-platform by pentaho.

the class ExecuteUrlInNewTabCommand method performOperation.

protected void performOperation() {
    MantleTabPanel contentTabPanel = SolutionBrowserPanel.getInstance().getContentTabPanel();
    // $NON-NLS-1$
    contentTabPanel.showNewURLTab(this.tabName, this.tabToolTip, "about:blank", false);
    NamedFrame namedFrame = ((IFrameTabPanel) contentTabPanel.getSelectedTab().getContent()).getFrame();
    final FormPanel form = new FormPanel(namedFrame);
    RootPanel.get().add(form);
    form.setMethod(FormPanel.METHOD_POST);
    form.setAction(url);
    // $NON-NLS-1$
    form.add(new Hidden("reportXml", URL.encode(xml)));
    form.submit();
    ((IFrameTabPanel) contentTabPanel.getSelectedTab().getContent()).setForm(form);
}
Also used : FormPanel(com.google.gwt.user.client.ui.FormPanel) MantleTabPanel(org.pentaho.mantle.client.ui.tabs.MantleTabPanel) Hidden(com.google.gwt.user.client.ui.Hidden) IFrameTabPanel(org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel) NamedFrame(com.google.gwt.user.client.ui.NamedFrame)

Aggregations

FormPanel (com.google.gwt.user.client.ui.FormPanel)15 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)6 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)5 SubmitCompleteEvent (com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent)4 Button (com.google.gwt.user.client.ui.Button)3 FileUpload (com.google.gwt.user.client.ui.FileUpload)3 SubmitCompleteHandler (com.google.gwt.user.client.ui.FormPanel.SubmitCompleteHandler)3 HTML (com.google.gwt.user.client.ui.HTML)3 GwtImportDialog (org.pentaho.platform.dataaccess.datasource.ui.importing.GwtImportDialog)3 AsyncConstructorListener (org.pentaho.ui.xul.gwt.util.AsyncConstructorListener)3 DialogListener (org.pentaho.ui.xul.util.DialogController.DialogListener)3 AccountInfo (com.google.gerrit.client.info.AccountInfo)2 SmallHeading (com.google.gerrit.client.ui.SmallHeading)2 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)2 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)2 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)2 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)2 TextBox (com.google.gwt.user.client.ui.TextBox)2 NpTextBox (com.google.gwtexpui.globalkey.client.NpTextBox)2 PropertyChangeEvent (java.beans.PropertyChangeEvent)2