Java 类com.google.gwt.user.client.ui.SimpleCheckBox 实例源码

项目:activity-recommendation-app    文件:DiscussionView.java   
@Override
public void buildSpacesList() {
    targetGroupsCheckBoxList.removeAllChildren();

    final Map<String, String> spaces = instance.getSpacesMap();
    List<String> spaceIds = new ArrayList<String>();
    spaceIds.addAll(spaces.keySet());

    Comparator<String> compare = new Comparator<String>() {

        @Override
        public int compare(String o1, String o2) {
            String name1 = spaces.get(o1);
            String name2 = spaces.get(o2);
            return name1.compareToIgnoreCase(name2);
        }
    };

    Collections.sort(spaceIds, compare);

    checkBoxes = new HashMap<String, SimpleCheckBox>();

    for (String id:spaceIds) {
        addSpaceToList(id, spaces.get(id));
    }       
}
项目:activity-recommendation-app    文件:DiscussionView.java   
public void updateTargetGroupsList() {
    Map<String, String> spaces = instance.getSpacesMap();

    targetGroupsList.removeAllChildren();
    targetSpaces.clear();
    StringBuilder builder = new StringBuilder();
    for (SimpleCheckBox box:checkBoxes.values()) {
        if (box.getValue()) {
            Element liElement = Document.get().createLIElement();
            liElement.setInnerHTML(spaces.get(box.getFormValue()));
            builder.append(spaces.get(box.getFormValue())).append(",");
            targetGroupsList.appendChild(liElement);
            targetSpaces.add(box.getFormValue());
        }
    }
    if (builder.length() > 0) {
        builder.setLength(builder.length()-1);
    }
    targetGroups = builder.toString();
    sendCompleteInformation();
}
项目:activity-recommendation-app    文件:DiscussionView.java   
private void addSpaceToList(String id, String spaceName) {
    Element trElement = Document.get().createTRElement();

    Element tdCheckElement = Document.get().createTDElement();
    SimpleCheckBox checkBox = SimpleCheckBox.wrap(Document.get().createCheckInputElement());
    checkBox.setFormValue(id);

    Element tdTitleElement = Document.get().createTDElement();
    Element spanElement = Document.get().createSpanElement();
    spanElement.setInnerHTML(spaceName);

    tdCheckElement.appendChild(checkBox.getElement());
    tdTitleElement.appendChild(spanElement);

    trElement.appendChild(tdCheckElement);
    trElement.appendChild(tdTitleElement);

    targetGroupsCheckBoxList.appendChild(trElement);        
    checkBoxes.put(id, checkBox);
    targetSpacesListElements.put(id, trElement);
}
项目:che    文件:Switcher.java   
public Switcher() {
  FlowPanel mainPanel = new FlowPanel();
  mainPanel.setStyleName(RESOURCES.switcherCSS().onoffswitch());

  final String elementId = DOM.createUniqueId();

  checkbox = new SimpleCheckBox();
  checkbox.getElement().setId(elementId);
  checkbox.setName("onoffswitch");
  checkbox.setStyleName(RESOURCES.switcherCSS().onoffswitchCheckbox());
  mainPanel.add(checkbox);

  Element label = DOM.createLabel();
  label.setClassName(RESOURCES.switcherCSS().onoffswitchLabel());
  label.setAttribute("for", elementId);

  Element inner = DOM.createDiv();
  inner.setClassName(RESOURCES.switcherCSS().onoffswitchInner());
  label.appendChild(inner);

  Element sw = DOM.createDiv();
  sw.setClassName(RESOURCES.switcherCSS().onoffswitchSwitch());
  label.appendChild(sw);

  mainPanel.getElement().appendChild(label);

  initWidget(mainPanel);
}
项目:dhcalc    文件:BasePanel.java   
protected void setFieldValue(Field f, String value) {

        Object field = f.field;

        if (value == null)
            value = f.defaultValue;

        if (field instanceof TextBox)
            setFieldValue((TextBox) field, value);
        else if (field instanceof IntegerBox)
            setFieldValue((IntegerBox) field, value);
        else if (field instanceof NumberSpinner)
            setFieldValue((NumberSpinner) field, value);
        else if (field instanceof LongSpinner)
            setFieldValue((LongSpinner) field, value);
        else if (field instanceof DoubleSpinner)
            setFieldValue((DoubleSpinner) field, value);
        else if (field instanceof DoubleBox)
            setFieldValue((DoubleBox) field, value);
        else if (field instanceof SimpleCheckBox)
            setFieldValue((SimpleCheckBox) field, value);
        else if (field instanceof ListBox)
            setFieldValue((ListBox) field, value);
        else if (field instanceof PassivesPanel)
            setFieldValue((PassivesPanel) field, value);
        else if (field instanceof GemsPanel)
            setFieldValue((GemsPanel) field, value);
        else if (field instanceof ItemPanel)
            setFieldValue((ItemPanel) field, value);
        else if (field instanceof SkillsPanel)
            setFieldValue((SkillsPanel) field, value);
        else if (field instanceof DamageTypePanel)
            setFieldValue((DamageTypePanel) field, value);
        else if (field instanceof SkillDamagePanel)
            setFieldValue((SkillDamagePanel) field, value);
    }
