Example usage for com.google.gwt.user.client.ui CheckBox setValue

List of usage examples for com.google.gwt.user.client.ui CheckBox setValue

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui CheckBox setValue.

Prototype

@Override
public void setValue(Boolean value) 

Source Link

Document

Checks or unchecks the check box.

Usage

From source file:org.cleanlogic.cesiumjs4gwt.showcase.examples.TerrainClippingPlanes.java

License:Apache License

@Override
public void buildPanel() {
    ViewerOptions viewerOptions = new ViewerOptions();
    viewerOptions.skyAtmosphere = null;//from  www.j av a  2s .c o m
    final ViewerPanel csVPanel = new ViewerPanel(viewerOptions);

    CesiumTerrainProviderOptions terrainProviderOptions = new CesiumTerrainProviderOptions();
    terrainProviderOptions.url = "https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles";
    terrainProviderOptions.requestWaterMask = true;
    terrainProviderOptions.requestVertexNormals = true;
    csVPanel.getViewer().terrainProvider = new CesiumTerrainProvider(terrainProviderOptions);

    Cartesian3 position = Cartesian3.fromRadians(-2.0862979473351286, 0.6586620013036164, 1400.0);

    BoxGraphicsOptions boxGraphicsOptions = new BoxGraphicsOptions();
    boxGraphicsOptions.dimensions = new ConstantProperty<>(new Cartesian3(1400.0, 1400.0, 2800.0));
    boxGraphicsOptions.material = new ColorMaterialProperty(Color.WHITE().withAlpha(0.3f));
    boxGraphicsOptions.outline = new ConstantProperty<>(true);
    boxGraphicsOptions.outlineColor = new ConstantProperty<>(Color.WHITE());

    EntityOptions entityOptions = new EntityOptions();
    entityOptions.position = new ConstantPositionProperty(position);
    entityOptions.box = new BoxGraphics(boxGraphicsOptions);
    Entity entity = csVPanel.getViewer().entities().add(entityOptions);

    ModelGraphicsOptions modelGraphicsOptions = new ModelGraphicsOptions();
    modelGraphicsOptions.uri = new ConstantProperty<>(
            GWT.getModuleBaseURL() + "SampleData/models/CesiumMan/Cesium_Man.glb");
    modelGraphicsOptions.minimumPixelSize = new ConstantProperty<>(128);
    modelGraphicsOptions.maximumScale = new ConstantProperty<>(800);

    entityOptions = new EntityOptions();
    entityOptions.position = new ConstantPositionProperty(position);
    entityOptions.model = new ModelGraphics(modelGraphicsOptions);
    csVPanel.getViewer().entities().add(entityOptions);

    ClippingPlaneCollectionOptions clippingPlaneCollectionOptions = new ClippingPlaneCollectionOptions();
    clippingPlaneCollectionOptions.modelMatrix = entity.computeModelMatrix(JulianDate.now());
    clippingPlaneCollectionOptions.planes = new ClippingPlane[] {
            new ClippingPlane(new Cartesian3(1.0, 0.0, 0.0), -700.0),
            new ClippingPlane(new Cartesian3(-1.0, 0.0, 0.0), -700.0),
            new ClippingPlane(new Cartesian3(0.0, 1.0, 0.0), -700.0),
            new ClippingPlane(new Cartesian3(0.0, -1.0, 0.0), -700.0) };
    clippingPlaneCollectionOptions.edgeWidth = 1.0;
    clippingPlaneCollectionOptions.edgeColor = Color.WHITE();

    final Globe globe = csVPanel.getViewer().scene().globe;
    globe.depthTestAgainstTerrain = true;
    globe.clippingPlanes = new ClippingPlaneCollection(clippingPlaneCollectionOptions);

    csVPanel.getViewer().trackedEntity = entity;

    CheckBox globeClippingCBox = new CheckBox("Globe clipping planes enabled");
    globeClippingCBox.setValue(true);
    globeClippingCBox.getElement().getStyle().setColor("white");
    globeClippingCBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            globe.clippingPlanes.enabled = event.getValue();
        }
    });

    AbsolutePanel aPanel = new AbsolutePanel();
    aPanel.add(csVPanel);
    aPanel.add(globeClippingCBox, 20, 20);

    contentPanel.add(new HTML("<p>User-defined clipping planes applied to terrain.</p>"));
    contentPanel.add(aPanel);

    initWidget(contentPanel);
}

