use of com.google.gwt.event.dom.client.ChangeHandler in project drools-wb by kiegroup.
the class FromAccumulateCompositeFactPatternWidget method showSourcePatternSelector.
/**
* Pops up the fact selector.
*/
protected void showSourcePatternSelector() {
final ListBox box = new ListBox();
AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle();
String[] facts = oracle.getFactTypes();
box.addItem(GuidedRuleEditorResources.CONSTANTS.Choose());
for (int i = 0; i < facts.length; i++) {
box.addItem(facts[i]);
}
box.setSelectedIndex(0);
final FormStylePopup popup = new FormStylePopup(GuidedRuleEditorResources.CONSTANTS.NewFactPattern());
popup.addAttribute(GuidedRuleEditorResources.CONSTANTS.chooseFactType(), box);
box.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
getFromAccumulatePattern().setSourcePattern(new FactPattern(box.getItemText(box.getSelectedIndex())));
setModified(true);
getModeller().refreshWidget();
popup.hide();
}
});
final Button fromBtn = new Button(HumanReadableConstants.INSTANCE.From());
final Button fromAccumulateBtn = new Button(HumanReadableConstants.INSTANCE.FromAccumulate());
final Button fromCollectBtn = new Button(HumanReadableConstants.INSTANCE.FromCollect());
final Button fromEntryPointBtn = new Button(HumanReadableConstants.INSTANCE.FromEntryPoint());
ClickHandler btnsClickHandler = new ClickHandler() {
public void onClick(ClickEvent event) {
Widget sender = (Widget) event.getSource();
if (sender == fromBtn) {
getFromAccumulatePattern().setSourcePattern(new FromCompositeFactPattern());
} else if (sender == fromAccumulateBtn) {
getFromAccumulatePattern().setSourcePattern(new FromAccumulateCompositeFactPattern());
} else if (sender == fromCollectBtn) {
getFromAccumulatePattern().setSourcePattern(new FromCollectCompositeFactPattern());
} else if (sender == fromEntryPointBtn) {
getFromAccumulatePattern().setSourcePattern(new FromEntryPointFactPattern());
} else {
throw new IllegalArgumentException("Unknown sender: " + sender);
}
setModified(true);
getModeller().refreshWidget();
popup.hide();
}
};
fromBtn.addClickHandler(btnsClickHandler);
fromAccumulateBtn.addClickHandler(btnsClickHandler);
fromCollectBtn.addClickHandler(btnsClickHandler);
fromEntryPointBtn.addClickHandler(btnsClickHandler);
popup.addAttribute("", fromBtn);
popup.addAttribute("", fromAccumulateBtn);
popup.addAttribute("", fromCollectBtn);
popup.addAttribute("", fromEntryPointBtn);
popup.show();
}
use of com.google.gwt.event.dom.client.ChangeHandler in project drools-wb by kiegroup.
the class FromAccumulateCompositeFactPatternWidget method showFactTypeSelector.
/**
* Pops up the fact selector.
*/
@Override
protected void showFactTypeSelector() {
final ListBox box = GWT.create(ListBox.class);
AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle();
String[] facts = oracle.getFactTypes();
box.addItem(GuidedRuleEditorResources.CONSTANTS.Choose());
for (int i = 0; i < facts.length; i++) {
box.addItem(facts[i]);
}
box.setSelectedIndex(0);
final FormStylePopup popup = new FormStylePopup(GuidedRuleEditorResources.CONSTANTS.NewFactPattern());
popup.addAttribute(GuidedRuleEditorResources.CONSTANTS.chooseFactType(), box);
box.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
pattern.setFactPattern(new FactPattern(box.getItemText(box.getSelectedIndex())));
setModified(true);
getModeller().refreshWidget();
popup.hide();
}
});
popup.show();
}
use of com.google.gwt.event.dom.client.ChangeHandler in project kie-wb-common by kiegroup.
the class ContainerRulesConfigView method init.
@PostConstruct
public void init() {
version.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
if (!version.getText().trim().isEmpty()) {
StyleHelper.addUniqueEnumStyleName(versionForm, ValidationState.class, ValidationState.NONE);
}
}
});
version.getElement().setAttribute("placeholder", getVersionTextBoxPlaceholder());
interval.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
if (!interval.getText().trim().isEmpty()) {
StyleHelper.addUniqueEnumStyleName(scannerForm, ValidationState.class, ValidationState.NONE);
}
}
});
interval.getElement().setAttribute("placeholder", getIntervalTextBoxPlaceholder());
interval.getElement().setAttribute("data-original-title", getIntervalTextBoxDataOriginalTitle());
Option ms = new Option();
ms.setText(translationService.format(Constants.ContainerRulesConfigView_Milliseconds));
ms.setValue(ContainerRulesConfigPresenter.MS);
ms.setSelected(true);
intervalTimeUnit.add(ms);
Option s = new Option();
s.setText(translationService.format(Constants.ContainerRulesConfigView_Seconds));
s.setValue(ContainerRulesConfigPresenter.S);
intervalTimeUnit.add(s);
Option m = new Option();
m.setText(translationService.format(Constants.ContainerRulesConfigView_Minutes));
m.setValue(ContainerRulesConfigPresenter.M);
intervalTimeUnit.add(m);
Option h = new Option();
h.setText(translationService.format(Constants.ContainerRulesConfigView_Hours));
h.setValue(ContainerRulesConfigPresenter.H);
intervalTimeUnit.add(h);
Option d = new Option();
d.setText(translationService.format(Constants.ContainerRulesConfigView_Days));
d.setValue(ContainerRulesConfigPresenter.D);
intervalTimeUnit.add(d);
}
use of com.google.gwt.event.dom.client.ChangeHandler in project kie-wb-common by kiegroup.
the class CopyPopupView method init.
@Override
public void init(final CopyPopupPresenter presenter) {
this.presenter = presenter;
templateName.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
if (!templateName.getText().trim().isEmpty()) {
StyleHelper.addUniqueEnumStyleName(templateNameGroup, ValidationState.class, ValidationState.NONE);
templateNameHelp.setVisible(false);
}
}
});
this.modal.setTitle(getCopyServerTemplatePopupTitle());
this.modal.setBody(this);
this.templateNameLabel.setText(getTemplateNameLabelText());
this.modal.add(new ModalFooterOKCancelButtons(new Command() {
@Override
public void execute() {
presenter.save();
}
}, new Command() {
@Override
public void execute() {
hide();
}
}));
}
use of com.google.gwt.event.dom.client.ChangeHandler in project data-access by pentaho.
the class AnalysisImportDialogController method createWorkingForm.
private void createWorkingForm() {
if (formPanel == null) {
formPanel = new FormPanel();
formPanel.setMethod(FormPanel.METHOD_POST);
formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
formPanel.setAction(MONDRIAN_POSTANALYSIS_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);
analysisFileUpload = new FileUpload();
analysisFileUpload.setName("uploadAnalysis");
analysisFileUpload.getElement().setId("analysisFileUpload");
analysisFileUpload.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
schemaNameLabel.setValue(((FileUpload) event.getSource()).getFilename());
importDialogModel.setUploadedFile(((FileUpload) event.getSource()).getFilename());
acceptButton.setDisabled(!isValid());
}
});
mainFormPanel.add(analysisFileUpload);
VerticalPanel vp = (VerticalPanel) hiddenArea.getManagedObject();
vp.add(formPanel);
// addSubmitHandler(); moved to GwtDataSourceEditorEntryPoint
}
}
Aggregations