项目:google-apis-explorer    文件:SchemaForm.java   
@Override
public Widget render(Schema property) {
  checkbox = new SimpleCheckBox();

  // Set it to true if that is the default.
  checkbox.setValue("true".equals(property.getDefault()));

  // If this property is locked, disable the checkbox
  if (property.locked()) {
    checkbox.setEnabled(false);
  }
  return checkbox;
}
项目:activity-recommendation-app    文件:OpenDiscussionPopup.java   
private void addSpaceToList(final String id) {
    HTML trHTML = HTML.wrap(Document.get().createTRElement());
    Element checkTD = Document.get().createTDElement();
    SimpleCheckBox checkBox = SimpleCheckBox.wrap(Document.get().createCheckInputElement());
    checkBox.addClickHandler(new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
              if (((SimpleCheckBox)event.getSource()).getValue()) {
                  selectedSpaces.add(id);
              } else {
                  selectedSpaces.remove(id);
              }
              updateParticipantsLabel();
          }
        });    
    if (selectedSpaces.contains(id)) {
        checkBox.setValue(true);
    }
    checkTD.appendChild(checkBox.getElement());

    Element nameTD = Document.get().createTDElement();
    nameTD.setInnerHTML(spaces.get(id));

    trHTML.getElement().appendChild(checkTD);
    trHTML.getElement().appendChild(nameTD);

    discussionGroupsTable.appendChild(trHTML.getElement());
    tableElements.put(id, trHTML);
    groupCheckBoxes.put(id, checkBox);
}
项目:activity-recommendation-app    文件:AttachEvidenceDialog.java   
public AttachEvidenceDialog(final ARApp instance) {
        super(instance);
        dia = new DialogBox();
        dia.setGlassEnabled(true);
        dia.setGlassStyleName("transparent");

        attachedEvidences = new ArrayList<Evidence>();
        evidenceSpaceIds = new ArrayList<String>();
//      dataObjects = new HashMap<String, JavaScriptObject>();
        listElements = new HashMap<String, HTML>();
        checkBoxes = new HashMap<String, SimpleCheckBox>();

        build();
    }
