Skip to content

Commit

Permalink
#979 added the attribute badgeSpan
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanrauh committed Jul 24, 2018
1 parent d3f01ff commit fa25439
Show file tree
Hide file tree
Showing 7 changed files with 348 additions and 149 deletions.
321 changes: 231 additions & 90 deletions src/main/java/net/bootsfaces/component/ComponentsEnum.java

Large diffs are not rendered by default.

18 changes: 17 additions & 1 deletion src/main/java/net/bootsfaces/component/slider/Slider.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void processEvent(ComponentSystemEvent event) throws AbortProcessingExcep
}

protected enum PropertyKeys {
autoUpdate, badgeStyle, badgeStyleClass, binding, disabled, handleShape, handleSize, inline, label, labelStyle, labelStyleClass, max, min, mode, orientation, span, step, style, styleClass, tooltip, tooltipContainer, tooltipDelay, tooltipDelayHide, tooltipDelayShow, tooltipPosition;
autoUpdate, badgeSpan, badgeStyle, badgeStyleClass, binding, disabled, handleShape, handleSize, inline, label, labelStyle, labelStyleClass, max, min, mode, orientation, span, step, style, styleClass, tooltip, tooltipContainer, tooltipDelay, tooltipDelayHide, tooltipDelayShow, tooltipPosition;
String toString;

PropertyKeys(String toString) {
Expand Down Expand Up @@ -127,6 +127,22 @@ public void setAutoUpdate(boolean _autoUpdate) {
getStateHelper().put(PropertyKeys.autoUpdate, _autoUpdate);
}

/**
* The column span of the badge or input field (if it's shown). <P>
* @return Returns the value of the attribute, or 1, if it hasn't been set by the JSF file.
*/
public int getBadgeSpan() {
return (int) (Integer) getStateHelper().eval(PropertyKeys.badgeSpan, 1);
}

/**
* The column span of the badge or input field (if it's shown). <P>
* Usually this method is called internally by the JSF engine.
*/
public void setBadgeSpan(int _badgeSpan) {
getStateHelper().put(PropertyKeys.badgeSpan, _badgeSpan);
}

/**
* Inline style of the badge or input field (if it's shown). <P>
* @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private void encodeHTML(Slider slider, FacesContext context, ResponseWriter rw)
rw.startElement("div", null);
rw.writeAttribute("class", "row", "class");
if (bottom) {
encodeSliderDiv(rw, isVertical, mode, span, clientId);
encodeSliderDiv(rw, isVertical, mode, span, slider.getBadgeSpan(), clientId);
rw.endElement("div");/* Row */
rw.startElement("div", null);
rw.writeAttribute("class", "row", "class");
Expand All @@ -168,7 +168,7 @@ private void encodeHTML(Slider slider, FacesContext context, ResponseWriter rw)

rw.startElement("div", null);
rw.writeAttribute("class", "row " + getErrorAndRequiredClass(slider, clientId), "class");
encodeSliderDiv(rw, isVertical, mode, span, clientId);
encodeSliderDiv(rw, isVertical, mode, span, slider.getBadgeSpan(), clientId);
}
rw.endElement("div"); /* Row */
if (label != null && bottom) {
Expand Down Expand Up @@ -215,7 +215,7 @@ private void encodeHTML(Slider slider, FacesContext context, ResponseWriter rw)

encodeInput(slider, rw, mode, context, val, clientId, isVertical, min, max);

encodeSliderDiv(rw, isVertical, mode, span, clientId);
encodeSliderDiv(rw, isVertical, mode, span, slider.getBadgeSpan(), clientId);
rw.endElement("div");/* Row */

}
Expand Down Expand Up @@ -243,7 +243,7 @@ private void encodeVLabel(Slider slider, ResponseWriter rw, String label) throws

private void encodeInput(Slider slider, ResponseWriter rw, String mode, FacesContext context, int val,
String clientId, boolean vo, int min, int max) throws IOException {
int cols = (vo ? 12 : 1);
int cols = (vo ? 12 : slider.getBadgeSpan());
if (!mode.equals("basic")) {
/*
* int span, int offset, int cxs, int csm, int clg, int oxs, int
Expand Down Expand Up @@ -309,11 +309,11 @@ private void removeMisleadingType(Slider slider) {

}

private void encodeSliderDiv(ResponseWriter rw, boolean vo, String mode, int span, String clientId)
private void encodeSliderDiv(ResponseWriter rw, boolean vo, String mode, int span, int badgeSpan, String clientId)
throws IOException {
int cols = span;
if (!mode.equals("basic")) {
cols--;
cols -= badgeSpan;
}
/*
* int span, int offset, int cxs, int csm, int clg, int oxs, int osm,
Expand Down
18 changes: 17 additions & 1 deletion src/main/java/net/bootsfaces/component/slider2/Slider2Core.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
public abstract class Slider2Core extends HtmlInputText {

protected enum PropertyKeys {
autoUpdate, badgeStyle, badgeStyleClass, binding, disabled, focus, formatter, handleShape, inline, label, labelStyle, labelStyleClass, labelledBy, max, min, mode, natural_arrow_keys, orientation, precision, reversed, scale, selection, span, step, style, styleClass, tooltipSliderPosition, tooltipSplit, tooltipVisibility;
autoUpdate, badgeSpan, badgeStyle, badgeStyleClass, binding, disabled, focus, formatter, handleShape, inline, label, labelStyle, labelStyleClass, labelledBy, max, min, mode, natural_arrow_keys, orientation, precision, reversed, scale, selection, span, step, style, styleClass, tooltipSliderPosition, tooltipSplit, tooltipVisibility;
String toString;

PropertyKeys(String toString) {
Expand Down Expand Up @@ -55,6 +55,22 @@ public void setAutoUpdate(boolean _autoUpdate) {
getStateHelper().put(PropertyKeys.autoUpdate, _autoUpdate);
}

/**
* The column span of the badge or input field (if it's shown). <P>
* @return Returns the value of the attribute, or 1, if it hasn't been set by the JSF file.
*/
public int getBadgeSpan() {
return (int) (Integer) getStateHelper().eval(PropertyKeys.badgeSpan, 1);
}

/**
* The column span of the badge or input field (if it's shown). <P>
* Usually this method is called internally by the JSF engine.
*/
public void setBadgeSpan(int _badgeSpan) {
getStateHelper().put(PropertyKeys.badgeSpan, _badgeSpan);
}

/**
* Inline style of the badge or input field (if it's shown). <P>
* @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ private void encodeVLabel(Slider2 slider, ResponseWriter rw, String label) throw

private void encodeInput(Slider2 slider, ResponseWriter rw, String mode, FacesContext context, int val,
String clientId, boolean vo, int min, int max) throws IOException {
int cols = (vo ? 12 : 1);
int cols = (vo ? 12 : slider.getBadgeSpan());
if (!mode.equals("basic")) {
/*
* int span, int offset, int cxs, int csm, int clg, int oxs, int
Expand Down Expand Up @@ -319,7 +319,7 @@ private void encodeSliderInput(Slider2 slider, ResponseWriter rw, boolean vo, in
throws IOException {
int cols = span;
if (!slider.getMode().equals("basic")) {
cols--;
cols -= slider.getBadgeSpan();
}
/*
* int span, int offset, int cxs, int csm, int clg, int oxs, int osm,
Expand Down
122 changes: 73 additions & 49 deletions src/main/meta/META-INF/bootsfaces-b.taglib.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18372,40 +18372,40 @@
<component-type>net.bootsfaces.component.openStreetMap.OpenStreetMap</component-type>
</component>
<attribute>
<description><![CDATA[center]]></description>
<name>center</name>
<required>true</required>
<type>java.lang.String</type>
<description><![CDATA[attribution]]></description>
<name>attribution</name>
<required>false</required>
<type>String</type>
</attribute>
<attribute>
<description><![CDATA[marker]]></description>
<name>marker</name>
<description><![CDATA[center]]></description>
<name>center</name>
<required>false</required>
<type>java.lang.String</type>
<type>String</type>
</attribute>
<attribute>
<description><![CDATA[popupMsg]]></description>
<name>popupMsg</name>
<description><![CDATA[dragging]]></description>
<name>dragging</name>
<required>false</required>
<type>java.lang.String</type>
<type>java.lang.Boolean</type>
</attribute>
<attribute>
<description><![CDATA[zoom]]></description>
<name>zoom</name>
<description><![CDATA[height]]></description>
<name>height</name>
<required>false</required>
<type>java.lang.Integer</type>
<type>String</type>
</attribute>
<attribute>
<description><![CDATA[width]]></description>
<name>width</name>
<description><![CDATA[marker]]></description>
<name>marker</name>
<required>false</required>
<type>java.lang.String</type>
<type>String</type>
</attribute>
<attribute>
<description><![CDATA[height]]></description>
<name>height</name>
<description><![CDATA[maxZoom]]></description>
<name>maxZoom</name>
<required>false</required>
<type>java.lang.String</type>
<type>java.lang.Integer</type>
</attribute>
<attribute>
<description><![CDATA[minZoom]]></description>
Expand All @@ -18414,65 +18414,65 @@
<type>java.lang.Integer</type>
</attribute>
<attribute>
<description><![CDATA[maxZoom]]></description>
<name>maxZoom</name>
<description><![CDATA[miniMap]]></description>
<name>miniMap</name>
<required>false</required>
<type>java.lang.Integer</type>
<type>java.lang.Boolean</type>
</attribute>
<attribute>
<description><![CDATA[dragging]]></description>
<name>dragging</name>
<description><![CDATA[miniMapHeight]]></description>
<name>miniMapHeight</name>
<required>false</required>
<type>java.lang.Boolean</type>
<type>java.lang.Integer</type>
</attribute>
<attribute>
<description><![CDATA[zoomControl]]></description>
<name>zoomControl</name>
<description><![CDATA[miniMapPosition]]></description>
<name>miniMapPosition</name>
<required>false</required>
<type>java.lang.Boolean</type>
<type>String</type>
</attribute>
<attribute>
<description><![CDATA[zoomGlobal]]></description>
<name>zoomGlobal</name>
<description><![CDATA[miniMapWidth]]></description>
<name>miniMapWidth</name>
<required>false</required>
<type>java.lang.Boolean</type>
<type>java.lang.Integer</type>
</attribute>
<attribute>
<description><![CDATA[attribution]]></description>
<name>attribution</name>
<description><![CDATA[popupMsg]]></description>
<name>popupMsg</name>
<required>false</required>
<type>java.lang.String</type>
<type>String</type>
</attribute>
<attribute>
<description><![CDATA[miniMap]]></description>
<name>miniMap</name>
<description><![CDATA[urlTemplate]]></description>
<name>urlTemplate</name>
<required>false</required>
<type>java.lang.Boolean</type>
<type>String</type>
</attribute>
<attribute>
<description><![CDATA[miniMapWidth]]></description>
<name>miniMapWidth</name>
<description><![CDATA[width]]></description>
<name>width</name>
<required>false</required>
<type>java.lang.Integer</type>
<type>String</type>
</attribute>
<attribute>
<description><![CDATA[miniMapHeight]]></description>
<name>miniMapHeight</name>
<description><![CDATA[zoom]]></description>
<name>zoom</name>
<required>false</required>
<type>java.lang.Integer</type>
</attribute>
<attribute>
<description><![CDATA[miniMapPosition]]></description>
<name>miniMapPosition</name>
<description><![CDATA[zoomControl]]></description>
<name>zoomControl</name>
<required>false</required>
<type>java.lang.String</type>
<type>java.lang.Boolean</type>
</attribute>
<attribute>
<description><![CDATA[urlTemplate]]></description>
<name>urlTemplate</name>
<description><![CDATA[zoomGlobal]]></description>
<name>zoomGlobal</name>
<required>false</required>
<type>java.lang.String</type>
</attribute>
<type>java.lang.Boolean</type>
</attribute>
</tag>

<!-- *********** b:panel ************************* -->
Expand Down Expand Up @@ -24243,6 +24243,18 @@
<required>false</required>
<type>java.lang.Boolean</type>
</attribute>
<attribute>
<description><![CDATA[The column span of the badge or input field (if it's shown).]]></description>
<name>badge-span</name>
<required>false</required>
<type>java.lang.Integer</type>
</attribute>
<attribute>
<description><![CDATA[The column span of the badge or input field (if it's shown).]]></description>
<name>badgeSpan</name>
<required>false</required>
<type>java.lang.Integer</type>
</attribute>
<attribute>
<description><![CDATA[Inline style of the badge or input field (if it's shown).]]></description>
<name>badge-style</name>
Expand Down Expand Up @@ -24497,6 +24509,18 @@
<required>false</required>
<type>java.lang.Boolean</type>
</attribute>
<attribute>
<description><![CDATA[The column span of the badge or input field (if it's shown).]]></description>
<name>badge-span</name>
<required>false</required>
<type>java.lang.Integer</type>
</attribute>
<attribute>
<description><![CDATA[The column span of the badge or input field (if it's shown).]]></description>
<name>badgeSpan</name>
<required>false</required>
<type>java.lang.Integer</type>
</attribute>
<attribute>
<description><![CDATA[Inline style of the badge or input field (if it's shown).]]></description>
<name>badge-style</name>
Expand Down
2 changes: 2 additions & 0 deletions xtext/BootsFaces.jsfdsl
Original file line number Diff line number Diff line change
Expand Up @@ -2165,6 +2165,7 @@ widget slider
step Integer "The step of the slider."
style "Inline style of the entire slider."
style-class "Style class of the entire slider."
badge-span Integer default "1" "The column span of the badge or input field (if it's shown)."
badge-style "Inline style of the badge or input field (if it's shown)."
badge-style-class "Style class of the badge or input field (if it's shown)."
value inherited "Value."
Expand Down Expand Up @@ -2206,6 +2207,7 @@ widget slider2
value Integer default "5" inherited "Initial position of the slider."
style "Inline style of the entire slider."
style-class "Style class of the entire slider."
badge-span Integer default "1" "The column span of the badge or input field (if it's shown)."
badge-style "Inline style of the badge or input field (if it's shown)."
badge-style-class "Style class of the badge or input field (if it's shown)."
}
Expand Down

0 comments on commit fa25439

Please sign in to comment.