From source file:org.clevermore.monitor.client.servers.ServerStatsPopup.java

License:Apache License

public ServerStatsPopup(final Integer serverCode) {
    this.serverCode = serverCode;
    setAnimationEnabled(true);/*from   w  w w.  ja v  a 2s .c o  m*/
    setModal(true);
    setSize("760px", "450px");
    setGlassEnabled(true);

    service.getConnectedServer(serverCode, new AsyncCallback<ConnectedServer>() {

        public void onSuccess(ConnectedServer cs) {
            fp.add(new HTML("<h1>Server:" + cs.getServerCode() + ", " + cs.getName() + "</h1>"));

            fp.add(new HTML(
                    "<h2>Up Time:" + ClientStringFormatter.formatMilisecondsToHours(cs.getUpTime()) + "</h2>"));

            String gcs = "";
            for (Double gch : cs.getGcHistories()) {
                gcs += ClientStringFormatter.formatMillisShort(gch) + ";";
            }
            HTML tech = new HTML(
                    "<h2>Memory:" + ClientStringFormatter.formatMBytes(cs.getMemoryUsage().getUsed()) + " of "
                            + ClientStringFormatter.formatMBytes(cs.getMemoryUsage().getMax()) + " MB, Usage:"
                            + ClientStringFormatter.formatMillisShort(cs.getMemoryUsage().getPercentage())
                            + "%, GC Time:" + gcs + "</h2>");

            fp.add(tech);

            HTML info = new HTML("<h2>" + cs.getMoreInfo() + "</h2");
            fp.add(info);

            fp.getElement().setId("xxx");
            setWidget(fp);

            memoryChart.setStyleName("serverPopupChart");
            memory.add(memoryChart);

            memoryDetailsChart.setStyleName("serverPopupChart");
            final CheckBox heap = new CheckBox("Show Heap");
            heap.setValue(true);
            heap.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    showHeap = heap.getValue();
                    if (memoryUsages != null) {
                        updateMemoryDetailsChart(memoryUsages);
                    }
                }
            });
            memoryDetails.add(heap);
            memoryDetails.add(memoryDetailsChart);

            cpuChart.setStyleName("serverPopupChart");
            cpu.add(cpuChart);

            sysLoadChart.setStyleName("serverPopupChart");
            sysLoad.add(sysLoadChart);

            loadSecondPart();

        };

        @Override
        public void onFailure(Throwable caught) {
            Window.alert("Error loading server:" + caught.getMessage());
            Log.error("Error loading server:" + serverCode + ", Error:" + caught.getMessage(), caught);
            hide();
        }
    });

}

From source file:org.clevermore.monitor.client.servers.ServersWidget.java

License:Apache License

public ServersWidget() {
    super("Servers", 20000, (ServerWidgetServiceAsync) GWT.create(ServerWidgetService.class));

    addStyleName("serversWidget");
    serversList.setStyleName("serversWidgetInternal");
    getDataPanel().add(serversList);//from  ww w .  j  a  v a  2  s  .co m
    sp.setSize("100%", "100%");
    serversList.add(sp);

    title.setStyleName("serversHeader");
    setTitleWidget(title);
    title.add(serversLabel);
    final CheckBox chkShowOffline = new CheckBox("Show Offline");
    chkShowOffline.setValue(true);
    title.add(chkShowOffline);
    title.add(new Label("Filter:"));
    title.add(filter);

    Style style = certs.getElement().getStyle();
    style.setPadding(0, Unit.PX);
    title.add(certs);
    title.add(getRefProg());

    certs.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            getService().getCertificates(new AsyncCallback<HashMap<String, List<Certificate>>>() {

                @Override
                public void onSuccess(HashMap<String, List<Certificate>> result) {
                    new CertificatesPopup(result);
                }

                @Override
                public void onFailure(Throwable caught) {
                    Window.alert(caught.getMessage());
                }
            });
        }
    });

    String filterText = LocalStorage.readStoredItem(SERVERS_FILTER);
    if (filterText != null) {
        filter.setText(filterText.trim().toLowerCase());
    }

    filter.addKeyPressHandler(new KeyPressHandler() {

        @Override
        public void onKeyPress(KeyPressEvent event) {
            Log.debug("Key:" + event.getNativeEvent().getKeyCode());
            if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
                updateServersTable();
            }
        }
    });

    String showOff = LocalStorage.readStoredItem(SERVERS_SHOW_OFF);
    if (showOff != null && (showOff.equals("1") || showOff.equals("0"))) {
        chkShowOffline.setValue(showOff.equals("1"));
        showOffline = showOff.equals("1");
    }

    chkShowOffline.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            showOffline = chkShowOffline.getValue();
            LocalStorage.storeItem(SERVERS_SHOW_OFF, showOffline ? "1" : "0");
        }
    });

}

