@Override
 public void render(
     com.google.gwt.cell.client.Cell.Context context, Boolean value, SafeHtmlBuilder sb) {
   CheckBox checkBox = new CheckBox();
   checkBox.setValue(value);
   checkBox.setEnabled(false);
   sb.append(SafeHtmlUtils.fromTrustedString(checkBox.toString()));
 }
  private void enableDisableWidgets(boolean enabled) {

    selfRead.setEnabled(enabled);
    selfWrite.setEnabled(enabled);
    voRead.setEnabled(enabled);
    voWrite.setEnabled(enabled);
    groupRead.setEnabled(enabled);
    groupWrite.setEnabled(enabled);
    facilityRead.setEnabled(enabled);
    facilityWrite.setEnabled(enabled);
  }
Ejemplo n.º 3
0
  @Test
  public void click_disabled() {
    // Arrange
    CheckBox cb = new CheckBox();
    cb.setEnabled(false);

    // Act
    Browser.click(cb);

    // Assert
    assertFalse(cb.getValue());
    assertTrue(
        errorStringBuilder
            .toString()
            .startsWith(
                "Cannot dispatch 'mouseover' event : the targeted element has to be enabled : <span class=\"gwt-CheckBox gwt-CheckBox-disabled\"><input type=\"checkbox\""));
  }
  /* (non-Javadoc)
   * @see org.ebayopensource.turmeric.policy.adminui.client.view.policy.PolicyCreateView#initializeExtraFields()
   */
  protected void initializeExtraFields() {
    rlExtraFields = PolicyExtraFieldsUtil.getRLExtraFields();

    extraFieldsGrid = new Grid(rlExtraFields.size() + 1, 3);

    for (ExtraField extraField : rlExtraFields) {

      extraFieldsGrid.setWidget(extraField.getOrder(), 0, new Label(extraField.getLabelName()));

      if (extraField.getFieldType() != null
          && "CheckBox".equalsIgnoreCase(extraField.getFieldType())) {
        CheckBox chBox = new CheckBox();
        chBox.setEnabled(true);
        extraField.setCheckBox(chBox);
        extraFieldsGrid.setWidget(extraField.getOrder(), 1, extraField.getCheckBox());

      } else if (extraField.getFieldType() != null
          && "TextBox".equalsIgnoreCase(extraField.getFieldType())) {
        TextBox txBox = new TextBox();
        txBox.setText("");
        txBox.setWidth(extraField.getLenghtBox());
        extraField.setTextBox(txBox);
        extraFieldsGrid.setWidget(extraField.getOrder(), 1, extraField.getTextBox());

      } else if (extraField.getFieldType() != null
          && "TextArea".equalsIgnoreCase(extraField.getFieldType())) {
        TextArea txArea = new TextArea();
        txArea.setText("");
        txArea.setWidth(extraField.getLenghtBox());
        //				txArea.setEnabled(false);
        extraField.setTextArea(txArea);
        extraFieldsGrid.setWidget(extraField.getOrder(), 1, extraField.getTextArea());

      } else if (extraField.getFieldType() != null
          && "ListBox".equalsIgnoreCase(extraField.getFieldType())) {
        ListBox lsBox = new ListBox();
        for (int i = 0; i < extraField.getListBox().getItemCount(); i++) {
          lsBox.addItem(extraField.getListBox().getItemText(i));
        }
        extraField.setListBox(lsBox);
        extraFieldsGrid.setWidget(extraField.getOrder(), 1, extraField.getListBox());
      }
    }
  }
