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

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

Introduction

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

Prototype

protected CheckBox(Element elem) 

Source Link

Usage

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

License:Open Source License

public CustomizeChartOptionsPanel(ChartOptions chartOptions) {
    super();//ww  w. jav  a 2 s. c  o m
    final HorizontalAxisOption horizontalAxisOption = chartOptions.getHorizontalAxisOption();

    _timelineAllDatesRadio = new RadioButton("timeline_scope_type", "All dates");
    _timelineLastDaysRadio = new RadioButton("timeline_scope_type", "The latest .. days");
    _timelineFromToRadio = new RadioButton("timeline_scope_type", "From ... to ...");

    final Date beginDate = horizontalAxisOption.getBeginDate();
    final Date endDate = horizontalAxisOption.getEndDate();

    final int latestNumberOfDays;
    if (horizontalAxisOption instanceof LatestNumberOfDaysHAxisOption) {
        latestNumberOfDays = ((LatestNumberOfDaysHAxisOption) horizontalAxisOption).getLatestNumberOfDays();
        _timelineLastDaysRadio.setValue(true);
    } else if (beginDate != null || endDate != null) {
        latestNumberOfDays = LatestNumberOfDaysHAxisOption.DEFAULT_NUMBER_OF_DAYS;
        _timelineFromToRadio.setValue(true);
    } else {
        latestNumberOfDays = LatestNumberOfDaysHAxisOption.DEFAULT_NUMBER_OF_DAYS;
        _timelineAllDatesRadio.setValue(true);
    }

    _beginDatePicker = createDatePickerWidget((beginDate == null ? getDefaultBeginDate() : beginDate));
    _endDatePicker = createDatePickerWidget((endDate == null ? new Date() : endDate));

    _latestNumberOfDaysBox = new NumberTextBox();
    _latestNumberOfDaysBox.setMaxLength(3);
    _latestNumberOfDaysBox.setNumberValue(latestNumberOfDays);

    final VerticalAxisOption verticalAxisOption = chartOptions.getVerticalAxisOption();
    _heightBox = new NumberTextBox();
    _heightBox.setNumberValue(verticalAxisOption.getHeight());

    _minimumValueBox = new NumberTextBox();
    _minimumValueBox.setNumberValue(verticalAxisOption.getMinimumValue());

    _maximumValue = new NumberTextBox();
    _maximumValue.setNumberValue(verticalAxisOption.getMaximumValue());

    _logScaleCheckBox = new CheckBox("Logarithmic scale?");
    _logScaleCheckBox.setValue(verticalAxisOption.isLogarithmicScale());

    addStyleName("CustomizeChartOptionsPanel");

    add(createHorizontalAxisOptionPanel());
    add(createVerticalAxisOptionPanel());
}

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

License:Open Source License

public UnparameterizedMetricPresenter(MetricIdentifier metricIdentifier, List<MetricIdentifier> activeMetrics) {
    _metricIdentifier = metricIdentifier;
    _activeMetrics = activeMetrics;/*from w w  w  . j  a  v a2 s. co m*/

    _checkBox = new CheckBox(metricIdentifier.getDisplayName());
    MetricIdentifier activeMetric = isActiveMetric();
    if (activeMetric == null) {
        _metricToReturn = _metricIdentifier;
        _checkBox.setValue(false);
    } else {
        _metricToReturn = activeMetric;
        _checkBox.setValue(true);
    }
}

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

License:Open Source License