项目:activity-recommendation-app    文件:AttachEvidenceDialog.java   
private void addSpaceToList(final String id) {
    HTML trHTML = HTML.wrap(Document.get().createTRElement());
    Element checkTD = Document.get().createTDElement();
    SimpleCheckBox checkBox = SimpleCheckBox.wrap(Document.get().createCheckInputElement());
    checkBox.addClickHandler(new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
              if (((SimpleCheckBox)event.getSource()).getValue()) {
                  evidenceSpaceIds.add(id);
              } else {
                  evidenceSpaceIds.remove(id);
              }
              if (instance.persistenceServiceAvailable()) {
                    int index = publishersListBox.getSelectedIndex();
                    String publisher = null;
                    if (index > 0) {
                        publisher = publishersListBox.getValue(index);
                    }
                    queryDataObjects(evidenceSpaceIds, publisher, time);
              } else {
                  buildEvidenceList();
              }
          }
        });   
    checkTD.appendChild(checkBox.getElement());

    Element nameTD = Document.get().createTDElement();
    nameTD.setInnerHTML(spaces.get(id));

    trHTML.getElement().appendChild(checkTD);
    trHTML.getElement().appendChild(nameTD);

    spacesList.appendChild(trHTML.getElement());
    listElements.put(id, trHTML);
}
项目:dhcalc    文件:ParagonPanel.java   
public SimpleCheckBox getAutoFill() {
    return autoFill;
}
项目:dhcalc    文件:ItemPanel.java   
public SimpleCheckBox getOtherSets() {
    return otherSets;
}
项目:dhcalc    文件:SkillsPanel.java   
public SimpleCheckBox getSyncWithCoe() {
    return this.syncWithCoe;
}
项目:dhcalc    文件:SkillsPanel.java   
public SimpleCheckBox getSpenderFullHatred() {
    return spenderFullHatred;
}
项目:dhcalc    文件:PlayerBuffPanel.java   
public SimpleCheckBox getWolf() {
    return wolf;
}
项目:dhcalc    文件:PlayerBuffPanel.java   
public SimpleCheckBox getBbv() {
    return bbv;
}
项目:dhcalc    文件:PlayerBuffPanel.java   
public SimpleCheckBox getMassConfusion() {
    return massConfusion;
}
项目:dhcalc    文件:PlayerBuffPanel.java   
public SimpleCheckBox getInnerSanctuary() {
    return innerSanctuary;
}
项目:dhcalc    文件:PlayerBuffPanel.java   
public SimpleCheckBox getConviction() {
    return conviction;
}
项目:dhcalc    文件:PlayerBuffPanel.java   
public SimpleCheckBox getCripplingWave() {
    return cripplingWave;
}
项目:dhcalc    文件:PlayerBuffPanel.java   
public SimpleCheckBox getPiranhas() {
    return piranhas;
}
项目:dhcalc    文件:PlayerBuffPanel.java   
public SimpleCheckBox getFalter() {
    return falter;
}
项目:dhcalc    文件:PlayerBuffPanel.java   
public SimpleCheckBox getToxin() {
    return toxin;
}
项目:dhcalc    文件:PlayerBuffPanel.java   
public SimpleCheckBox getIceblink() {
    return iceblink;
}
项目:dhcalc    文件:PlayerBuffPanel.java   
public SimpleCheckBox getOverawe() {
    return overawe;
}
项目:dhcalc    文件:PlayerBuffPanel.java   
public SimpleCheckBox getValor() {
    return valor;
}
项目:dhcalc    文件:PlayerBuffPanel.java   
public SimpleCheckBox getRetribution() {
    return retribution;
}
项目:dhcalc    文件:PlayerBuffPanel.java   
public SimpleCheckBox getSlamDance() {
    return slamDance;
}
项目:dhcalc    文件:PlayerBuffPanel.java   
public SimpleCheckBox getTimeWarp() {
    return timeWarp;
}
项目:dhcalc    文件:PlayerBuffPanel.java   
public SimpleCheckBox getUnity() {
    return unity;
}
项目:dhcalc    文件:PlayerBuffPanel.java   
public SimpleCheckBox getStretchTime() {
    return stretchTime;
}
项目:dhcalc    文件:PlayerBuffPanel.java   
public SimpleCheckBox getOculus() {
    return oculus;
}
项目:dhcalc    文件:BuffPanel.java   
public SimpleCheckBox getFocusedMind() {
    return focusedMind;
}
项目:dhcalc    文件:BuffPanel.java   
public SimpleCheckBox getAnatomy() {
    return anatomy;
}
项目:dhcalc    文件:BuffPanel.java   
public SimpleCheckBox getHysteria() {
    return hysteria;
}
项目:dhcalc    文件:BuffPanel.java   
public SimpleCheckBox getInspire() {
    return inspire;
}
项目:dhcalc    文件:BuffPanel.java   
public SimpleCheckBox getOculus() {
    return oculus;
}
项目:dhcalc    文件:BasePanel.java   
protected String getFieldValue(Field f) {
    Object field = f.field;
    String defaultValue = f.defaultValue;

    if (field instanceof TextBox)
        return getFieldValue((TextBox) field, defaultValue);
    else if (field instanceof IntegerBox)
        return getFieldValue((IntegerBox) field, defaultValue);
    else if (field instanceof NumberSpinner)
        return getFieldValue((NumberSpinner) field, defaultValue);
    else if (field instanceof LongSpinner)
        return getFieldValue((LongSpinner) field, defaultValue);
    else if (field instanceof DoubleSpinner)
        return getFieldValue((DoubleSpinner) field, defaultValue);
    else if (field instanceof DoubleBox)
        return getFieldValue((DoubleBox) field, defaultValue);
    else if (field instanceof SimpleCheckBox)
        return getFieldValue((SimpleCheckBox) field, defaultValue);
    else if (field instanceof ListBox)
        return getFieldValue((ListBox) field, defaultValue);
    else if (field instanceof PassivesPanel)
        return getFieldValue(((PassivesPanel) field).getPassives(),
                defaultValue);
    else if (field instanceof GemsPanel)
        return getGemsFieldValue(((GemsPanel) field).getGems(),
                defaultValue);
    else if (field instanceof ItemPanel)
        return getSpecialItemsFieldValue(((ItemPanel) field).getItems(),
                ((ItemPanel) field).getSetCounts(), defaultValue);
    else if (field instanceof SkillsPanel)
        return getEnumFieldValue(((SkillsPanel) field).getSkills(),
                defaultValue);
    else if (field instanceof DamageTypePanel)
        return getFieldValue(((DamageTypePanel) field).getValues(),
                defaultValue);
    else if (field instanceof SkillDamagePanel)
        return getFieldValue(((SkillDamagePanel) field).getValues(),
                defaultValue);
    else
        return defaultValue;
}
项目:dhcalc    文件:BasePanel.java   
protected String getFieldValue(SimpleCheckBox field, String defaultValue) {
    return String.valueOf(field.getValue());
}
项目:dhcalc    文件:BasePanel.java   
protected void setFieldValue(SimpleCheckBox field, String value) {
    field.setValue(Boolean.valueOf(value));
}
项目:activity-recommendation-app    文件:DiscussionView.java   
/**
 * If new information are available this method can be called to update the shown information.
 */
