use of com.google.gwt.user.client.ui.TextBox in project rstudio by rstudio.
the class CreateBranchDialog method textBox.
private TextBox textBox() {
TextBox textBox = new TextBox();
textBox.getElement().getStyle().setProperty("minWidth", "200px");
return textBox;
}
use of com.google.gwt.user.client.ui.TextBox in project perun by CESNET.
the class PerunSearchParametersWidget method rebuild.
/**
* Method which rebuild whole searcher widget when number of params changes
*/
protected void rebuild() {
ft.clear();
//ft.setHTML(0, 0, "<h3>" + "Search by parameters:" + "</h3>");
//ft.getFlexCellFormatter().setColSpan(0, 0, 4);
int row = 1;
for (Map.Entry<ListBoxWithObjects<AttributeDefinition>, TextBox> entry : inputs.entrySet()) {
final ListBoxWithObjects<AttributeDefinition> lb = entry.getKey();
int selectedItem = lb.getSelectedIndex();
lb.clear();
lb.addAllItems(availableAttrDefs);
lb.setSelectedIndex(selectedItem);
CustomButton rb = new CustomButton("", SmallIcons.INSTANCE.deleteIcon());
ft.setWidget(row, 0, lb);
ft.setText(row, 1, "=");
ft.setWidget(row, 2, entry.getValue());
ft.setWidget(row, 3, rb);
if (inputs.entrySet().size() <= 1) {
// allow remove if more than 1
rb.setEnabled(false);
rb.setTitle("Enabled only when more than 1 parameter is used.");
}
rb.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
inputs.keySet().remove(lb);
rebuild();
}
});
row++;
}
ft.setWidget(row, 0, addParameterButton);
ft.setHTML(row, 1, "");
ft.setWidget(row, 2, searchButton);
}
use of com.google.gwt.user.client.ui.TextBox in project perun by CESNET.
the class PerunSearchParametersWidget method addParameter.
/**
* Adds a parameter
*/
protected void addParameter() {
TextBox tb = new TextBox();
final ListBoxWithObjects<AttributeDefinition> lb = new ListBoxWithObjects<AttributeDefinition>();
inputs.put(lb, tb);
lb.addAllItems(availableAttrDefs);
rebuild();
}
use of com.google.gwt.user.client.ui.TextBox in project perun by CESNET.
the class GetApplicationForm method createWidget.
/**
* Create approval style change widget
*
* @param form
*/
private void createWidget(final ApplicationForm form) {
final CustomButton button = TabMenu.getPredefinedButton(ButtonType.SETTINGS, ButtonTranslation.INSTANCE.changeAppFormSettings());
if (form != null) {
// create click handler
ClickHandler ch = new ClickHandler() {
public void onClick(ClickEvent event) {
// layout
FlexTable ft = new FlexTable();
ft.setCellSpacing(10);
ft.setHTML(0, 0, "<strong>INITIAL: </strong>");
ft.setHTML(1, 0, "<strong>EXTENSION: </strong>");
ft.setHTML(2, 0, "<strong>Module name: </strong>");
// widgets
final ListBox lbInit = new ListBox();
final ListBox lbExt = new ListBox();
final TextBox className = new TextBox();
lbInit.addItem("Automatic", "true");
lbInit.addItem("Manual", "false");
lbExt.addItem("Automatic", "true");
lbExt.addItem("Manual", "false");
if (form.getAutomaticApproval() == true) {
lbInit.setSelectedIndex(0);
} else {
lbInit.setSelectedIndex(1);
}
if (form.getAutomaticApprovalExtension() == true) {
lbExt.setSelectedIndex(0);
} else {
lbExt.setSelectedIndex(1);
}
className.setText(form.getModuleClassName());
ft.setWidget(0, 1, lbInit);
ft.setWidget(1, 1, lbExt);
ft.setWidget(2, 1, className);
// click on save
ClickHandler click = new ClickHandler() {
public void onClick(ClickEvent event) {
// switch and send request
UpdateForm request = new UpdateForm(new JsonCallbackEvents() {
public void onFinished(JavaScriptObject jso) {
// recreate same widget
content.clear();
ApplicationForm newForm = jso.cast();
createWidget(newForm);
}
;
});
form.setAutomaticApproval(Boolean.parseBoolean(lbInit.getValue(lbInit.getSelectedIndex())));
form.setAutomaticApprovalExtension(Boolean.parseBoolean(lbExt.getValue(lbExt.getSelectedIndex())));
form.setModuleClassName(className.getText().trim());
request.updateForm(form);
}
};
Confirm c = new Confirm("Change application form settings", ft, click, true);
c.show();
}
};
button.addClickHandler(ch);
String appStyle = "<strong>Approval style: </strong>";
String module = "</br><strong>Module name: </strong>" + form.getModuleClassName();
if (form.getAutomaticApproval() == true) {
appStyle = appStyle + "<span style=\"color:red;\">Automatic</span> (INITIAL)";
} else {
appStyle = appStyle + "<span style=\"color:red;\">Manual</span> (INITIAL)";
}
if (form.getAutomaticApprovalExtension() == true) {
appStyle = appStyle + " <span style=\"color:red;\">Automatic</span> (EXTENSION)";
} else {
appStyle = appStyle + " <span style=\"color:red;\">Manual</span> (EXTENSION)";
}
if (form.getGroup() == null && !session.isVoAdmin(form.getVo().getId()))
button.setEnabled(false);
if (form.getGroup() != null && (!session.isGroupAdmin(form.getGroup().getId()) && !session.isVoAdmin(form.getVo().getId())))
button.setEnabled(false);
content.setHTML(0, 0, appStyle + module);
content.setWidget(0, 1, button);
content.getFlexCellFormatter().getElement(0, 0).setAttribute("style", "padding-right: 10px");
} else {
button.setEnabled(false);
String appStyle = "<strong>Approval style: </strong> Form doesn't exists.";
String module = "</br><strong>Module name: </strong> Form doesn't exists.";
content.setHTML(0, 0, appStyle + module);
content.setWidget(0, 1, button);
content.getFlexCellFormatter().getElement(0, 0).setAttribute("style", "padding-right: 10px");
}
}
use of com.google.gwt.user.client.ui.TextBox in project gerrit by GerritCodeReview.
the class CopyableLabel method copy.
private void copy() {
TextBox t = new TextBox();
try {
t.setText(getText());
content.add(t);
t.setFocus(true);
t.selectAll();
boolean ok = execCommand("copy");
Tooltip.setLabel(copier, ok ? CopyableLabelText.I.copied() : CopyableLabelText.I.failed());
if (!ok) {
// Disable JavaScript clipboard and try flash movie in another instance.
UserAgent.disableJavaScriptClipboard();
}
} finally {
t.removeFromParent();
}
}
Aggregations