public DefineMetricPanel(final TenantIdentifier tenant, final JobMetrics jobMetrics,
        final MetricIdentifier existingMetric, final boolean formulaOnly) {
    super();/*from  w  w w . j  a  va 2s  .  c  om*/
    addStyleName("DefineMetricPanel");

    final boolean formulaBased = (formulaOnly ? true
            : (existingMetric == null ? false : existingMetric.isFormulaBased()));

    _tenant = tenant;
    _jobMetrics = jobMetrics;
    _selectMetricPanels = new ArrayList<SelectMetricPanel>();

    _formulaAddMetricButton = DCButtons.defaultButton("glyphicon-plus", null);
    _formulaAddMetricButton.addStyleName("AddMetricButton");
    _formulaAddMetricButton.setVisible(formulaBased);
    _formulaRemoveMetricButton = DCButtons.defaultButton("glyphicon-minus", null);
    _formulaRemoveMetricButton.addStyleName("RemoveMetricButton");
    _formulaRemoveMetricButton.setVisible(formulaBased);

    _formulaTextBox = new TextBox();
    _formulaTextBox.setStyleName("form-control");
    _formulaTextBox.addStyleName("FormulaTextBox");
    _formulaTextBox.setVisible(formulaBased);
    // provide an example template, which makes it convenient to do a
    // percentage calculation
    _formulaTextBox.setText("A * 100 / B");

    _formulaCheckBox = new CheckBox("Metric formula?");
    _formulaCheckBox.addStyleName("FormulaCheckBox");
    _formulaCheckBox
            .setTitle("Let this metric be a formula, comprising multiple child metrics in a calculation?");
    _formulaCheckBox.setValue(formulaBased);

    _formulaCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            final boolean formulaBased = event.getValue();
            _formulaTextBox.setVisible(formulaBased);
            _formulaAddMetricButton.setVisible(formulaBased);
            _formulaRemoveMetricButton.setVisible(formulaBased);
        }
    });

    if (!formulaOnly) {
        add(_formulaCheckBox);
    }
    add(_formulaTextBox);
    add(_formulaAddMetricButton);
    add(_formulaRemoveMetricButton);

    if (formulaBased) {
        if (existingMetric == null) {
            // a new formula is being defined
            updateFormulaState(true);
        } else {
            // an existing formula is being recreated
            _formulaTextBox.setText(existingMetric.getFormula());
            final List<MetricIdentifier> children = existingMetric.getChildren();
            for (MetricIdentifier child : children) {
                addSelection(createSelectMetricPanel(child, formulaBased));
            }
        }
    } else {
        addSelection(createSelectMetricPanel(existingMetric, formulaBased));
    }

    // add listener for limiting amount of metric selections
    _formulaCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            final boolean formulaBased = event.getValue();
            updateFormulaState(formulaBased);
        }
    });

    _formulaAddMetricButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            final SelectMetricPanel panel = createSelectMetricPanel(null, true);
            addSelection(panel);
        }
    });
    _formulaRemoveMetricButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (_selectMetricPanels.size() > 1) {
                removeSelection();
            }
        }
    });
}

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   www  .j  av  a 2 s . c  o m*/
    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.dataconservancy.dcs.access.client.view.AcrDataView.java

License:Creative Commons License

public AcrDataView() {
    publishContainer = new VerticalPanel();
    projectDesciptionPanel = new CaptionPanel("Project Descritpion");
    researchObjectPanel = new CaptionPanel("Research Object");
    licensePanel = new CaptionPanel("License  ");

    projectDesciptionPanel.setStyleName("CaptionPanelStyle");
    researchObjectPanel.setStyleName("CaptionPanelStyle");
    licensePanel.setStyleName("CaptionPanelStyle");

    publishContainer.add(projectDesciptionPanel);
    publishContainer.add(researchObjectPanel);
    publishContainer.add(licensePanel);/*ww  w  .ja v a 2 s. co  m*/

    Grid project = new Grid(2, 2);
    Label projectName = new Label("Project Name");
    projectList = new ListBox(false);
    Label projectDescription = new Label("Project Description");
    TextArea descriptionArea = new TextArea();
    project.setCellSpacing(3);
    project.setCellPadding(3);
    project.setWidget(0, 0, projectName);
    project.setWidget(0, 1, projectList);
    project.setWidget(1, 0, projectDescription);
    project.setWidget(1, 1, descriptionArea);
    projectDesciptionPanel.add(project);

    Grid ROGrid = new Grid(4, 2);
    Label ROLabel = new Label("Research Object");
    ROList = new ListBox();
    //Label uploadLabel = new Label ("Upload Local Bag");

    //Button browseButton = new Button("...");
    /*
    browseButton.addClickHandler(new ClickHandler() {
               
       @Override
       public void onClick(ClickEvent event) {
    new UploadBagDialog(SeadApp.bagIturl, publishContainer, previewButton);
       }
    });*/

    HorizontalPanel browsePanel = new HorizontalPanel();
    /*browsePanel.add(uploadLabel);
    browsePanel.add(browseButton);*/
    Button validateButton = new Button("Validate Bag");
    ROGrid.setCellSpacing(3);
    ROGrid.setCellPadding(3);
    ROGrid.setWidget(0, 0, ROLabel);
    ROGrid.setWidget(0, 1, ROList);
    //      ROGrid.setWidget(1, 1, new HTML("Or"));
    //      ROGrid.setWidget(2, 1, browsePanel);
    //      ROGrid.setWidget(3, 1, validateButton);
    researchObjectPanel.add(ROGrid);

    CheckBox licenseBox = new CheckBox(
            "By clicking this checkbox, I certify that I agree to release my research data under the terms of the Creative Commons license");
    licensePanel.add(licenseBox);

    HorizontalPanel previewButtonPanel = new HorizontalPanel();
    previewButtonPanel.setWidth("600px");

    previewButtonPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
    Button previewButton = new Button("Pull and Preview");
    previewButtonPanel.add(previewButton);
    publishContainer.add(previewButtonPanel);

}

