Java Code Examples for com.google.gwt.user.client.ui.MultiWordSuggestOracle

The following examples show how to use com.google.gwt.user.client.ui.MultiWordSuggestOracle. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: caja   Source File: PlaygroundView.java    License: Apache License 2.0 6 votes vote down vote up
public PlaygroundView(Playground controller) {
  this.controller = controller;
  this.sourceExamples = new MultiWordSuggestOracle();
  this.policyExamples = new MultiWordSuggestOracle();

  this.playgroundUI =
    new com.google.caja.demos.playground.client.ui.PlaygroundUI(
        sourceExamples, policyExamples);
  RootLayoutPanel.get().add(playgroundUI);
  initSourcePanel();
  initPolicyPanel();
  initFeedbackPanel();
  initExamples();
  initEditor();
  initCaja(true);
  initPlusOne();
  initUnsafe();
}
 
Example 2
Source Project: swellrt   Source File: EditorHarness.java    License: Apache License 2.0 6 votes vote down vote up
void initContentOracle() {
  contentOracle = new MultiWordSuggestOracle();

  contentSuggestBox = new SuggestBox(contentOracle);
  contentSuggestBox.getElement().setId("content-box");

  // Some initial content xml strings
  contentOracle.add("");
  contentOracle.add("abcd");

  contentSuggestBox.addSelectionHandler(new SelectionHandler<SuggestOracle.Suggestion>() {
    @Override public void onSelection(SelectionEvent<SuggestOracle.Suggestion> event) {
      setFromContentBox();
    }
  });

  String[] extra = extendSampleContent();
  if (extra != null) {
    for (String content : extra) {
      contentOracle.add(content);
    }
  }
}
 
Example 3
Source Project: incubator-retired-wave   Source File: EditorHarness.java    License: Apache License 2.0 6 votes vote down vote up
void initContentOracle() {
  contentOracle = new MultiWordSuggestOracle();

  contentSuggestBox = new SuggestBox(contentOracle);
  contentSuggestBox.getElement().setId("content-box");

  // Some initial content xml strings
  contentOracle.add("");
  contentOracle.add("abcd");

  contentSuggestBox.addSelectionHandler(new SelectionHandler<SuggestOracle.Suggestion>() {
    @Override public void onSelection(SelectionEvent<SuggestOracle.Suggestion> event) {
      setFromContentBox();
    }
  });

  String[] extra = extendSampleContent();
  if (extra != null) {
    for (String content : extra) {
      contentOracle.add(content);
    }
  }
}
 
Example 4
Source Project: caja   Source File: PlaygroundUI.java    License: Apache License 2.0 5 votes vote down vote up
public PlaygroundUI(MultiWordSuggestOracle sourceSuggestions,
    MultiWordSuggestOracle policySuggestions) {
  addressField = new SuggestBox(sourceSuggestions);
  policyAddressField = new SuggestBox(policySuggestions);

  initWidget(UI_BINDER.createAndBindUi(this));
}
 
Example 5
Source Project: core   Source File: HeapBoxItem.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public Widget asWidget() {

    MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
    oracle.add("32m");
    oracle.add("64m");
    oracle.add("128m");
    oracle.add("256m");
    oracle.add("512m");
    oracle.add("1024m");

    setOracle(oracle);
    return super.asWidget();
}
 
Example 6
Source Project: core   Source File: DivertForm.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
public DivertForm(MsgDestinationsPresenter presenter,
        FormToolStrip.FormCallback<ActivemqDivert> callback) {
    this.presenter = presenter;
    this.callback = callback;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.emptyList());
}
 
Example 7
Source Project: core   Source File: DivertForm.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
public DivertForm(MsgDestinationsPresenter presenter,
        FormToolStrip.FormCallback<ActivemqDivert> callback, boolean create) {
    this.presenter = presenter;
    this.callback = callback;
    isCreate = create;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.emptyList());
}
 
Example 8
public DefaultBridgeForm(MsgConnectionsPresenter presenter, FormToolStrip.FormCallback<ActivemqBridge> callback) {
    this.presenter = presenter;
    this.callback = callback;
    form.setNumColumns(2);
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.emptyList());
}
 