Ejemplo n.º 5
0
  private void init() {
    staffArea = new OrganizationSpecialTextArea();
    staffAreaPanel.add(staffArea); // 提名人面板
    startTime.setFormat(new DateBox.DefaultFormat(dateFormat));
    // 隐藏周期性
    expectTime.setEnabled(true);
    tmdays.setEnabled(true);
    nextRewardsTime.setEnabled(false);
    tmday.setEnabled(false);
    setting.setEnabled(false);
    autoCbx.setEnabled(false);
    nextPublicTime.setEnabled(false);
    specialCbx.setEnabled(false);
    birthRadio.setEnabled(false);
    backStore.setVisible(false);
    //	settingText.getElement().getParentElement().getParentElement().getParentElement().addClassName(CssStyleConstants.hidden);
    nextRewardsTime.setFormat(new DateBox.DefaultFormat(dateFormat));
    nextPublicTime.setFormat(new DateBox.DefaultFormat(dateFormat));
    expectTime.setFormat(new DateBox.DefaultFormat(dateFormat));
    // sub.setText("我的奖项");
    // title.setText("创建奖项");
    // settingText.setText("每1天一次");
    birthRadio.getElement().addClassName(CssStyleConstants.hidden);
    // 周期性选择
    onetimes.addValueChangeHandler(
        new ValueChangeHandler<Boolean>() {
          @Override
          public void onValueChange(ValueChangeEvent<Boolean> event) {
            if (event.getValue()) {
              // settingText.getElement().getParentElement().getParentElement().getParentElement().addClassName(CssStyleConstants.hidden);
              // expectTime.getElement().getParentElement().getParentElement().getParentElement().removeClassName(CssStyleConstants.hidden);
              expectTime.setEnabled(true);
              tmdays.setEnabled(true);

              nextRewardsTime.setEnabled(false);
              tmday.setEnabled(false);
              setting.setEnabled(false);
              autoCbx.setEnabled(false);
              nextPublicTime.setEnabled(false);
              specialCbx.setEnabled(false);
              birthRadio.setEnabled(false);

              nextRewardsTime.setValue(null);
              tmday.setValue(null);
              autoCbx.setValue(null);
              nextPublicTime.setValue(null);
              specialCbx.setValue(null);
              birthRadio.setValue(null);
              settingText.setText("");
              frequency = null;
            } else {
              // settingText.getElement().getParentElement().getParentElement().getParentElement().removeClassName(CssStyleConstants.hidden);
              // expectTime.getElement().getParentElement().getParentElement().getParentElement().addClassName(CssStyleConstants.hidden);
              expectTime.setEnabled(false);
              tmdays.setEnabled(false);
              expectTime.setValue(null);
              tmdays.setValue(null);

              nextRewardsTime.setEnabled(true);
              tmday.setEnabled(true);
              setting.setEnabled(true);
              autoCbx.setEnabled(true);
              nextPublicTime.setEnabled(true);
              specialCbx.setEnabled(true);
              birthRadio.setEnabled(true);
            }
          }
        });
    moretimes.addValueChangeHandler(
        new ValueChangeHandler<Boolean>() {
          @Override
          public void onValueChange(ValueChangeEvent<Boolean> event) {
            if (event.getValue()) {
              expectTime.setEnabled(false);
              tmdays.setEnabled(false);
              expectTime.setValue(null);
              tmdays.setValue(null);

              nextRewardsTime.setEnabled(true);
              tmday.setEnabled(true);
              setting.setEnabled(true);
              autoCbx.setEnabled(true);
              nextPublicTime.setEnabled(true);
              specialCbx.setEnabled(true);
              birthRadio.setEnabled(true);
              // settingText.getElement().getParentElement().getParentElement().getParentElement().removeClassName(CssStyleConstants.hidden);
              // expectTime.getElement().getParentElement().getParentElement().getParentElement().addClassName(CssStyleConstants.hidden);
            } else {
              expectTime.setEnabled(true);
              tmdays.setEnabled(true);

              nextRewardsTime.setEnabled(false);
              tmday.setEnabled(false);
              setting.setEnabled(false);
              autoCbx.setEnabled(false);
              nextPublicTime.setEnabled(false);
              specialCbx.setEnabled(false);
              birthRadio.setEnabled(false);
              nextRewardsTime.setValue(null);
              tmday.setValue(null);
              autoCbx.setValue(null);
              nextPublicTime.setValue(null);
              specialCbx.setValue(null);
              birthRadio.setValue(null);
              settingText.setText("");
              // settingText.getElement().getParentElement().getParentElement().getParentElement().addClassName(CssStyleConstants.hidden);
              // expectTime.getElement().getParentElement().getParentElement().getParentElement().removeClassName(CssStyleConstants.hidden);
            }
          }
        });
    // 特殊条件
    specialCbx.addValueChangeHandler(
        new ValueChangeHandler<Boolean>() {

          @Override
          public void onValueChange(ValueChangeEvent<Boolean> event) {
            if (event.getValue()) {
              birthRadio.setValue(true, true);
              birthRadio.getElement().removeClassName(CssStyleConstants.hidden);
            } else {
              birthRadio.setValue(false, true);
              birthRadio.getElement().addClassName(CssStyleConstants.hidden);
            }
          }
        });

    // 生日奖
    birthRadio.addValueChangeHandler(
        new ValueChangeHandler<Boolean>() {
          @Override
          public void onValueChange(ValueChangeEvent<Boolean> event) {
            if (event.getValue()) {
              FrequencyClient frequecny = getFrequencyObj();
              if (frequecny == null
                  || frequecny instanceof WeekFrequencyClient
                  || frequecny instanceof YearFrequencyClient) {
                Window.alert("生日奖必须为每日或每月,已重设为每天一次");
                DayFrequencyClient daily = new DayFrequencyClient();
                daily.setInterval(1);
                showFrequencyInfo(daily);
              }
            } else {
              showFrequencyInfo(null);
            }
          }
        });

    // 自动颁奖
    autoCbx.addValueChangeHandler(
        new ValueChangeHandler<Boolean>() {

          @Override
          public void onValueChange(ValueChangeEvent<Boolean> event) {
            if (event.getValue()) {
              nextPublicTime.setEnabled(false);
              chooseBtns.setEnabled(false);
              //					chooseBtns.getElement().getParentElement()//隐藏提名
              //					.getParentElement()
              //					.addClassName(CssStyleConstants.hidden);
              //					nextPublicTime.getElement().getParentElement()
              //							.getParentElement()
              //							.addClassName(CssStyleConstants.hidden);
            } else {
              //					chooseBtns.getElement().getParentElement()//隐藏提名
              //					.getParentElement()
              //					.removeClassName(CssStyleConstants.hidden);
              //					nextPublicTime.getElement().getParentElement()
              //							.getParentElement()
              //							.removeClassName(CssStyleConstants.hidden);
              nextPublicTime.setEnabled(true);
              chooseBtns.setEnabled(true);
            }
          }
        });
    // 只能输入数字
    peopleSizeLimit.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            if (event.getValue() != null && !event.getValue().equals("")) {
              try {
                Integer.parseInt(event.getValue());
              } catch (Exception e) {
                peopleSizeLimit.setValue("");
              }
            }
          }
        });
    totalJF.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            if (event.getValue() != null && !event.getValue().equals("")) {
              try {
                Integer.parseInt(event.getValue());
              } catch (Exception e) {
                totalJF.setValue("");
              }
            }
          }
        });
    rewardsFrom.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            if (event.getValue() != null && !event.getValue().equals("")) {
              try {
                Integer.parseInt(event.getValue());
              } catch (Exception e) {
                rewardsFrom.setValue("");
              }
            }
          }
        });
    tmdays.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            if (event.getValue() != null && !event.getValue().equals("")) {
              try {
                Integer.parseInt(event.getValue());
              } catch (Exception e) {
                tmdays.setValue("");
              }
            }
          }
        });
    tmday.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            if (event.getValue() != null && !event.getValue().equals("")) {
              try {
                Integer.parseInt(event.getValue());
              } catch (Exception e) {
                tmday.setValue("");
              }
            }
          }
        });
  }
 public PermissionPanel(PermissionPOJO permission, boolean isEditable) {
   this(permission);
   chkPermission.setEnabled(isEditable);
 }
