Skip to content

Commit

Permalink
Additional changes to BootSelect*Menu (opened upon page load, opened
Browse files Browse the repository at this point in the history
when auto suggestion behavoir is enabled) and changes to BootColumn
offset to specify to media class (xs, sm, md, lg)
  • Loading branch information
kwakutwumasi committed Sep 22, 2015
1 parent 3890e93 commit dda8f7b
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 8 deletions.
17 changes: 16 additions & 1 deletion Quakearts Webtools Jboss61/boot-src/META-INF/boot.taglib.xml
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,16 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http:/
<name>style</name>
</attribute>
<attribute>
<name>offset</name>
<name>offsetxs</name>
</attribute>
<attribute>
<name>offsetsm</name>
</attribute>
<attribute>
<name>offsetmd</name>
</attribute>
<attribute>
<name>offsetlg</name>
</attribute>
</tag>
<tag>
Expand Down Expand Up @@ -1497,6 +1506,9 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http:/
<attribute>
<name>delay</name>
</attribute>
<attribute>
<name>opened</name>
</attribute>
</tag>
<tag>
<tag-name>selectOneListbox</tag-name>
Expand Down Expand Up @@ -1771,6 +1783,9 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http:/
<attribute>
<name>delay</name>
</attribute>
<attribute>
<name>opened</name>
</attribute>
</tag>
<tag>
<tag-name>selectOneInputGroup</tag-name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,33 @@ public void encodeBegin(FacesContext context, UIComponent component)

BootColumn column = (BootColumn) component;

boolean offset = Boolean.parseBoolean(column.get("offset"));
boolean offset = Boolean.parseBoolean(column.get("offsetxs"));

StringBuilder classString = new StringBuilder();
boolean space =false;
if(column.xsSize()>0){
classString.append("col-xs-"+(offset?"offset-":"")+column.xsSize());
space=true;
}


offset = Boolean.parseBoolean(column.get("offsetsm"));

if(column.smSize()>0){
if(!space) space=true;
else classString.append(" ");

classString.append("col-sm-"+(offset?"offset-":"")+column.smSize());
}

offset = Boolean.parseBoolean(column.get("offsetmd"));
if(column.mdSize()>0){
if(!space) space=true;
else classString.append(" ");

classString.append("col-md-"+(offset?"offset-":"")+column.mdSize());
}


offset = Boolean.parseBoolean(column.get("offsetlg"));
if(column.lgSize()>0){
if(!space) space=true;
else classString.append(" ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ protected void renderSelect(FacesContext context, UIComponent component)
if(!componentDisabled)
renderOnchange(context, component, false);

boolean opened = Boolean.parseBoolean(get("opened", component));
boolean hasSuggestions = false;

if(isDropDown){
writer.write("\n");
String label = get("label", component);
Expand All @@ -259,8 +262,10 @@ protected void renderSelect(FacesContext context, UIComponent component)
writer.writeAttribute("name", id+"_filter", null);
writer.writeAttribute("onfocus", "$(this).select();", null);

if(behavior.hasSuggestion())
if(behavior.hasSuggestion()){
writer.writeAttribute("value", behavior.getSuggest(), null);
hasSuggestions = true;
}

writer.writeAttribute("onkeyup", behavior.getScript(ClientBehaviorContext
.createClientBehaviorContext(context, component, "keyup", id, null)), null);
Expand All @@ -272,6 +277,7 @@ protected void renderSelect(FacesContext context, UIComponent component)
writer.writeAttribute("id", id+"_button", null);
writer.writeAttribute("class", "select-many-dropdown btn btn-"
+ getDisplayType(component, context)
+ (fill && behavior==null?" btn-block":"")
+ (styleClass != null ? " " + styleClass : ""), null);
writer.writeAttribute("onclick", "qaboot.selectManyDropDown('dd_"+idjs+"');", null);
writer.writeAttribute("type", "button", null);
Expand All @@ -289,7 +295,6 @@ protected void renderSelect(FacesContext context, UIComponent component)
String keypressed = get("onkeypressed", component);
if(keypressed!=null)
writer.writeAttribute("onkeypressed", keypressed, null);


writer.writeText(label!=null?label:"",null);
writer.write("\n");
Expand All @@ -316,8 +321,9 @@ protected void renderSelect(FacesContext context, UIComponent component)

writer.startElement("div", component);
writer.writeAttribute("id", "dd_"+id, null);
opened = opened || !holder.options.isEmpty() || (hasSuggestions && holder.total>0);
if(limit && holder.total>size){
writer.writeAttribute("class", (isDropDown && holder.options.isEmpty()?" collapse":""), null);
writer.writeAttribute("class", (isDropDown && !opened?" collapse":""), null);

writer.write("\n");
writer.startElement("button", component);
Expand Down Expand Up @@ -349,7 +355,7 @@ protected void renderSelect(FacesContext context, UIComponent component)
writer.writeAttribute("style", styleBuilder.toString(), null);
}
} else {
writer.writeAttribute("class", "list-group"+(isDropDown && holder.options.isEmpty()?" collapse":""), null);
writer.writeAttribute("class", "list-group"+(isDropDown && !opened?" collapse":""), null);
}

writer.write("\n");
Expand Down
Binary file modified Quakearts Webtools Jboss61/dist/qa-bootstrap.jar
Binary file not shown.

0 comments on commit dda8f7b

Please sign in to comment.