use of com.google.gwt.event.dom.client.ChangeEvent in project rstudio by rstudio.
the class NewPackagePage method onAddTopPanelWidgets.
@Override
protected void onAddTopPanelWidgets(HorizontalPanel panel) {
dirNameLabel_.setText("Package name:");
String[] labels = { "Package" };
String[] values = { "package" };
listProjectType_ = new SelectWidget("Type:", labels, values, false);
listProjectType_.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
txtProjectName_.setFocus(true);
}
});
panel.add(listProjectType_);
}
use of com.google.gwt.event.dom.client.ChangeEvent in project rstudio by rstudio.
the class InstallPackageDialog method createMainWidget.
@Override
protected Widget createMainWidget() {
// vertical panel
VerticalPanel mainPanel = new VerticalPanel();
mainPanel.setSpacing(2);
mainPanel.setStylePrimaryName(RESOURCES.styles().mainWidget());
// source type
reposCaption_ = new CaptionWithHelp("Install from:", "Configuring Repositories", "configuring_repositories");
reposCaption_.setIncludeVersionInfo(false);
reposCaption_.setWidth("100%");
mainPanel.add(reposCaption_);
packageSourceListBox_ = new ListBox();
packageSourceListBox_.setStylePrimaryName(RESOURCES.styles().packageSourceListBox());
packageSourceListBox_.addStyleName(RESOURCES.styles().extraBottomPad());
JsArrayString repos = installContext_.selectedRepositoryNames();
if (repos.length() == 1) {
packageSourceListBox_.addItem("Repository (" + repos.get(0) + ")");
} else {
StringBuilder reposItem = new StringBuilder();
reposItem.append("Repository (");
for (int i = 0; i < repos.length(); i++) {
if (i != 0)
reposItem.append(", ");
reposItem.append(repos.get(i));
}
reposItem.append(")");
packageSourceListBox_.addItem(reposItem.toString());
}
packageSourceListBox_.addItem("Package Archive File (" + installContext_.packageArchiveExtension() + ")");
mainPanel.add(packageSourceListBox_);
// source panel container
sourcePanel_ = new SimplePanel();
sourcePanel_.setStylePrimaryName(RESOURCES.styles().packageSourcePanel());
// repos source panel
reposSourcePanel_ = new FlowPanel();
Label packagesLabel = new Label("Packages (separate multiple with space or comma):");
packagesLabel.setStylePrimaryName(RESOURCES.styles().packagesLabel());
reposSourcePanel_.add(packagesLabel);
packagesTextBox_ = new MultipleItemSuggestTextBox();
packagesSuggestBox_ = new SuggestBox(new PackageOracle(), packagesTextBox_);
packagesSuggestBox_.setWidth("100%");
packagesSuggestBox_.setLimit(20);
packagesSuggestBox_.addStyleName(RESOURCES.styles().extraBottomPad());
reposSourcePanel_.add(packagesSuggestBox_);
sourcePanel_.setWidget(reposSourcePanel_);
mainPanel.add(sourcePanel_);
// archive source panel
packageArchiveFile_ = new TextBoxWithButton("Package archive:", "Browse...", browseForArchiveClickHandler_);
// create check box here because manageUIState accesses it
installDependenciesCheckBox_ = new CheckBox();
if (defaultInstallOptions_.getInstallFromRepository())
packageSourceListBox_.setSelectedIndex(0);
else
packageSourceListBox_.setSelectedIndex(1);
manageUIState();
packageSourceListBox_.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
manageUIState();
if (!installFromRepository())
packageArchiveFile_.click();
}
});
mainPanel.add(new Label("Install to Library:"));
// library list box
libraryListBox_ = new ListBox();
libraryListBox_.setWidth("100%");
libraryListBox_.addStyleName(RESOURCES.styles().extraBottomPad());
JsArrayString libPaths = installContext_.getWriteableLibraryPaths();
int selectedIndex = 0;
for (int i = 0; i < libPaths.length(); i++) {
String libPath = libPaths.get(i);
if (!installContext_.isDevModeOn()) {
if (defaultInstallOptions_.getLibraryPath().equals(libPath))
selectedIndex = i;
}
if (libPath.equals(installContext_.getDefaultLibraryPath()))
libPath = libPath + " [Default]";
libraryListBox_.addItem(libPath);
}
libraryListBox_.setSelectedIndex(selectedIndex);
mainPanel.add(libraryListBox_);
// install dependencies check box
installDependenciesCheckBox_.addStyleName(RESOURCES.styles().installDependenciesCheckBox());
installDependenciesCheckBox_.setText("Install dependencies");
installDependenciesCheckBox_.setValue(defaultInstallOptions_.getInstallDependencies());
mainPanel.add(installDependenciesCheckBox_);
mainPanel.add(new HTML("<br/>"));
return mainPanel;
}
use of com.google.gwt.event.dom.client.ChangeEvent in project drools-wb by kiegroup.
the class VerifyFieldConstraintEditor method variableEditor.
private Widget variableEditor() {
List<String> vars = this.scenario.getFactNamesInScope(this.executionTrace, true);
final ListBox box = new ListBox();
if (this.field.getExpected() == null) {
box.addItem(CommonConstants.INSTANCE.Choose());
}
int j = 0;
for (int i = 0; i < vars.size(); i++) {
String var = vars.get(i);
FactData f = scenario.getFactTypes().get(var);
String fieldType = oracle.getFieldType(this.factType, field.getFieldName());
if (f.getType().equals(fieldType)) {
if (box.getItemCount() == 0) {
box.addItem("...");
j++;
}
box.addItem("=" + var);
if (this.field.getExpected() != null && this.field.getExpected().equals("=" + var)) {
box.setSelectedIndex(j);
}
j++;
}
}
box.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
field.setExpected(box.getItemText(box.getSelectedIndex()));
}
});
return box;
}
use of com.google.gwt.event.dom.client.ChangeEvent in project drools-wb by kiegroup.
the class FieldDataConstraintEditor method variableEditor.
private Widget variableEditor() {
List<String> vars = helper.getFactNamesInScope();
final ListBox box = new ListBox();
if (this.field.getValue() == null) {
box.addItem(TestScenarioConstants.INSTANCE.Choose());
}
int j = 0;
for (String var : vars) {
if (helper.getFactTypeByVariableName(var).getType().equals(helper.resolveFieldType())) {
if (box.getItemCount() == 0) {
box.addItem("...");
j++;
}
box.addItem("=" + var);
if (this.field.getValue() != null && this.field.getValue().equals("=" + var)) {
box.setSelectedIndex(j);
}
j++;
}
}
box.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
field.setValue(box.getItemText(box.getSelectedIndex()));
valueHasChanged(field.getValue());
}
});
return box;
}
use of com.google.gwt.event.dom.client.ChangeEvent in project drools-wb by kiegroup.
the class VerifyRulesFiredWidget method render.
private FlexTable render(final FixtureList rfl, final Scenario sc) {
FlexTable data = new FlexTable();
for (int i = 0; i < rfl.size(); i++) {
final VerifyRuleFired v = (VerifyRuleFired) rfl.get(i);
if (showResults && v.getSuccessResult() != null) {
if (!v.getSuccessResult().booleanValue()) {
data.setWidget(i, 0, new Image(CommonImages.INSTANCE.warning()));
data.setWidget(i, 4, new HTML(TestScenarioConstants.INSTANCE.ActualResult(v.getActualResult().toString())));
data.getCellFormatter().addStyleName(i, 4, // NON-NLS
"testErrorValue");
} else {
data.setWidget(i, 0, new Image(TestScenarioImages.INSTANCE.testPassed()));
}
}
data.setWidget(i, 1, new SmallLabel(v.getRuleName() + ":"));
data.getFlexCellFormatter().setAlignment(i, 1, HasHorizontalAlignment.ALIGN_RIGHT, HasVerticalAlignment.ALIGN_MIDDLE);
final ListBox b = new ListBox();
b.addItem(TestScenarioConstants.INSTANCE.firedAtLeastOnce(), "y");
b.addItem(TestScenarioConstants.INSTANCE.didNotFire(), "n");
b.addItem(TestScenarioConstants.INSTANCE.firedThisManyTimes(), "e");
final TextBox num = new TextBox();
((InputElement) num.getElement().cast()).setSize(5);
if (v.getExpectedFire() != null) {
b.setSelectedIndex((v.getExpectedFire().booleanValue()) ? 0 : 1);
num.setVisible(false);
} else {
b.setSelectedIndex(2);
String xc = (v.getExpectedCount() != null) ? "" + v.getExpectedCount().intValue() : "0";
num.setText(xc);
}
b.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
String s = b.getValue(b.getSelectedIndex());
if (s.equals("y") || s.equals("n")) {
num.setVisible(false);
v.setExpectedFire((s.equals("y")) ? Boolean.TRUE : Boolean.FALSE);
v.setExpectedCount(null);
} else {
num.setVisible(true);
v.setExpectedFire(null);
num.setText("1");
v.setExpectedCount(Integer.valueOf(1));
}
}
});
b.addItem(TestScenarioConstants.INSTANCE.ChooseDotDotDot());
num.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
v.setExpectedCount(Integer.valueOf(num.getText()));
}
});
HorizontalPanel h = new HorizontalPanel();
h.add(b);
h.add(num);
data.setWidget(i, 2, h);
Button del = new Button();
del.setIcon(IconType.TRASH);
del.setTitle(TestScenarioConstants.INSTANCE.RemoveThisRuleExpectation());
del.addClickHandler(clickEvent -> {
if (Window.confirm(TestScenarioConstants.INSTANCE.AreYouSureYouWantToRemoveThisRuleExpectation())) {
rfl.remove(v);
sc.removeFixture(v);
outer.setWidget(1, 0, render(rfl, sc));
}
});
data.setWidget(i, 3, del);
// we only want numbers here...
num.addKeyPressHandler(new KeyPressHandler() {
public void onKeyPress(KeyPressEvent event) {
if (Character.isLetter(event.getCharCode())) {
((TextBox) event.getSource()).cancelKey();
}
}
});
}
ScenarioUtils.addBottomAndRightPaddingToTableCells(data);
return data;
}
Aggregations