use of com.google.gwt.user.client.ui.SuggestBox in project opennms by OpenNMS.
the class VSearchBox method onLoad.
@Override
public void onLoad() {
m_componentHolder.clear();
this.setStyleName("topology-search");
final TextBoxBase textField = new TextBox();
textField.setWidth("245px");
textField.setStyleName("topology-search-box");
textField.getElement().setAttribute("placeholder", "Search...");
textField.setFocus(true);
RemoteSuggestOracle oracle = new RemoteSuggestOracle();
m_suggestBox = new SuggestBox(oracle, textField);
m_suggestBox.addSelectionHandler(new SelectionHandler<SuggestOracle.Suggestion>() {
@Override
public void onSelection(SelectionEvent<SuggestOracle.Suggestion> event) {
SearchSuggestion selectedItem = (SearchSuggestion) event.getSelectedItem();
textField.setText("");
m_connector.addToFocus(selectedItem);
}
});
if (m_isMultiValued) {
m_suggestBox.setStyleName("multivalue");
}
m_suggestBox.addStyleName("wideTextField");
m_suggestBox.addSelectionHandler(this);
m_suggestBox.addKeyUpHandler(this);
m_componentHolder.setWidth("245px");
m_componentHolder.add(m_suggestBox);
if (m_focusedContainer == null) {
m_focusedContainer = new VerticalPanel();
m_scrollContainer = new FlowPanel();
m_scrollContainer.add(m_focusedContainer);
}
m_focusedContainer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
m_focusedContainer.setTitle("Focused Vertices");
m_componentHolder.add(m_scrollContainer);
Timer timer = new Timer() {
@Override
public void run() {
updateScrollPanelSize();
}
};
timer.schedule(1000);
m_windowResizeRegistration = Window.addResizeHandler(new ResizeHandler() {
@Override
public void onResize(ResizeEvent event) {
updateScrollPanelSize();
}
});
}
use of com.google.gwt.user.client.ui.SuggestBox 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.user.client.ui.SuggestBox in project opentsdb by OpenTSDB.
the class MetricForm method assembleUi.
private void assembleUi() {
setWidth("100%");
{
// Left hand-side panel.
final HorizontalPanel hbox = new HorizontalPanel();
final InlineLabel l = new InlineLabel();
l.setText("Metric:");
hbox.add(l);
final SuggestBox suggest = RemoteOracle.newSuggestBox("metrics", metric);
suggest.setLimit(40);
hbox.add(suggest);
hbox.setWidth("100%");
metric.setWidth("100%");
tagtable.setWidget(0, 0, hbox);
tagtable.getFlexCellFormatter().setColSpan(0, 0, 3);
addTag();
tagtable.setText(1, 0, "Tags");
add(tagtable);
}
{
// Right hand-side panel.
final VerticalPanel vbox = new VerticalPanel();
{
final HorizontalPanel hbox = new HorizontalPanel();
hbox.add(rate);
hbox.add(rate_counter);
hbox.add(x1y2);
vbox.add(hbox);
}
{
final HorizontalPanel hbox = new HorizontalPanel();
final InlineLabel l = new InlineLabel("Rate Ctr Max:");
hbox.add(l);
hbox.add(counter_max);
vbox.add(hbox);
}
{
final HorizontalPanel hbox = new HorizontalPanel();
final InlineLabel l = new InlineLabel("Rate Ctr Reset:");
hbox.add(l);
hbox.add(counter_reset_value);
vbox.add(hbox);
}
{
final HorizontalPanel hbox = new HorizontalPanel();
final InlineLabel l = new InlineLabel();
l.setText("Aggregator:");
hbox.add(l);
hbox.add(aggregators);
vbox.add(hbox);
}
vbox.add(downsample);
{
final HorizontalPanel hbox = new HorizontalPanel();
hbox.add(downsampler);
hbox.add(interval);
hbox.add(fill_policy);
vbox.add(hbox);
}
add(vbox);
}
}
use of com.google.gwt.user.client.ui.SuggestBox in project opentsdb by OpenTSDB.
the class MetricForm method autoSuggestTag.
public void autoSuggestTag(final String tag) {
// First try to see if the tag is already in the table.
final int nrows = tagtable.getRowCount();
int unused_row = -1;
for (int row = 1; row < nrows; row++) {
final SuggestBox tagname = ((SuggestBox) tagtable.getWidget(row, 1));
final SuggestBox tagvalue = ((SuggestBox) tagtable.getWidget(row, 2));
final String thistag = tagname.getValue();
if (thistag.equals(tag)) {
// This tag is already in the table.
return;
}
if (thistag.isEmpty() && tagvalue.getValue().isEmpty()) {
unused_row = row;
break;
}
}
if (unused_row >= 0) {
((SuggestBox) tagtable.getWidget(unused_row, 1)).setValue(tag);
} else {
addTag(tag);
}
}
use of com.google.gwt.user.client.ui.SuggestBox in project opentsdb by OpenTSDB.
the class MetricForm method addTag.
private void addTag(final String default_tagname, final String default_value, final boolean is_groupby) {
final int row = tagtable.getRowCount();
final ValidatedTextBox tagname = new ValidatedTextBox();
final SuggestBox suggesttagk = RemoteOracle.newSuggestBox("tagk", tagname);
final ValidatedTextBox tagvalue = new ValidatedTextBox();
final SuggestBox suggesttagv = RemoteOracle.newSuggestBox("tagv", tagvalue);
final CheckBox groupby = new CheckBox();
groupby.setValue(is_groupby);
groupby.setTitle("Group by");
groupby.addClickHandler(events_handler);
tagname.setValidationRegexp(TSDB_ID_RE);
tagvalue.setValidationRegexp(TSDB_TAGVALUE_RE);
tagname.setWidth("100%");
tagvalue.setWidth("100%");
tagname.addBlurHandler(recompact_tagtable);
tagname.addBlurHandler(events_handler);
tagname.addKeyPressHandler(events_handler);
tagvalue.addBlurHandler(recompact_tagtable);
tagvalue.addBlurHandler(events_handler);
tagvalue.addKeyPressHandler(events_handler);
tagtable.setWidget(row, 1, suggesttagk);
tagtable.setWidget(row, 2, suggesttagv);
tagtable.setWidget(row, 3, groupby);
if (row > 2) {
final Button remove = new Button("x");
remove.addClickHandler(removetag);
tagtable.setWidget(row - 1, 0, remove);
}
if (default_tagname != null) {
tagname.setText(default_tagname);
if (default_value == null) {
tagvalue.setFocus(true);
}
}
if (default_value != null) {
tagvalue.setText(default_value);
}
}
Aggregations