From source file:org.dataconservancy.dcs.access.client.view.AcrPublishDataView.java

License:Creative Commons License

public AcrPublishDataView() {
    publishContainer = new VerticalPanel();
    projectDesciptionPanel = new CaptionPanel("Project Descritpion");
    researchObjectPanel = new CaptionPanel("Research Object");
    licensePanel = new CaptionPanel("License  ");

    projectDesciptionPanel.setStyleName("CaptionPanelStyle");
    researchObjectPanel.setStyleName("CaptionPanelStyle");
    licensePanel.setStyleName("CaptionPanelStyle");

    publishContainer.add(projectDesciptionPanel);
    publishContainer.add(researchObjectPanel);
    //publishContainer.add(licensePanel);

    Grid project = new Grid(2, 2);
    Label projectName = new Label("Project Name");
    projectList = new ListBox(false);
    Label projectDescription = new Label("Project Description");
    TextArea descriptionArea = new TextArea();
    project.setCellSpacing(3);/*  w w w.  j a  v  a  2 s .c o  m*/
    project.setCellPadding(3);
    project.setWidget(0, 0, projectName);
    project.setWidget(0, 1, projectList);
    project.setWidget(1, 0, projectDescription);
    project.setWidget(1, 1, descriptionArea);
    projectDesciptionPanel.add(project);

    Grid ROGrid = new Grid(4, 2);
    Label ROLabel = new Label("Research Object");

    ROList = new ListBox(); //contains names of datasets

    ROGrid.setCellSpacing(3);
    ROGrid.setCellPadding(3);
    ROGrid.setWidget(0, 0, ROLabel);
    ROGrid.setWidget(0, 1, ROList);

    researchObjectPanel.add(ROGrid);

    CheckBox licenseBox = new CheckBox(
            "By clicking this checkbox, I certify that I agree to release my research data under the terms of the Creative Commons license");
    //   licensePanel.add(licenseBox);

    previewButtonPanel = new HorizontalPanel();
    previewButtonPanel.setWidth("600px");
    previewButton = new Button("Preview");
    previewButtonPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
    previewButtonPanel.add(previewButton);
    publishContainer.add(previewButtonPanel);
}

From source file:org.dataconservancy.dcs.access.client.view.PublishDataView.java

License:Creative Commons License