public void update() {      
    Map<String, String> discussions = instance.getDiscussions();
    if (discussions.get(discussionSpaceId) == null) {
        moderatorJid = instance.getBareJID();
        isModerator = true;
        title.setText(discussionSpaceId);

        issueLabel.getElement().setInnerHTML(discussionEntryMessage.emptyIssueHtml());
        solutionLabel.getElement().setInnerHTML(discussionEntryMessage.emptySolutionHtml());
        ratingLabel.setInnerText(discussionEntryMessage.standardRatingText());
        ratingTextArea.setText(discussionEntryMessage.standardRatingText());
        benefit = null;
        effort = null;
        targetGroups = null;
        ref = null;
        targetGroups = "";
        customId = null;

        participants.clear();
        minuteEntries.clear();
        dataObjects.clear();
        attachedEvidences.clear();
        targetSpaces.clear();

        targetGroupsList.removeAllChildren();
        if (checkBoxes != null) {
            for (SimpleCheckBox checkBox:checkBoxes.values()) {
                checkBox.setValue(false);
            }
        }

        participants.add(moderatorJid);
        updateParticipantsLabel();
        sendNewEntry(discussionEntryMessage.openMessage(instance.getDisplayNameForJid(moderatorJid), HasTimestamp.MEDIUMDATE.format(new Date())));
    } else {
        com.google.gwt.xml.client.Element discElem = Parser.parseXMLStringToElement(discussions.get(discussionSpaceId));
        if (discElem != null) {
            List<RecommendationObject> objs = Parser.parseRecommendations(discElem);
            if (objs != null && objs.size() > 0) {
                final RecommendationObject obj = objs.get(0);
                final Map<String, String> infos = SessionObject.getAllInformation(discussions.get(discussionSpaceId));

                updateInfosWithRecommendation(obj);
                updateInfos(infos);
            }
        }
    }
}