Example 9
public DefaultBridgeForm(MsgConnectionsPresenter presenter, FormToolStrip.FormCallback<ActivemqBridge> callback, boolean provideTools) {
    this.presenter = presenter;
    this.callback = callback;
    this.provideTools = provideTools;
    form.setNumColumns(2);
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.emptyList());
}
 
Example 10
public ConnectorServiceForm(MsgConnectionsPresenter presenter, FormToolStrip.FormCallback<ActivemqConnectorService> callback, boolean create) {
    this.presenter = presenter;
    this.callback = callback;
    isCreate = create;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.emptyList());
}
 
Example 11
public DefaultBridgeForm(FormToolStrip.FormCallback<Bridge> callback, boolean provideTools) {
    this.callback = callback;
    this.provideTools = provideTools;
    form.setNumColumns(2);
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);
}
 
Example 12
public BroadcastGroupForm(FormToolStrip.FormCallback<BroadcastGroup> callback, boolean create) {
    isCreate = create;
    if(!isCreate)this.callback = callback;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);

}
 
Example 13
public ClusterConnectionForm(FormToolStrip.FormCallback<ClusterConnection> callback, boolean create) {
    isCreate = create;
    if(!isCreate)this.callback = callback;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);

}
 
Example 14
Source Project: core   Source File: ConnectorForm.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
public ConnectorForm(FormToolStrip.FormCallback<Connector> callback, ConnectorType type, boolean create) {
    this.callback = callback;
    isCreate = create;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);
    this.type = type;
}
 
Example 15
public DiscoveryGroupForm(FormToolStrip.FormCallback<DiscoveryGroup> callback, boolean create) {
    isCreate = create;
    if(!isCreate)this.callback = callback;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);

}
 
Example 16
Source Project: core   Source File: AcceptorForm.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
public AcceptorForm(FormToolStrip.FormCallback<Acceptor> callback, AcceptorType type, boolean create) {
    this.callback = callback;
    isCreate = create;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);
    this.type = type;
}
 
Example 17
Source Project: core   Source File: RBACContextView.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
private Widget asWidget() {
    VerticalPanel container = new VerticalPanel();
    container.setStyleName("fill-layout");

    HorizontalPanel menu = new HorizontalPanel();
    menu.setStyleName("fill-layout-width");
    final TextBox nameBox = new TextBox();
    nameBox.setText(securityFramework.resolveToken());

    MultiWordSuggestOracle oracle = new  MultiWordSuggestOracle();
    oracle.addAll(Console.MODULES.getRequiredResourcesRegistry().getTokens());

    SuggestBox suggestBox = new SuggestBox(oracle, nameBox);

    Button btn = new Button("Show", new ClickHandler() {
        @Override
        public void onClick(ClickEvent clickEvent) {
            container.clear();

            try {
                container.add(createContent(nameBox.getText()));
            } catch (Throwable e) {
                HTML msg = new HTML(e.getMessage());
                msg.getElement().getStyle().setColor("red");
                container.add(msg);
            }
        }
    });
    menu.add(new HTML("Token: "));
    menu.add(suggestBox);
    menu.add(btn);


    VerticalPanel p = new VerticalPanel();
    p.setStyleName("fill-layout-width");
    p.add(menu);
    p.add(container);
    return p;
}
 
Example 18
Source Project: core   Source File: LocalSocketForm.java    License: GNU Lesser General Public License v2.1 4 votes vote down vote up
public LocalSocketForm(FormToolStrip.FormCallback<LocalSocketBinding> callback) {
    this.callback = callback;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.<String>emptyList());
}
 