public PublishDataView() {

    publishContainer = new VerticalPanel();
    publishContainer.addStyleName("PublishContainer");
    projectDesciptionPanel = new CaptionPanel("Project Description");
    researchObjectPanel = new CaptionPanel("Research Object");
    licensePanel = new CaptionPanel("License  ");

    projectDesciptionPanel.setStyleName("CaptionPanelStyle");
    researchObjectPanel.setStyleName("CaptionPanelStyle");
    licensePanel.setStyleName("CaptionPanelStyle");

    publishContainer.add(researchObjectPanel);
    publishContainer.add(projectDesciptionPanel);
    publishContainer.add(licensePanel);//from w ww.  j av a2s .  c o  m

    Grid project = new Grid(3, 2);
    Label projectName = new Label("Project Name");
    projectList = new ListBox(false);
    Label projectDescription = new Label("Project Description");
    project.setCellSpacing(3);
    project.setCellPadding(3);
    projectNameTB = new TextBox();
    projectNameTB.setEnabled(false);
    project.setWidget(0, 0, projectName);
    project.setWidget(0, 1, projectNameTB);
    abstractTB = new TextArea();
    abstractTB.setEnabled(false);
    project.setWidget(1, 0, projectDescription);
    project.setWidget(1, 1, abstractTB);

    VerticalPanel descriptionPanel = new VerticalPanel();
    descriptionPanel.add(project);

    warningPanel = new VerticalPanel();

    descriptionPanel.add(warningPanel);
    projectDesciptionPanel.add(descriptionPanel);

    Grid ROGrid = new Grid(4, 2);

    Label uploadLabel = new Label("Upload Local Bag");
    previewButton = new Button("Submit Dataset for Review");

    form = new FormPanel();
    FlowPanel formcontents = new FlowPanel();
    form.add(formcontents);

    Hidden depositurl = new Hidden("bagUrl");
    depositurl.setValue(SeadApp.bagIturl);

    final FileUpload upfile = new FileUpload();
    upfile.setName("file");

    formcontents.add(upfile);
    formcontents.add(depositurl);
    form.setMethod(FormPanel.METHOD_POST);
    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.setAction(SeadApp.BAG_UPLOAD_URL);

    Grid uploadGrid = new Grid(4, 2);
    uploadGrid.setWidget(1, 0, uploadLabel);
    uploadGrid.setWidget(1, 1, form);
    uploadBag = new Button("Upload");
    uploadGrid.setWidget(3, 1, uploadBag);
    ROGrid.setCellSpacing(3);
    ROGrid.setCellPadding(3);
    //   ROGrid.setWidget(0, 0, ROLabel);
    //ROGrid.setWidget(0, 1, ROList);
    //ROGrid.setWidget(1, 1, new HTML("Or"));
    //ROGrid.setWidget(2, 1, browsePanel);
    //ROGrid.setWidget(2, 1, uploadBag);

    researchObjectPanel.add(uploadGrid);

    Panel innerLicensePanel = new FlowPanel();
    errorMessage = new Label();
    licenseBox = new CheckBox(
            "By clicking this checkbox, I certify that I agree to release my research data under the terms of the Creative Commons license.");
    innerLicensePanel.add(errorMessage);
    innerLicensePanel.add(licenseBox);
    licensePanel.add(innerLicensePanel);

    HorizontalPanel previewButtonPanel = new HorizontalPanel();
    previewButtonPanel.setWidth("600px");
    previewButtonPanel.setStyleName("Margin");

    Button clearButton = new Button("Start over");

    clearButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            History.newItem(SeadState.UPLOAD.toToken("new"));
        }
    });

    previewButtonPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
    previewButtonPanel.add(clearButton);

    previewButtonPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
    previewButtonPanel.add(previewButton);
    previewButton.setEnabled(false);
    publishContainer.add(previewButtonPanel);

}

From source file:org.daxplore.presenter.client.ui.EmbedPopup.java

License:Open Source License

/**
 * Instantiates a new embed popup panel.
 * /*from  ww w.  j a v  a  2 s.c o  m*/
 * @param eventBus
 *            the system's bus
 * @param uiTexts
 *            the resource that supplies localized text to the UI
 * @param config
 *            supplies configuration parameters to the client
 */
@Inject
public EmbedPopup(final EventBus eventBus, UITexts uiTexts, DaxploreConfig config,
        PrefixProperties prefixProperties) {
    super(true);
    this.prefixProperties = prefixProperties;

    mainPanel = new VerticalPanel();
    mainPanel.setSpacing(5);

    Label popupHeader = new Label(uiTexts.embedPopupTitle());
    mainPanel.add(popupHeader);

    Label popupDescription = new Label(uiTexts.embedPopupDescription());
    mainPanel.add(popupDescription);

    linkTextArea = new TextArea();
    linkTextArea.setText("");

    linkTextArea.addMouseOverHandler(new MouseOverHandler() {
        @Override
        public void onMouseOver(MouseOverEvent event) {
            linkTextArea.setFocus(true);
            linkTextArea.selectAll();
        }
    });

    linkTextArea.getElement().setAttribute("spellCheck", "false");

    linkTextArea.addMouseUpHandler(this);
    linkTextArea.addChangeHandler(this);

    setStyleName("daxplore-EmbedPopup");
    popupHeader.addStyleName("daxplore-EmbedPopup-header");
    linkTextArea.addStyleName("daxplore-EmbedPopup-textarea");

    mainPanel.add(linkTextArea);

    DisclosurePanel settingsPanel = new DisclosurePanel(uiTexts.embedSettingsHeader());
    FlowPanel settingsContentPanel = new FlowPanel();
    settingsPanel.add(settingsContentPanel);
    settingsPanel.setWidth("100%");
    mainPanel.add(settingsPanel);

    HorizontalPanel sizeButtonPanel = new HorizontalPanel();
    sizeButtonPanel.setSpacing(10);

    for (final EmbedSize embedSize : EmbedSize.values()) {
        Button button = new Button(embedSize.getButtonText(config, uiTexts));
        button.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                eventBus.fireEvent(new EmbedSizeEvent(embedSize));
            }
        });
        sizeButtonPanel.add(button);
    }

    currentEmbedSize = EmbedSize.MEDIUM;

    settingsContentPanel.add(sizeButtonPanel);

    transparencyCheckbox = new CheckBox(uiTexts.embedTransparentBackground());
    transparencyCheckbox.setValue(true, false);
    transparencyCheckbox.addValueChangeHandler(this);
    settingsContentPanel.add(transparencyCheckbox);

    legendCheckbox = new CheckBox(uiTexts.embedShowLegend());
    legendCheckbox.setValue(true, false);
    legendCheckbox.addValueChangeHandler(this);
    settingsContentPanel.add(legendCheckbox);

    iframeSpot.setStyleName("daxplore-EmbedPopup-iframeSpot");
    mainPanel.add(iframeSpot);

    setWidget(mainPanel);

    EmbedSizeEvent.register(eventBus, this);
    QueryUpdateEvent.register(eventBus, this);
}