From source file:org.datacleaner.monitor.dashboard.widgets.ColumnParameterizedMetricPresenter.java

License:Open Source License

private Widget createMetricWidget(final MetricIdentifier metric) {
    final MetricIdentifier activeMetric = isActiveMetric(metric);
    final MetricIdentifier metricToReturn;
    if (activeMetric == null) {
        metricToReturn = metric;/*from   w  w  w. ja  va 2s.co m*/
    } else {
        metricToReturn = activeMetric;
    }

    final CheckBox checkBox = new CheckBox();
    checkBox.setTitle(metric.getDisplayName());
    checkBox.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (checkBox.getValue().booleanValue()) {
                _selectedMetrics.add(metricToReturn);
            } else {
                _selectedMetrics.remove(metricToReturn);
            }
        }
    });

    if (activeMetric == null) {
        checkBox.setValue(false);
    } else {
        checkBox.setValue(true);
        _selectedMetrics.add(metricToReturn);
    }
    return checkBox;
}

From source file:org.datacleaner.monitor.shared.widgets.StringParameterizedMetricTextBox.java

License:Open Source License

public StringParameterizedMetricTextBox(String text, final CheckBox checkBoxToActivate,
        SuggestOracle suggestOracle) {/*from  ww w.  j  a v  a  2s  . co m*/
    super(suggestOracle);
    setStyleName("form-control");
    addStyleName("StringParameterizedMetricTextBox");
    setText(text);

    getValueBox().addFocusHandler(new FocusHandler() {
        @Override
        public void onFocus(FocusEvent event) {
            showSuggestionList();
        }
    });

    if (checkBoxToActivate != null) {
        getValueBox().addKeyUpHandler(new KeyUpHandler() {
            @Override
            public void onKeyUp(KeyUpEvent event) {
                final String text = getText();
                if (text != null && !"".equals(text)) {
                    // activate checkbox whenever something is written.
                    checkBoxToActivate.setValue(true);
                }
            }
        });
    }
}

From source file:org.dataconservancy.dcs.access.client.presenter.AdminPresenter.java

License:Apache License

