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());
}
}
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());
}
}
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;
}
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();
}
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();
}
Aggregations