Skip to content

Commit

Permalink
Merge pull request #278 from ArcBees/jl_266
Browse files Browse the repository at this point in the history
#266 Complete documentation
  • Loading branch information
jasonlemay committed Oct 5, 2015
2 parents 1a8e10e + 9d78241 commit f869973
Show file tree
Hide file tree
Showing 6 changed files with 284 additions and 57 deletions.
22 changes: 12 additions & 10 deletions plugin/src/main/java/com/arcbees/chosen/client/ChosenOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ public int getDisableSearchThreshold() {
return disableSearchThreshold;
}

public String getManySelectedTextMultipleMobile() {
return manySelectedTextMultipleMobile;
}

public String getOneSelectedTextMultipleMobile() {
return oneSelectedTextMultipleMobile;
}

/**
* Set the number of items needed to show and enable the search input. This option is when the Chosen component is
* used in "multiple select" mode or when a custom ResultFilter is used.
Expand Down Expand Up @@ -151,6 +143,10 @@ public ChosenOptions setMobileViewportMaxWidth(int mobileViewportMaxWidth) {
return this;
}

public String getOneSelectedTextMultipleMobile() {
return oneSelectedTextMultipleMobile;
}

/**
* Set the text to use when one option is selected on a mobile multiple select.
* <p/>
Expand All @@ -159,8 +155,13 @@ public ChosenOptions setMobileViewportMaxWidth(int mobileViewportMaxWidth) {
* Ex:
* options.setOneSelectedTextMultipleMobile("{} country selected");
*/
public void setOneSelectedTextMultipleMobile(String oneSelectedTextMultipleMobile) {
public ChosenOptions setOneSelectedTextMultipleMobile(String oneSelectedTextMultipleMobile) {
this.oneSelectedTextMultipleMobile = oneSelectedTextMultipleMobile;
return this;
}

public String getManySelectedTextMultipleMobile() {
return manySelectedTextMultipleMobile;
}

/**
Expand All @@ -171,8 +172,9 @@ public void setOneSelectedTextMultipleMobile(String oneSelectedTextMultipleMobil
* Ex:
* options.setManySelectedTextMultipleMobile("{} countries selected");
*/
public void setManySelectedTextMultipleMobile(String manySelectedTextMultipleMobile) {
public ChosenOptions setManySelectedTextMultipleMobile(String manySelectedTextMultipleMobile) {
this.manySelectedTextMultipleMobile = manySelectedTextMultipleMobile;
return this;
}

public String getNoResultsText() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import com.arcbees.chosen.client.ChosenOptions;
import com.arcbees.chosen.client.DropdownPosition;
import com.arcbees.chosen.sample.client.resources.ChosenCustomResources;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.SelectElement;
import com.google.gwt.event.logical.shared.AttachEvent;
Expand All @@ -34,6 +35,7 @@ interface Binder extends UiBinder<Widget, ChosenOptionsView> {
}

private static final Binder binder = GWT.create(Binder.class);
private static final ChosenCustomResources CUSTOM_RESOURCES = GWT.create(ChosenCustomResources.class);

@UiField
SelectElement allowSingleDeselect;
Expand All @@ -50,11 +52,23 @@ interface Binder extends UiBinder<Widget, ChosenOptionsView> {
@UiField
SelectElement dropdownPosition;
@UiField
SelectElement dropdownResources;
@UiField
SelectElement mobileWidth;
@UiField
SelectElement mobileAnimation;
@UiField
SelectElement mobileSpeed;
@UiField
SelectElement dropdownPlaceholder;
@UiField
SelectElement dropdownPlaceholderSingle;
@UiField
SelectElement dropdownPlaceholderMultiple;
@UiField
SelectElement mobileOneText;
@UiField
SelectElement mobileManyText;

private final Widget widget;

Expand Down Expand Up @@ -86,6 +100,18 @@ public void onAttachOrDetach(AttachEvent attachEvent) {
$(dropdownPosition).as(Chosen).chosen(
new ChosenOptions().setDropdownPosition(DropdownPosition.ABOVE));

$(dropdownResources).as(Chosen).chosen(
new ChosenOptions().setResources(CUSTOM_RESOURCES));

$(dropdownPlaceholder).as(Chosen).chosen(
new ChosenOptions().setPlaceholderText("Well, hello!"));

$(dropdownPlaceholderSingle).as(Chosen).chosen(
new ChosenOptions().setPlaceholderTextSingle("I'm single, ladies!"));

$(dropdownPlaceholderMultiple).as(Chosen).chosen(
new ChosenOptions().setPlaceholderTextMultiple("I'm so multiple!"));

$(mobileWidth).as(Chosen).chosen(
new ChosenOptions().setMobileViewportMaxWidth(2000));

Expand All @@ -94,6 +120,12 @@ public void onAttachOrDetach(AttachEvent attachEvent) {

$(mobileSpeed).as(Chosen).chosen(
new ChosenOptions().setMobileAnimationSpeed(1500));

$(mobileOneText).as(Chosen).chosen(
new ChosenOptions().setOneSelectedTextMultipleMobile("{} bear selected"));

$(mobileManyText).as(Chosen).chosen(
new ChosenOptions().setManySelectedTextMultipleMobile("{} bears selected"));
}
}
});
Expand Down
Loading

0 comments on commit f869973

Please sign in to comment.