Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#266 Complete documentation #278

Merged
merged 1 commit into from
Oct 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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