@Override
public void bind() {

    userService = GWT.create(UserService.class);
    registryService = GWT.create(RegistryService.class);
    saveButton = this.display.getSaveButton();
    approvedList = new ArrayList<CheckBox>();

    AsyncCallback<List<Role>> cbGetRoles = new AsyncCallback<List<Role>>() {

        @Override/*from  ww  w .  j  a  v  a  2  s. co m*/
        public void onFailure(Throwable caught) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onSuccess(final List<Role> roles) {
            userGrid = new Grid(100, roles.size() + 3);
            final HTMLTable.CellFormatter formatter = userGrid.getCellFormatter();
            userGrid.setWidth("100%");

            userGrid.setWidget(0, 0, Util.label("Name", "SubSectionHeader"));
            formatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);

            userGrid.setWidget(0, 1, Util.label("Email", "SubSectionHeader"));
            formatter.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER);

            int i = 2;
            for (Role role : roles) {
                userGrid.setWidget(0, i, Util.label(role.getName(), "SubSectionHeader"));
                formatter.setHorizontalAlignment(0, i, HasHorizontalAlignment.ALIGN_CENTER);
                i++;
            }
            userGrid.setWidget(0, i, Util.label("Resgitration Status", "SubSectionHeader"));
            formatter.setHorizontalAlignment(0, i, HasHorizontalAlignment.ALIGN_CENTER);

            display.getUsersPanel().add(userGrid);

            final int columnCount = i;

            AsyncCallback<List<Person>> cb = new AsyncCallback<List<Person>>() {

                public void onSuccess(final List<Person> userList) {

                    int i = 1;
                    roleCheckBoxes = new CheckBox[userList.size()][roles.size()];
                    for (Person user : userList) {
                        userGrid.setWidget(i, 0, new Label(user.getFirstName() + " " + user.getLastName()));
                        formatter.setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_CENTER);

                        userGrid.setWidget(i, 1, new Label(user.getEmailAddress()));
                        formatter.setHorizontalAlignment(i, 1, HasHorizontalAlignment.ALIGN_CENTER);

                        //User approval status
                        CheckBox approveCheck = new CheckBox();
                        if (user.getRegistrationStatus() == RegistrationStatus.PENDING) {
                            approveCheck.setValue(false);
                            approveCheck.setText("Approve?");
                            userGrid.setWidget(i, columnCount, approveCheck);

                        } else if (user.getRegistrationStatus() == RegistrationStatus.APPROVED) {
                            approveCheck.setValue(false);
                            userGrid.setWidget(i, columnCount, new Label("Approved"));
                        }
                        formatter.setHorizontalAlignment(i, columnCount, HasHorizontalAlignment.ALIGN_CENTER);
                        approvedList.add(approveCheck);

                        //User Role

                        int j = 2;
                        for (Role role : roles) {
                            CheckBox userCheck = new CheckBox();
                            userCheck.setName(role.getName());

                            if (user.getRole() == role)
                                userCheck.setValue(true);
                            else
                                userCheck.setValue(false);

                            userGrid.setWidget(i, j, userCheck);
                            roleCheckBoxes[i - 1][j - 2] = userCheck;
                            formatter.setHorizontalAlignment(i, j, HasHorizontalAlignment.ALIGN_CENTER);
                            j++;
                        }
                        i++;
                    }

                    userGrid.setWidget(i + 1, 5, saveButton);

                    //add a save button
                    saveButton.addClickHandler(new ClickHandler() {

                        @Override
                        public void onClick(ClickEvent event) {
                            final List<Person> sendEmailList = new ArrayList<Person>();
                            final List<Person> updatedUserList = new ArrayList<Person>();
                            for (int i = 0; i < userList.size(); i++) {
                                for (int j = 0; j < roles.size(); j++) {
                                    if (roleCheckBoxes[i][j].getValue()) {//checkbox is set, then that is the role
                                        Person updatedPerson = userList.get(i);
                                        updatedPerson.setRole(roles.get(j));
                                        updatedUserList.add(updatedPerson);
                                        break;
                                    }
                                }
                            }

                            for (int i = 0; i < approvedList.size(); i++) {
                                if (approvedList.get(i).getValue()) {
                                    Person newlyApprovedPerson = updatedUserList.get(i);
                                    newlyApprovedPerson.setRegistrationStatus(RegistrationStatus.APPROVED);
                                    sendEmailList.add(newlyApprovedPerson);
                                    updatedUserList.set(i, newlyApprovedPerson);
                                }
                            }

                            //update all users in the database

                            AsyncCallback<Void> callback = new AsyncCallback<Void>() {

                                @Override
                                public void onFailure(Throwable caught) {
                                    Window.alert("Could not update:" + caught.getMessage());
                                }

                                @Override
                                public void onSuccess(Void result) {
                                    saveButton.setText("Saved");
                                    saveButton.setEnabled(false);
                                }
                            };
                            userService.updateAllUsers(updatedUserList, sendEmailList, SeadApp.registryUrl,
                                    callback);

                        }
                    });
                }

                public void onFailure(Throwable error) {
                    new ErrorPopupPanel("Failed to retrieve users: " + error.getMessage()).show();

                }
            };

            userService.getAllUsers(cb);
        }
    };
    userService.getAllRoles(cbGetRoles);
}

From source file:org.dataconservancy.dcs.access.client.presenter.FacetedSearchPresenter.java

License:Apache License