Ejemplo n.º 7
0
 public void setNotEditable() {
   currentValue.setEnabled(false);
   overrideAllowed.setEnabled(false);
   nullValue.setEnabled(false);
 }
Ejemplo n.º 8
0
  /** @param repositoryFile */
  public ImportDialog(RepositoryFile repositoryFile, boolean allowAdvancedDialog) {
    super(
        Messages.getString("import"),
        Messages.getString("ok"),
        Messages.getString("cancel"),
        false,
        true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    form = new FormPanel();
    form.addSubmitHandler(
        new SubmitHandler() {
          @Override
          public void onSubmit(SubmitEvent se) {
            // if no file is selected then do not proceed
            okButton.setEnabled(false);
            cancelButton.setEnabled(false);
            MantleApplication.showBusyIndicator(
                Messages.getString("pleaseWait"), Messages.getString("importInProgress"));
          }
        });
    form.addSubmitCompleteHandler(
        new SubmitCompleteHandler() {
          @Override
          public void onSubmitComplete(SubmitCompleteEvent sce) {
            MantleApplication.hideBusyIndicator();
            okButton.setEnabled(false);
            cancelButton.setEnabled(true);
            ImportDialog.this.hide();
            String result = sce.getResults();
            if (result.length() > 5) {
              HTML messageTextBox = null;
              if (result.contains("INVALID_MIME_TYPE") == true) {
                messageTextBox =
                    new HTML(Messages.getString("uploadInvalidFileTypeQuestion", result));
              } else {
                logWindow(result, Messages.getString("importLogWindowTitle"));
              }

              if (messageTextBox != null) {
                PromptDialogBox dialogBox =
                    new PromptDialogBox(
                        Messages.getString("uploadUnsuccessful"),
                        Messages.getString("close"),
                        null,
                        true,
                        true);
                dialogBox.setContent(messageTextBox);
                dialogBox.center();
              }
            }

            // if mantle_isBrowseRepoDirty=true: do getChildren call
            // if mantle_isBrowseRepoDirty=false: use stored fileBrowserModel in
            // myself.get("cachedData")
            setBrowseRepoDirty(Boolean.TRUE);

            // BISERVER-9319 Refresh browse perspective after import
            final GenericEvent event = new GenericEvent();
            event.setEventSubType("ImportDialogEvent");
            EventBusUtil.EVENT_BUS.fireEvent(event);
          }
        });

    VerticalPanel rootPanel = new VerticalPanel();

    VerticalPanel spacer = new VerticalPanel();
    spacer.setHeight("10px");
    rootPanel.add(spacer);

    Label fileLabel = new Label(Messages.getString("file") + ":");
    final TextBox importDir = new TextBox();
    rootPanel.add(fileLabel);

    okButton.setEnabled(false);

    final TextBox fileTextBox = new TextBox();
    fileTextBox.setHeight("26px");
    fileTextBox.setEnabled(false);

    // We use an fileNameOverride because FileUpload can only handle US character set reliably.
    final Hidden fileNameOverride = new Hidden("fileNameOverride");

    final FileUpload upload = new FileUpload();
    upload.setName("fileUpload");
    ChangeHandler fileUploadHandler =
        new ChangeHandler() {
          @Override
          public void onChange(ChangeEvent event) {
            fileTextBox.setText(upload.getFilename());
            if (!"".equals(importDir.getValue())) {
              // Set the fileNameOverride because the fileUpload object can only reliably transmit
              // US-ASCII
              // character set.  See RFC283 section 2.3 for details
              String fileNameValue = upload.getFilename().replaceAll("\\\\", "/");
              fileNameValue = fileNameValue.substring(fileNameValue.lastIndexOf("/") + 1);
              fileNameOverride.setValue(fileNameValue);
              okButton.setEnabled(true);
            } else {
              okButton.setEnabled(false);
            }
          }
        };
    upload.addChangeHandler(fileUploadHandler);
    upload.setVisible(false);

    HorizontalPanel fileUploadPanel = new HorizontalPanel();
    fileUploadPanel.add(fileTextBox);
    fileUploadPanel.add(new HTML("&nbsp;"));

    Button browseButton = new Button(Messages.getString("browse") + "...");
    browseButton.setStyleName("pentaho-button");
    fileUploadPanel.add(browseButton);
    browseButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            setRetainOwnershipState();
            jsClickUpload(upload.getElement());
          }
        });

    rootPanel.add(fileUploadPanel);
    rootPanel.add(upload);

    applyAclPermissions.setName("applyAclPermissions");
    applyAclPermissions.setValue(Boolean.FALSE);
    applyAclPermissions.setFormValue("false");
    applyAclPermissions.setEnabled(true);
    applyAclPermissions.setVisible(false);

    final CheckBox overwriteAclPermissions =
        new CheckBox(Messages.getString("overwriteAclPermissions"), true);
    overwriteAclPermissions.setName("overwriteAclPermissions");
    applyAclPermissions.setValue(Boolean.FALSE);
    applyAclPermissions.setFormValue("false");
    overwriteAclPermissions.setEnabled(true);
    overwriteAclPermissions.setVisible(false);

    final Hidden overwriteFile = new Hidden("overwriteFile");
    overwriteFile.setValue("true");

    final Hidden logLevel = new Hidden("logLevel");
    logLevel.setValue("ERROR");

    final Hidden retainOwnership = new Hidden("retainOwnership");
    retainOwnership.setValue("true");

    rootPanel.add(applyAclPermissions);
    rootPanel.add(overwriteAclPermissions);
    rootPanel.add(overwriteFile);
    rootPanel.add(logLevel);
    rootPanel.add(retainOwnership);
    rootPanel.add(fileNameOverride);

    spacer = new VerticalPanel();
    spacer.setHeight("4px");
    rootPanel.add(spacer);

    DisclosurePanel disclosurePanel = new DisclosurePanel(Messages.getString("advancedOptions"));
    disclosurePanel.getHeader().setStyleName("gwt-Label");
    disclosurePanel.setVisible(allowAdvancedDialog);
    HorizontalPanel mainPanel = new HorizontalPanel();
    mainPanel.add(new HTML("&nbsp;"));
    VerticalPanel disclosureContent = new VerticalPanel();

    HTML replaceLabel = new HTML(Messages.getString("fileExists"));
    replaceLabel.setStyleName("gwt-Label");
    disclosureContent.add(replaceLabel);

    final CustomListBox overwriteFileDropDown = new CustomListBox();
    final CustomListBox filePermissionsDropDown = new CustomListBox();

    DefaultListItem replaceListItem = new DefaultListItem(Messages.getString("replaceFile"));
    replaceListItem.setValue("true");
    overwriteFileDropDown.addItem(replaceListItem);
    DefaultListItem doNotImportListItem = new DefaultListItem(Messages.getString("doNotImport"));
    doNotImportListItem.setValue("false");
    overwriteFileDropDown.addItem(doNotImportListItem);
    overwriteFileDropDown.setVisibleRowCount(1);
    disclosureContent.add(overwriteFileDropDown);

    spacer = new VerticalPanel();
    spacer.setHeight("4px");
    disclosureContent.add(spacer);

    HTML filePermissionsLabel = new HTML(Messages.getString("filePermissions"));
    filePermissionsLabel.setStyleName("gwt-Label");
    disclosureContent.add(filePermissionsLabel);

    DefaultListItem usePermissionsListItem =
        new DefaultListItem(Messages.getString("usePermissions"));
    usePermissionsListItem.setValue("false");
    filePermissionsDropDown.addItem(
        usePermissionsListItem); // If selected set "overwriteAclPermissions" to
    // false.
    DefaultListItem retainPermissionsListItem =
        new DefaultListItem(Messages.getString("retainPermissions"));
    retainPermissionsListItem.setValue("true");
    filePermissionsDropDown.addItem(
        retainPermissionsListItem); // If selected set "overwriteAclPermissions" to
    // true.

    final ChangeListener filePermissionsHandler =
        new ChangeListener() {
          @Override
          public void onChange(Widget sender) {
            String value = filePermissionsDropDown.getSelectedItem().getValue().toString();

            applyAclPermissions.setValue(Boolean.valueOf(value));
            applyAclPermissions.setFormValue(value);
            overwriteAclPermissions.setFormValue(value);
            overwriteAclPermissions.setValue(Boolean.valueOf(value));
            setRetainOwnershipState();
          }
        };
    filePermissionsDropDown.addChangeListener(filePermissionsHandler);
    filePermissionsDropDown.setVisibleRowCount(1);
    disclosureContent.add(filePermissionsDropDown);

    spacer = new VerticalPanel();
    spacer.setHeight("4px");
    disclosureContent.add(spacer);

    HTML fileOwnershipLabel = new HTML(Messages.getString("fileOwnership"));
    fileOwnershipLabel.setStyleName("gwt-Label");
    disclosureContent.add(fileOwnershipLabel);

    retainOwnershipDropDown.addChangeListener(
        new ChangeListener() {
          @Override
          public void onChange(Widget sender) {
            String value = retainOwnershipDropDown.getSelectedItem().getValue().toString();
            retainOwnership.setValue(value);
          }
        });
    DefaultListItem keepOwnershipListItem =
        new DefaultListItem(Messages.getString("keepOwnership"));
    keepOwnershipListItem.setValue("true");
    retainOwnershipDropDown.addItem(keepOwnershipListItem);
    DefaultListItem assignOwnershipListItem =
        new DefaultListItem(Messages.getString("assignOwnership"));
    assignOwnershipListItem.setValue("false");
    retainOwnershipDropDown.addItem(assignOwnershipListItem);

    retainOwnershipDropDown.setVisibleRowCount(1);
    disclosureContent.add(retainOwnershipDropDown);

    spacer = new VerticalPanel();
    spacer.setHeight("4px");
    disclosureContent.add(spacer);

    ChangeListener overwriteFileHandler =
        new ChangeListener() {
          @Override
          public void onChange(Widget sender) {
            String value = overwriteFileDropDown.getSelectedItem().getValue().toString();
            overwriteFile.setValue(value);
          }
        };
    overwriteFileDropDown.addChangeListener(overwriteFileHandler);

    HTML loggingLabel = new HTML(Messages.getString("logging"));
    loggingLabel.setStyleName("gwt-Label");
    disclosureContent.add(loggingLabel);

    final CustomListBox loggingDropDown = new CustomListBox();
    loggingDropDown.addChangeListener(
        new ChangeListener() {
          public void onChange(Widget sender) {
            String value = loggingDropDown.getSelectedItem().getValue().toString();
            logLevel.setValue(value);
          }
        });
    DefaultListItem noneListItem = new DefaultListItem(Messages.getString("none"));
    noneListItem.setValue("ERROR");
    loggingDropDown.addItem(noneListItem);
    DefaultListItem shortListItem = new DefaultListItem(Messages.getString("short"));
    shortListItem.setValue("WARN");
    loggingDropDown.addItem(shortListItem);
    DefaultListItem debugListItem = new DefaultListItem(Messages.getString("verbose"));
    debugListItem.setValue("TRACE");
    loggingDropDown.addItem(debugListItem);
    loggingDropDown.setVisibleRowCount(1);
    disclosureContent.add(loggingDropDown);

    mainPanel.add(disclosureContent);
    disclosurePanel.setContent(mainPanel);
    rootPanel.add(disclosurePanel);

    importDir.setName("importDir");
    importDir.setText(repositoryFile.getPath());
    importDir.setVisible(false);

    rootPanel.add(importDir);

    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.setMethod(FormPanel.METHOD_POST);

    setFormAction();

    form.add(rootPanel);

    setContent(form);
  }