From source file:org.daxplore.presenter.client.ui.PerspectiveCheckboxPanel.java

License:Open Source License

private PerspectiveCheckboxPanel(DaxploreConfig config, QuestionMetadata questions, UITexts uiTexts,
        String questionID, List<Integer> checked, boolean checkTotal) {

    Label header = new Label(uiTexts.pickSelectionAlternativesHeader());
    header.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    header.addStyleName("daxplore-PerspectiveCheckboxes-header");
    this.add(header);

    List<String> options = questions.getOptionTexts(questionID);

    FlexTable grid = new FlexTable();
    CellFormatter formatter = grid.getCellFormatter();

    for (int i = 0; i < options.size(); i++) {
        CheckBox chkbox = new CheckBox(options.get(i));
        chkbox.addValueChangeHandler(this);
        chkbox.setFormValue(String.valueOf(i));
        chkbox.setValue(checked.contains(i), false);
        if (!checkTotal && checked.size() == 0 && i < config.defaultSelectedPerspectiveOptions()) {
            chkbox.setValue(true, false);
        }/*from  www .j  a va  2  s.  c o  m*/
        checkboxList.add(chkbox);
        if (options.size() <= 6) {
            formatter.setWordWrap(i % options.size(), i / options.size(), false);
            grid.setWidget(i % options.size(), i / options.size(), chkbox);
        } else {
            formatter.setWordWrap(i % 7, i / 7, false);
            grid.setWidget(i % 7, i / 7, chkbox);
        }
    }
    this.add(grid);

    total = new CheckBox(uiTexts.compareWithAll());
    total.addValueChangeHandler(this);
    total.setFormValue("all");
    total.setValue(checkTotal, false);
    this.add(total);

}

From source file:org.drools.brms.client.rulelist.QuickFindWidget.java

License:Apache License

public QuickFindWidget(EditItemEvent editEvent) {
    layout = new FormStyleLayout("images/system_search.png", "");

    searchBox = new AutoCompleteTextBoxAsync(new CompletionItemsAsync() {

        public void getCompletionItems(String match, CompletionItemsAsyncReturn asyncReturn) {
            loadShortList(match, asyncReturn);

        }/*from   w  w w .j  a  va 2 s . c  o m*/

    });
    searchBox.setStyleName("gwt-TextBox");

    this.editEvent = editEvent;
    HorizontalPanel srch = new HorizontalPanel();
    Button go = new Button("Go");
    go.addClickListener(new ClickListener() {
        public void onClick(Widget w) {
            updateList();
        }
    });

    srch.add(searchBox);
    srch.add(go);

    archiveBox = new CheckBox("Include archived items in list");
    archiveBox.setStyleName("small-Text");
    archiveBox.setChecked(false);

    layout.addAttribute("Find items with a name matching:", srch);
    layout.addRow(archiveBox);
    layout.addRow(new HTML("<hr/>"));

    listPanel = new FlexTable();
    listPanel.setWidget(0, 0, new HTML(
            "<img src='images/information.gif'/>&nbsp;Enter the name or part of a name. Alternatively, use the categories to browse."));
    layout.addRow(listPanel);

    listPanel.setStyleName("editable-Surface");

    searchBox.addKeyboardListener(getKeyboardListener());

    layout.setStyleName("quick-find");

    initWidget(layout);
}