private void displayFacets(final SearchInput searchInput, Map<String, List<String>> facets) {
    facetPanel.add(Util.label("Filter By", "GradientFacet"));
    FlexTable table = Util.createTable();
    Tree tree = new Tree();
    facetPanel.add(table);/*from w  ww.  j av  a 2s  .c  om*/
    Iterator<Map.Entry<String, List<String>>> it = facets.entrySet().iterator();

    int[] countArray = new int[10];
    Map<String, List<String>> tmp = new HashMap<String, List<String>>(facets);
    Iterator<Map.Entry<String, List<String>>> tempIt = tmp.entrySet().iterator();

    while (tempIt.hasNext()) {

        Map.Entry<String, List<String>> pair = (Map.Entry<String, List<String>>) tempIt.next();
        if (pair.getKey() != null) {
            int index = Constants.order.get(pair.getKey());
            countArray[index] = ((List<String>) pair.getValue()).size();
            tempIt.remove();
        }
    }

    int orderIndex = 0;
    int i = 0;

    while (orderIndex < Constants.displayOrder.size()) {
        List<String> tempFacets = facets.get(Constants.displayOrder.get(orderIndex));//pairs.getValue();

        TreeItem rootItem = new TreeItem();//pairs.getKey());
        //             rootItem.setHTML("<b>By " +Constants.displayOrder.get(orderIndex)+"</b>");

        rootItem.setHTML("<b>" + Constants.displayOrder.get(orderIndex) + "</b>");

        String key = "";
        Iterator tempiterator = constants.facets.entrySet().iterator();
        while (tempiterator.hasNext()) {
            Map.Entry temppairs = (Map.Entry) tempiterator.next();
            if (temppairs.getValue().equals(Constants.displayOrder.get(orderIndex)))
                key = (String) temppairs.getKey();
        }
        List<String> childFacets = SeadApp.selectedItems.get(key);

        int childExists = 0;
        //get the right index
        int index;

        if (tempFacets != null) {
            for (int j = 0; j < tempFacets.size(); j++) {

                String countStr = tempFacets.get(j).substring(tempFacets.get(j).lastIndexOf('(') + 1,
                        tempFacets.get(j).lastIndexOf(')'));
                int count = Integer.valueOf(countStr);
                if (count == 0)
                    continue;
                int facetLength = searchInput.getFacetField().length + 1;
                int flagAddFacet = 1;
                for (int k = 0; k < facetLength - 1; k++) {
                    String facetFieldKey = null;
                    Iterator iterator = constants.facets.entrySet().iterator();
                    while (iterator.hasNext()) {
                        Map.Entry pair = (Map.Entry) iterator.next();
                        if (pair.getValue().equals(Constants.displayOrder.get(orderIndex))) {
                            facetFieldKey = (String) pair.getKey();
                            break;
                        }
                    }

                    if (searchInput.getFacetField()[k].equalsIgnoreCase(facetFieldKey)
                            && searchInput.getFacetValue()[k].equalsIgnoreCase(tempFacets.get(j))) {

                        flagAddFacet = 0;
                    }
                }
                final String[] facetFieldNew;
                final String[] facetValueNew;

                if (flagAddFacet == 1) {
                    facetFieldNew = new String[facetLength];
                    facetValueNew = new String[facetLength];

                    for (int k = 0; k < facetLength - 1; k++) {
                        facetFieldNew[k] = searchInput.getFacetField()[k];
                        facetValueNew[k] = searchInput.getFacetValue()[k];
                    }

                    Iterator iterator = constants.facets.entrySet().iterator();
                    while (iterator.hasNext()) {
                        Map.Entry pair = (Map.Entry) iterator.next();
                        if (pair.getValue().equals(Constants.displayOrder.get(orderIndex))) {
                            facetFieldNew[facetLength - 1] = (String) pair.getKey();
                            break;
                        }
                    }
                    facetValueNew[facetLength - 1] = tempFacets.get(j);
                } else {
                    facetFieldNew = new String[facetLength - 1];
                    facetValueNew = new String[facetLength - 1];

                    for (int k = 0; k < facetLength - 1; k++) {
                        facetFieldNew[k] = searchInput.getFacetField()[k];
                        facetValueNew[k] = searchInput.getFacetValue()[k];
                    }
                }

                CheckBox checkBox;

                FlexTable smallTable;
                Label lbl;
                if (Constants.displayOrder.get(orderIndex).equals("metadata standard")
                        && tempFacets.get(j).contains("fgdc")) {
                    String labelValue = tempFacets.get(j);
                    labelValue = labelValue.substring(labelValue.lastIndexOf('('),
                            labelValue.lastIndexOf(')') + 1);
                    //labelValue = "FGDC"+labelValue;type filter text
                    lbl = Util.label("FGDC", "FacetHyperlink");
                    Label countLbl = new Label(" (" + countStr + ")");
                    smallTable = Util.createTable();
                    smallTable.setWidget(0, 0, lbl);
                    smallTable.setWidget(0, 1, countLbl);

                    checkBox = new CheckBox("FGDC" + " (" + countStr + ")");
                    String facetString = tempFacets.get(j).substring(0, tempFacets.get(j).lastIndexOf('('));

                    if (childFacets != null)
                        if (childFacets.contains(facetString))
                            checkBox.setValue(true);
                    checkBox.setName(facetString);
                    rootItem.addItem(checkBox);
                    rootItem.setState(false);

                } else {
                    String facetString = tempFacets.get(j).substring(0, tempFacets.get(j).lastIndexOf('('));
                    if (facetString.length() == 0) {
                        continue;
                    }
                    lbl = Util.label(facetString, "FacetHyperlink");
                    Label countLbl = new Label(" (" + countStr + ")");
                    smallTable = Util.createTable();
                    smallTable.setWidget(0, 0, lbl);
                    smallTable.setWidget(0, 1, countLbl);
                    checkBox = new CheckBox(facetString + " (" + countStr + ")");
                    checkBox.setName(facetString);
                    if (childFacets != null)
                        if (childFacets.contains(facetString))
                            checkBox.setValue(true);
                    rootItem.addItem(checkBox);
                    rootItem.setState(false);

                }
            }

            tree.addItem(rootItem);
        }
        orderIndex++;

        //it.remove();
        //change the display later
    }
    tree.addSelectionHandler(new SelectionHandler<TreeItem>() {
        @Override
        public void onSelection(SelectionEvent event) {
            TreeItem item = (TreeItem) event.getSelectedItem();
            String key = "";
            Iterator iterator = constants.facets.entrySet().iterator();
            while (iterator.hasNext()) {
                Map.Entry pairs = (Map.Entry) iterator.next();
                String value = (String) pairs.getValue();
                String itemText = item.getParentItem().getText();
                if (value.equals(itemText))
                    key = (String) pairs.getKey();
            }

            if (((CheckBox) item.getWidget()).getValue()) {
                //unselected
                List<String> children = SeadApp.selectedItems.get(key);
                children.remove(((CheckBox) item.getWidget()).getName());
                if (children.size() == 0)
                    SeadApp.selectedItems.remove(key);
                else
                    SeadApp.selectedItems.put(key, children);
            } else {
                List<String> children = SeadApp.selectedItems.get(key);
                if (children == null)
                    children = new ArrayList<String>();
                children.add(((CheckBox) item.getWidget()).getName());
                SeadApp.selectedItems.put(key, children);
            }

            int totalFacets = 0;
            iterator = SeadApp.selectedItems.entrySet().iterator();
            while (iterator.hasNext()) {
                Map.Entry pairs = (Map.Entry) iterator.next();
                List<String> facetValues = (List<String>) pairs.getValue();
                totalFacets += facetValues.size();
            }
            String[] data = new String[searchInput.getUserfields().length * 2 + totalFacets * 2 + 2];

            int i = 0;
            int index = -1;
            for (i = 0; i < searchInput.getUserfields().length; i += 2) {
                data[++index] = searchInput.getUserfields()[i].name();
                data[++index] = searchInput.getUserqueries()[i];
            }

            iterator = SeadApp.selectedItems.entrySet().iterator();
            while (iterator.hasNext()) {
                Map.Entry pairs = (Map.Entry) iterator.next();
                List<String> facetValues = (List<String>) pairs.getValue();
                for (String facetValue : facetValues) {
                    data[++index] = (String) pairs.getKey();
                    data[++index] = facetValue;
                }
            }

            data[++index] = String.valueOf(searchInput.getOffset());

            data[++index] = String.valueOf(totalFacets);

            History.newItem(SeadState.SEARCH.toToken(data));

        }
    });

    facetPanel.add(tree);
    //stop tree
}

