Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
后端镜像
java镜像
Springside4
提交
13a8efec
S
Springside4
项目概览
后端镜像
/
java镜像
/
Springside4
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Springside4
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
13a8efec
编写于
9月 01, 2012
作者:
C
Calvin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#85 spring mvc taglib的checkbox, radio 支持twitter bootstrap, 增加labelCssClass属性,可以设为
上级
f2e60810
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
58 addition
and
8 deletion
+58
-8
examples/showcase/src/main/java/org/springside/examples/showcase/web/UserController.java
.../org/springside/examples/showcase/web/UserController.java
+3
-2
examples/showcase/src/main/webapp/WEB-INF/springside-form.tld
...ples/showcase/src/main/webapp/WEB-INF/springside-form.tld
+12
-0
examples/showcase/src/main/webapp/WEB-INF/views/account/userForm.jsp
...owcase/src/main/webapp/WEB-INF/views/account/userForm.jsp
+1
-1
examples/showcase/src/main/webapp/WEB-INF/views/account/userList.jsp
...owcase/src/main/webapp/WEB-INF/views/account/userList.jsp
+1
-1
modules/core/src/main/java/org/springside/modules/web/taglib/BSAbstractMultiCheckedElementTag.java
.../modules/web/taglib/BSAbstractMultiCheckedElementTag.java
+29
-4
modules/core/src/main/resources/META-INF/springside-form.tld
modules/core/src/main/resources/META-INF/springside-form.tld
+12
-0
未找到文件。
examples/showcase/src/main/java/org/springside/examples/showcase/web/UserController.java
浏览文件 @
13a8efec
...
...
@@ -32,8 +32,8 @@ public class UserController {
private
static
Map
<
String
,
String
>
allStatus
=
Maps
.
newHashMap
();
static
{
allStatus
.
put
(
"enabled"
,
"
Enabled
"
);
allStatus
.
put
(
"disabled"
,
"
Disabled
"
);
allStatus
.
put
(
"enabled"
,
"
有效
"
);
allStatus
.
put
(
"disabled"
,
"
无效
"
);
}
//特别设定多个ReuireRoles之间为Or关系,而不是默认的And.
...
...
@@ -42,6 +42,7 @@ public class UserController {
public
String
list
(
Model
model
)
{
List
<
User
>
users
=
accountService
.
getAllUser
();
model
.
addAttribute
(
"users"
,
users
);
model
.
addAttribute
(
"allStatus"
,
allStatus
);
return
"account/userList"
;
}
...
...
examples/showcase/src/main/webapp/WEB-INF/springside-form.tld
浏览文件 @
13a8efec
...
...
@@ -2413,6 +2413,12 @@
<name>
bsradiobuttons
</name>
<tag-class>
org.springside.modules.web.taglib.BSRadioButtonsTag
</tag-class>
<body-content>
empty
</body-content>
<attribute>
<description>
Equivalent to "class" for label emelement. - HTML Optional Attribute
</description>
<name>
labelCssClass
</name>
<required>
false
</required>
<rtexprvalue>
true
</rtexprvalue>
</attribute>
<attribute>
<description>
Path to property for data binding
</description>
<name>
path
</name>
...
...
@@ -2601,6 +2607,12 @@
<name>
bscheckboxes
</name>
<tag-class>
org.springside.modules.web.taglib.BSCheckboxesTag
</tag-class>
<body-content>
empty
</body-content>
<attribute>
<description>
Equivalent to "class" for label emelement. - HTML Optional Attribute
</description>
<name>
labelCssClass
</name>
<required>
false
</required>
<rtexprvalue>
true
</rtexprvalue>
</attribute>
<attribute>
<description>
Path to property for data binding
</description>
<name>
path
</name>
...
...
examples/showcase/src/main/webapp/WEB-INF/views/account/userForm.jsp
浏览文件 @
13a8efec
...
...
@@ -59,7 +59,7 @@
<div
class=
"control-group"
>
<label
for=
"status"
class=
"control-label"
>
状态:
</label>
<div
class=
"controls"
>
<form:bsradiobuttons
path=
"status"
items=
"
${
allStatus
}
"
/>
<form:bsradiobuttons
path=
"status"
items=
"
${
allStatus
}
"
labelCssClass=
"inline"
/>
</div>
</div>
<div
class=
"form-actions"
>
...
...
examples/showcase/src/main/webapp/WEB-INF/views/account/userList.jsp
浏览文件 @
13a8efec
...
...
@@ -34,7 +34,7 @@
<td>
${user.name}
</td>
<td>
${user.email}
</td>
<td>
${user.roleNames}
</td>
<td>
${
user.status
}
</td>
<td>
${
allStatus[user.status]
}
</td>
<td>
<shiro:hasPermission
name=
"user:edit"
>
<a
href=
"${ctx}/account/user/update/${user.id}"
id=
"editLink-${user.loginName}"
>
修改
</a>
...
...
modules/core/src/main/java/org/springside/modules/web/taglib/BSAbstractMultiCheckedElementTag.java
浏览文件 @
13a8efec
...
...
@@ -12,12 +12,21 @@ import org.springframework.util.ObjectUtils;
import
org.springframework.web.servlet.tags.form.AbstractMultiCheckedElementTag
;
import
org.springframework.web.servlet.tags.form.TagWriter
;
/**
* 重载实现Twitter Bootstrap的格式.
*
* @author calvin
*/
public
abstract
class
BSAbstractMultiCheckedElementTag
extends
AbstractMultiCheckedElementTag
{
private
String
labelCssClass
;
public
void
setLabelCssClass
(
String
labelCssClass
)
{
this
.
labelCssClass
=
labelCssClass
;
}
/**
* Renders the '<code>input type="radio"</code>' element with the configured
* {@link #setItems(Object)} values. Marks the element as checked if the
* value matches the bound value.
* Copy & Paste, 无修正.
*/
@Override
protected
int
writeTagContent
(
TagWriter
tagWriter
)
throws
JspException
{
...
...
@@ -68,6 +77,9 @@ public abstract class BSAbstractMultiCheckedElementTag extends AbstractMultiChec
return
SKIP_BODY
;
}
/**
* Copy & Paste, 无修正.
*/
private
void
writeObjectEntry
(
TagWriter
tagWriter
,
String
valueProperty
,
String
labelProperty
,
Object
item
,
int
itemIndex
)
throws
JspException
{
...
...
@@ -84,6 +96,9 @@ public abstract class BSAbstractMultiCheckedElementTag extends AbstractMultiChec
writeElementTag
(
tagWriter
,
item
,
renderValue
,
renderLabel
,
itemIndex
);
}
/**
* Copy & Paste, 无修正.
*/
private
void
writeMapEntry
(
TagWriter
tagWriter
,
String
valueProperty
,
String
labelProperty
,
Map
.
Entry
entry
,
int
itemIndex
)
throws
JspException
{
...
...
@@ -97,12 +112,22 @@ public abstract class BSAbstractMultiCheckedElementTag extends AbstractMultiChec
writeElementTag
(
tagWriter
,
mapKey
,
renderValue
,
renderLabel
,
itemIndex
);
}
/**
* 重载方法,调整元素的输出顺序。
*/
private
void
writeElementTag
(
TagWriter
tagWriter
,
Object
item
,
Object
value
,
Object
label
,
int
itemIndex
)
throws
JspException
{
String
id
=
resolveId
();
String
resolvedLabelClass
=
getInputType
();
if
(
labelCssClass
!=
null
)
{
resolvedLabelClass
+=
" "
+
labelCssClass
;
}
tagWriter
.
startTag
(
"label"
);
tagWriter
.
writeAttribute
(
"for"
,
id
);
tagWriter
.
writeAttribute
(
"class"
,
getInputType
());
tagWriter
.
writeAttribute
(
"class"
,
resolvedLabelClass
);
if
(
itemIndex
>
0
)
{
Object
resolvedDelimiter
=
evaluate
(
"delimiter"
,
getDelimiter
());
...
...
modules/core/src/main/resources/META-INF/springside-form.tld
浏览文件 @
13a8efec
...
...
@@ -2413,6 +2413,12 @@
<name>
bsradiobuttons
</name>
<tag-class>
org.springside.modules.web.taglib.BSRadioButtonsTag
</tag-class>
<body-content>
empty
</body-content>
<attribute>
<description>
Equivalent to "class" for label emelement. - HTML Optional Attribute
</description>
<name>
labelCssClass
</name>
<required>
false
</required>
<rtexprvalue>
true
</rtexprvalue>
</attribute>
<attribute>
<description>
Path to property for data binding
</description>
<name>
path
</name>
...
...
@@ -2601,6 +2607,12 @@
<name>
bscheckboxes
</name>
<tag-class>
org.springside.modules.web.taglib.BSCheckboxesTag
</tag-class>
<body-content>
empty
</body-content>
<attribute>
<description>
Equivalent to "class" for label emelement. - HTML Optional Attribute
</description>
<name>
labelCssClass
</name>
<required>
false
</required>
<rtexprvalue>
true
</rtexprvalue>
</attribute>
<attribute>
<description>
Path to property for data binding
</description>
<name>
path
</name>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录