Ejemplo n.º 9
0
  private static <T extends IsIndexed> void updateFacetPanels(
      final AsyncTableCell<T, ?> list,
      final Map<String, FlowPanel> facetPanels,
      final List<FacetFieldResult> facetResults,
      final boolean hideDisabled) {

    for (FacetFieldResult facetResult : facetResults) {
      final String facetField = facetResult.getField();
      FlowPanel facetPanel = facetPanels.get(facetResult.getField());
      if (facetPanel != null) {
        facetPanel.clear();
        if (facetResult.getTotalCount() == 0) {
          facetPanel.getParent().addStyleName("facet-empty");
        } else {
          facetPanel.getParent().removeStyleName("facet-empty");
        }

        for (FacetValue facetValue : facetResult.getValues()) {
          final String value = facetValue.getValue();
          final String label = facetValue.getLabel();
          long count = facetValue.getCount();
          boolean selected = facetResult.getSelectedValues().contains(value);
          StringBuilder checkboxLabel = new StringBuilder();
          checkboxLabel.append(label);
          if (count > 0 || facetResult.getSelectedValues().size() == 0 || selected) {
            checkboxLabel.append(" (").append(count).append(")");
          }

          CheckBox facetValuePanel = new CheckBox(checkboxLabel.toString());
          facetValuePanel.setTitle(checkboxLabel.toString());
          facetValuePanel.addStyleName("sidebar-facet-label");
          facetValuePanel.addStyleName("fade-out");

          boolean enabled = count > 0 || facetResult.getSelectedValues().size() > 0;
          facetValuePanel.setEnabled(enabled);
          if (hideDisabled) {
            facetValuePanel.setVisible(enabled);
          }
          facetPanel.add(facetValuePanel);

          facetValuePanel.setValue(selected);

          facetValuePanel.addValueChangeHandler(
              new ValueChangeHandler<Boolean>() {

                @Override
                public void onValueChange(ValueChangeEvent<Boolean> event) {
                  Facets facets = list.getFacets();
                  FacetParameter selectedFacetParameter = facets.getParameters().get(facetField);

                  if (selectedFacetParameter != null) {
                    if (event.getValue()) {
                      selectedFacetParameter.getValues().add(value);
                    } else {
                      selectedFacetParameter.getValues().remove(value);
                    }
                  } else {
                    LOGGER.warn("Haven't found the facet parameter: " + facetField);
                  }
                  list.setFacets(facets);
                }
              });
        }

      } else {
        LOGGER.warn("Got a facet but haven't got a panel for it");
      }
    }
  }