Search in sources :

Example 6 with XulPromptBox

use of org.pentaho.ui.xul.components.XulPromptBox in project pdi-dataservice-server-plugin by pentaho.

the class ParameterGenerationController method editParameter.

public void editParameter() throws XulException {
    ParameterGeneration parameterGeneration = checkNotNull(model.getParameterGeneration());
    XulPromptBox promptBox = createPromptBox();
    promptBox.setTitle(getString(PKG, "ParameterGenerationController.Edit.Title"));
    promptBox.setMessage(getString(PKG, "ParameterGenerationController.Edit.Message"));
    promptBox.setValue(parameterGeneration.getParameterName());
    ParameterEditor editor = new ParameterEditor(parameterGeneration);
    promptBox.addDialogCallback(editor);
    if (promptBox.open() == 0 && editor.modified) {
        model.updateParameterMap();
        model.setSelectedParameter(parameterGeneration.getParameterName());
    }
}
Also used : ParameterGeneration(org.pentaho.di.trans.dataservice.optimization.paramgen.ParameterGeneration) XulPromptBox(org.pentaho.ui.xul.components.XulPromptBox)

Example 7 with XulPromptBox

use of org.pentaho.ui.xul.components.XulPromptBox in project pdi-dataservice-server-plugin by pentaho.

the class ParameterGenerationController method addParameter.

public void addParameter() throws XulException {
    PushDownOptimizationMeta meta = new PushDownOptimizationMeta();
    ParameterGeneration parameterGeneration = factory.createPushDown();
    meta.setType(parameterGeneration);
    meta.setStepName(getStepMenuList().getSelectedItem());
    XulPromptBox promptBox = createPromptBox();
    promptBox.setTitle(getString(PKG, "ParameterGenerationController.Create.Title"));
    promptBox.setMessage(getString(PKG, "ParameterGenerationController.Create.Message"));
    ParameterEditor editor = new ParameterEditor(parameterGeneration);
    promptBox.addDialogCallback(editor);
    if (promptBox.open() == 0 && editor.modified) {
        model.add(meta);
        model.setSelectedParameter(parameterGeneration.getParameterName());
    }
}
Also used : ParameterGeneration(org.pentaho.di.trans.dataservice.optimization.paramgen.ParameterGeneration) XulPromptBox(org.pentaho.ui.xul.components.XulPromptBox) PushDownOptimizationMeta(org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta)

Example 8 with XulPromptBox

use of org.pentaho.ui.xul.components.XulPromptBox in project pdi-dataservice-server-plugin by pentaho.

the class AbstractController method createPromptBox.

public XulPromptBox createPromptBox() throws XulException {
    XulPromptBox promptBox = (XulPromptBox) document.createElement("promptbox");
    promptBox.setModalParent(xulDomContainer.getOuterContext());
    return promptBox;
}
Also used : XulPromptBox(org.pentaho.ui.xul.components.XulPromptBox)

Example 9 with XulPromptBox

use of org.pentaho.ui.xul.components.XulPromptBox in project data-access by pentaho.

the class MetadataImportDialogController method promptImportMetadata.

/**
 * Shows a promt dialog
 *
 * @param title
 * @param message
 * @param radioDSWLabel
 * @param radioMetaLabel
 * @param onResulthandler
 */