From source file:org.drools.guvnor.client.admin.RepoConfigManager.java

License:Apache License

public DecoratorPanel getDbTypePanel() {
    FlexTable layoutA = new FlexTable();
    layoutA.setCellSpacing(6);/*  w  ww .j  a v  a  2 s  . co m*/
    FlexCellFormatter cellFormatter = layoutA.getFlexCellFormatter();

    // Add a title to the form
    layoutA.setHTML(0, 0, "RDBMS Info");
    cellFormatter.setColSpan(0, 0, 2);
    cellFormatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);

    layoutA.setHTML(1, 0, constants.SelectRdbmsType());
    final ListBox databaseList = getDatabaseList();
    databaseList.addChangeHandler(new ChangeHandler() {

        public void onChange(ChangeEvent event) {
            ListBox listBox = (ListBox) event.getSource();
            int index = listBox.getSelectedIndex();
            rdbmsConf.setDbType(listBox.getItemText(index));
            layoutB.setHTML(0, 0, listBox.getItemText(index) + " Info");
            layoutC.setHTML(0, 0, listBox.getItemText(index) + " Info");
            repoDisplayArea.setVisible(false);
            saveRepoConfigForm.setVisible(false);
        }
    });
    if (rdbmsConf.getDbType() == null || rdbmsConf.getDbType().length() < 1) {
        databaseList.setSelectedIndex(0);
    } else {
        for (int i = 0; i < databaseList.getItemCount(); i++) {
            if (rdbmsConf.getDbType().equals(databaseList.getItemText(i))) {
                databaseList.setSelectedIndex(i);
                break;
            }
        }
    }
    databaseList.addChangeHandler(new ChangeHandler() {
        public void onChange(ChangeEvent event) {
            rdbmsConf.setDbType(databaseList.getValue(databaseList.getSelectedIndex()));
        }
    });
    layoutA.setWidget(1, 1, databaseList);

    layoutA.setHTML(2, 0, constants.UseJndi());

    final CheckBox useJndi = new CheckBox();
    useJndi.setValue(rdbmsConf.isJndi());
    useJndi.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent w) {
            rdbmsConf.setJndi(useJndi.isEnabled());
            if (useJndi.isEnabled()) {
                noJndiInfo.setVisible(false);
                jndiInfo.setVisible(true);
            } else {
                noJndiInfo.setVisible(true);
                jndiInfo.setVisible(false);
            }
            repoDisplayArea.setVisible(false);
            saveRepoConfigForm.setVisible(false);
        }
    });
    layoutA.setWidget(2, 1, useJndi);

    Button continueButton = new Button("Continue");
    continueButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent w) {
            if (databaseList.getSelectedIndex() == 0) {
                Window.alert(constants.PleaseSelectRdbmsType());
                return;
            }
            if (!useJndi.isEnabled()) {
                jndiInfo.setVisible(false);
            }
            vPanel2.setVisible(true);
        }
    });

    layoutA.setWidget(3, 1, continueButton);
    DecoratorPanel decPanel = new DecoratorPanel();
    decPanel.setWidget(layoutA);
    return decPanel;
}

