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

The following examples show how to use com.google.gwt.user.client.ui.MultiWordSuggestOracle. 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 check out the related API usage on the sidebar.
Example #1
Source File: PlaygroundView.java    From caja with 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 File: EditorHarness.java    From swellrt with 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 File: EditorHarness.java    From incubator-retired-wave with 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 File: RBACContextView.java    From core with 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 #5
Source File: PlaygroundUI.java    From caja with 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 #6
Source File: AcceptorForm.java    From core with 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 #7
Source File: DiscoveryGroupForm.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public DiscoveryGroupForm(FormToolStrip.FormCallback<DiscoveryGroup> callback, boolean create) {
    isCreate = create;
    if(!isCreate)this.callback = callback;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);

}
 
Example #8
Source File: ConnectorForm.java    From core with 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 #9
Source File: ClusterConnectionForm.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public ClusterConnectionForm(FormToolStrip.FormCallback<ClusterConnection> callback, boolean create) {
    isCreate = create;
    if(!isCreate)this.callback = callback;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);

}
 
Example #10
Source File: BroadcastGroupForm.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public BroadcastGroupForm(FormToolStrip.FormCallback<BroadcastGroup> callback, boolean create) {
    isCreate = create;
    if(!isCreate)this.callback = callback;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);

}
 
Example #11
Source File: DefaultBridgeForm.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
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
Source File: ConnectorServiceForm.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
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 #13
Source File: HeapBoxItem.java    From core with 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 #14
Source File: DefaultBridgeForm.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
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 #15
Source File: DivertForm.java    From core with 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 #16
Source File: DefaultBridgeForm.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
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 #17
Source File: DivertForm.java    From core with 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 #18
Source File: ClusterConnectionForm.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public ClusterConnectionForm(FormToolStrip.FormCallback<ClusterConnection> callback) {
    this.callback = callback;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);
}
 
Example #19
Source File: LocalSocketForm.java    From core with 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 #20
Source File: AcceptorForm.java    From core with 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;
}
 
Example #21
Source File: SecDomainPresenter.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
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 #22
Source File: DiscoveryGroupForm.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public DiscoveryGroupForm(FormToolStrip.FormCallback<DiscoveryGroup> callback) {
    this.callback = callback;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);
}
 
Example #23
Source File: ConnectorForm.java    From core with 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 #24
Source File: ConnectorServiceForm.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public ConnectorServiceForm(MsgConnectionsPresenter presenter, FormToolStrip.FormCallback<ActivemqConnectorService> callback) {
    this.presenter = presenter;
    this.callback = callback;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.emptyList());
}
 
Example #25
Source File: BroadcastGroupForm.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public BroadcastGroupForm(FormToolStrip.FormCallback<BroadcastGroup> callback) {
    this.callback = callback;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);
}
 
Example #26
Source File: ConnectorServiceForm.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public ConnectorServiceForm(FormToolStrip.FormCallback<ConnectorService> callback, boolean create) {
    this.callback = callback;
    isCreate = create;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);
}
 
Example #27
Source File: ConnectorServiceForm.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public ConnectorServiceForm(FormToolStrip.FormCallback<ConnectorService> callback) {
    this.callback = callback;
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);

}
 
Example #28
Source File: DefaultBridgeForm.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public DefaultBridgeForm(FormToolStrip.FormCallback<Bridge> callback) {
    this.callback = callback;
    form.setNumColumns(2);
    oracle = new MultiWordSuggestOracle();
    oracle.setDefaultSuggestionsFromText(Collections.EMPTY_LIST);
}
 
Example #29
Source File: DivertForm.java    From core with 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 #30
Source File: DivertForm.java    From core with 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);
}