private void promptImportMetadata(final String title, final String message, final String radioDSWLabel, final String radioMetaLabel, final AsyncCallback<Boolean> onResulthandler) {
    final VerticalPanel panel = new VerticalPanel();
    // $NON-NLS-1$
    panel.add(new Label(message));
    VerticalPanel vp = new VerticalPanel();
    HorizontalPanel hp = new HorizontalPanel();
    hp.getElement().getStyle().setMarginBottom(10, Style.Unit.PX);
    hp.getElement().getStyle().setMarginTop(10, Style.Unit.PX);
    final RadioButton dswRadio = new RadioButton("importMetadata");
    RadioButton metadataRadio = new RadioButton("importMetadata");
    dswRadio.setEnabled(true);
    dswRadio.setValue(true);
    hp.add(dswRadio);
    hp.add(new Label(radioDSWLabel));
    vp.add(hp);
    HorizontalPanel hp2 = new HorizontalPanel();
    hp2.add(metadataRadio);
    hp2.add(new Label(radioMetaLabel));
    vp.add(hp2);
    panel.add(vp);
    XulPromptBox promptBox = new GwtPromptBox() {

        @Override
        public Panel getDialogContents() {
            return panel;
        }

        @Override
        public int open() {
            super.show();
            dswRadio.setFocus(true);
            return 0;
        }

        @Override
        public Panel getButtonPanel() {
            Panel button = super.getButtonPanel();
            return button;
        }
    };
    promptBox.setTitle(title);
    promptBox.setAcceptLabel(resBundle.getString("importDialog.DIALOG_OK", "OK"));
    promptBox.setCancelLabel(resBundle.getString("importDialog.DIALOG_Cancel", "Cancel"));
    promptBox.addDialogCallback(new XulDialogCallback<String>() {

        @Override
        public void onClose(XulComponent component, Status status, String value) {
            if (status == Status.CANCEL) {
                onImportCancel();
                reShowDialog();
                return;
            }
            if (onResulthandler != null) {
                onResulthandler.onSuccess(dswRadio.getValue());
            }
        }

        @Override
        public void onError(XulComponent xulComponent, Throwable throwable) {
            onResulthandler.onFailure(throwable);
        }
    });
    promptBox.setWidth(460);
    promptBox.setHeight(140);
    promptBox.open();
}
Also used : HttpStatus(org.apache.http.HttpStatus) Label(com.google.gwt.user.client.ui.Label) XulLabel(org.pentaho.ui.xul.components.XulLabel) RadioButton(com.google.gwt.user.client.ui.RadioButton) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) RootPanel(com.google.gwt.user.client.ui.RootPanel) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) FormPanel(com.google.gwt.user.client.ui.FormPanel) Panel(com.google.gwt.user.client.ui.Panel) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) GwtPromptBox(org.pentaho.ui.xul.gwt.tags.GwtPromptBox) XulPromptBox(org.pentaho.ui.xul.components.XulPromptBox) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) XulComponent(org.pentaho.ui.xul.XulComponent)

Example 10 with XulPromptBox

use of org.pentaho.ui.xul.components.XulPromptBox in project pentaho-kettle by pentaho.

the class BrowseControllerTest method shouldCreateFolderOnAcceptCreationDialog.

/*
   * Test for {@link BrowseController#createFolder()}.
   *
   * Given an opened folder creation dialog with the non-empty folder name field.
   *
   * When this prompt dialog is accepted, then a folder should be created.
   */
@Test
public void shouldCreateFolderOnAcceptCreationDialog() throws Exception {
    XulPromptBox prompt = new XulPromptBoxMock(XulDialogCallback.Status.ACCEPT);
    when(document.createElement(PROMPTBOX)).thenReturn(prompt);
    controller.createFolder();
    assertFalse(directoryMap.isEmpty());
    verify(selectedFolder).createFolder(anyString());
    verify(directoryBinding).fireSourceChanged();
    verify(selectedItemsBinding).fireSourceChanged();
}
Also used : XulPromptBox(org.pentaho.ui.xul.components.XulPromptBox) Test(org.junit.Test)

Aggregations

XulPromptBox (org.pentaho.ui.xul.components.XulPromptBox)15 XulComponent (org.pentaho.ui.xul.XulComponent)6 XulException (org.pentaho.ui.xul.XulException)6 KettleException (org.pentaho.di.core.exception.KettleException)5 ControllerInitializationException (org.pentaho.di.ui.repository.repositoryexplorer.ControllerInitializationException)4 Test (org.junit.Test)2 ParameterGeneration (org.pentaho.di.trans.dataservice.optimization.paramgen.ParameterGeneration)2 UIObjectCreationException (org.pentaho.di.ui.repository.repositoryexplorer.model.UIObjectCreationException)2 UIRepositoryObject (org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryObject)2 XulMenuitem (org.pentaho.ui.xul.components.XulMenuitem)2 XulMessageBox (org.pentaho.ui.xul.components.XulMessageBox)2 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)1 FormPanel (com.google.gwt.user.client.ui.FormPanel)1 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)1 Label (com.google.gwt.user.client.ui.Label)1 Panel (com.google.gwt.user.client.ui.Panel)1 RadioButton (com.google.gwt.user.client.ui.RadioButton)1 RootPanel (com.google.gwt.user.client.ui.RootPanel)1 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)1 HttpStatus (org.apache.http.HttpStatus)1