From source file:org.drools.guvnor.client.admin.RuleVerifierManager.java

License:Apache License

public RuleVerifierManager() {

    PrettyFormLayout form = new PrettyFormLayout();
    form.addHeader(images.ruleVerification(), new HTML(constants.EditRulesVerificationConfiguration()));
    form.startSection(constants.AutomaticVerification());

    final CheckBox enableOnlineValidator = new CheckBox();
    enableOnlineValidator.setValue(WorkingSetManager.getInstance().isAutoVerifierEnabled());
    form.addAttribute(constants.Enabled(), enableOnlineValidator);

    HorizontalPanel actions = new HorizontalPanel();

    form.addAttribute("", actions);

    Button btnSave = new Button(constants.SaveChanges());
    btnSave.setTitle(constants.SaveAllChanges());
    btnSave.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            WorkingSetManager.getInstance().setAutoVerifierEnabled(enableOnlineValidator.getValue());
            Window.alert(constants.AllChangesHaveBeenSaved());
        }/*from  ww w  . j a  va  2 s.c o m*/
    });

    actions.add(btnSave);

    form.endSection();

    initWidget(form);

}

From source file:org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.RuleAttributeWidget.java

License:Apache License

private Widget checkBoxEditor(final RuleAttribute at) {
    final CheckBox box = new CheckBox();
    if (at.value == null) {
        box.setValue(true);
        at.value = TRUE_VALUE;//  w w w.j  av a  2 s . co m
    } else {
        box.setValue((at.value.equals(TRUE_VALUE)));
    }

    box.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            at.value = (box.getValue()) ? TRUE_VALUE : FALSE_VALUE;
        }
    });
    return box;
}