Example 19
public void onLaunchAddWizard(final AddressTemplate type, final List<String> codes) {

        final SecurityContext securityContext =
                getSecurityFramework().getSecurityContext(getProxy().getNameToken());

        final ResourceDescription resourceDescription = getDescriptionRegistry().lookup(type);

        final DefaultWindow dialog = new DefaultWindow(Console.MESSAGES.newTitle(type.getResourceType()));

        AddResourceDialog addDialog = new AddResourceDialog(securityContext, resourceDescription,
                new AddResourceDialog.Callback() {
                    @Override
                    public void onAdd(ModelNode payload) {
                        dialog.hide();


                        ModelNode compositeOp = new ModelNode();
                        compositeOp.get(ADDRESS).setEmptyList();
                        compositeOp.get(OP).set(COMPOSITE);

                        List<ModelNode> steps = new LinkedList<>();

                        String resourceType = type.getResourceType();
                        for (SubResource subResource : SubResource.values()) {
                            if (subResource.getModuleDef().equals(resourceType)) {
                                if (missingContainer.contains(subResource)) {
                                    // create parent resource if necessary
                                    ModelNode addOp = new ModelNode();
                                    ResourceAddress address = SEC_DOMAIN.append(subResource.getType() + "=classic").resolve(
                                            statementContext, domain, payload.get("name").asString()
                                    );

                                    addOp.get(ADDRESS).set(address);
                                    addOp.get(OP).set(ADD);
                                    steps.add(addOp);
                                }
                                break;
                            }
                        }

                        final ResourceAddress fqAddress =
                                type.resolve(statementContext, domain, payload.get("name").asString());

                        payload.get(OP).set(ADD);
                        payload.get(ADDRESS).set(fqAddress);

                        steps.add(payload);

                        compositeOp.get(STEPS).set(steps);

                        dispatcher.execute(new DMRAction(compositeOp), new SimpleCallback<DMRResponse>() {

                            @Override
                            public void onFailure(Throwable caught) {
                                super.onFailure(caught);
                                loadDomain();
                            }

                            @Override
                            public void onSuccess(DMRResponse dmrResponse) {
                                Console.info(Console.MESSAGES.successfullyAdded(fqAddress.toString()));
                                loadDomain();
                            }
                        });


                    }

                    @Override
                    public void onCancel() {
                        dialog.hide();
                    }
                }

        )
                // custom field for code attribute
                .addFactory("code", attributeDescription -> {
                    SuggestBoxItem item = new SuggestBoxItem("code", "Code", true);
                    MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
                    oracle.setDefaultSuggestionsFromText(codes);
                    oracle.addAll(codes);
                    item.setOracle(oracle);
                    return item;
                });

        dialog.setWidth(640);
        dialog.setHeight(480);
        dialog.setWidget(addDialog);
        dialog.setGlassEnabled(true);
        dialog.center();
    }
 
Example 20
public ConnectorServiceForm(MsgConnectionsPresenter presenter, FormToolStrip.FormCallback<ActivemqConnectorService> callback) {
    this.presenter = presenter;
    this.callback = callback;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.emptyList());
}
 
Example 21
Source Project: core   Source File: DivertForm.java    License: GNU Lesser General Public License v2.1 4 votes vote down vote up
public DivertForm(FormToolStrip.FormCallback<Divert> callback) {
    this.callback = callback;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);
}
 
Example 22
Source Project: core   Source File: DivertForm.java    License: GNU Lesser General Public License v2.1 4 votes vote down vote up
public DivertForm(FormToolStrip.FormCallback<Divert> callback, boolean create) {
    this.callback = callback;
    isCreate = create;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);
}
 
Example 23
public DefaultBridgeForm(FormToolStrip.FormCallback<Bridge> callback) {
    this.callback = callback;
    form.setNumColumns(2);
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);
}
 
Example 24
public ConnectorServiceForm(FormToolStrip.FormCallback<ConnectorService> callback) {
    this.callback = callback;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);

}
 
Example 25
public ConnectorServiceForm(FormToolStrip.FormCallback<ConnectorService> callback, boolean create) {
    this.callback = callback;
    isCreate = create;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);
}
 
Example 26
public BroadcastGroupForm(FormToolStrip.FormCallback<BroadcastGroup> callback) {
    this.callback = callback;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);
}
 
Example 27
public ClusterConnectionForm(FormToolStrip.FormCallback<ClusterConnection> callback) {
    this.callback = callback;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);
}
 
Example 28
Source Project: core   Source File: ConnectorForm.java    License: GNU Lesser General Public License v2.1 4 votes vote down vote up
public ConnectorForm(FormToolStrip.FormCallback<Connector> callback, ConnectorType type) {
    this.callback = callback;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);
    this.type = type;
}
 
Example 29
public DiscoveryGroupForm(FormToolStrip.FormCallback<DiscoveryGroup> callback) {
    this.callback = callback;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);
}
 
Example 30
Source Project: core   Source File: AcceptorForm.java    License: GNU Lesser General Public License v2.1 4 votes vote down vote up
public AcceptorForm(FormToolStrip.FormCallback<Acceptor> callback, AcceptorType type) {
    this.callback = callback;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);
    this.type = type;
}