- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 DropDownChoice:
DropDownChoice dateSpanChoice = new DropDownChoice("dateSpan", new PropertyModel(getModel(), "dateSpan"), dateSpans, new IChoiceRenderer() {
private static final long serialVersionUID = 10105L;
@Override
public String getIdValue(Object object, int index) {
return ((DateSpan) object).getId() + "";
}
@Override
public Object getDisplayValue(Object object) {
DateTime today = new DateTime();
DateTime currentDate = new DateTime(today.getYear(), today.getMonthOfYear(), today.getDayOfMonth(), 0, 0, 0, 0);
DateSpan dateSpan = (DateSpan) object;
DateTime fromDate = dateSpan.getFromDate();
DateTime toDate = dateSpan.getToDate();
boolean currentDateIsEqualOrAfterFromDate = currentDate.isEqual(fromDate) | currentDate.isAfter(fromDate);
boolean currentDateIsEqualOrBeforeToDate = currentDate.isEqual(toDate) | currentDate.isBefore(toDate);
boolean currentDateBelongsToCurrentRange = currentDateIsEqualOrAfterFromDate & currentDateIsEqualOrBeforeToDate;
if (currentDateBelongsToCurrentRange) {
return ((DateSpan) object).getDisplayValue() + " *";
} else {
return ((DateSpan) object).getDisplayValue();
}
}
}) {
private static final long serialVersionUID = 10106L;
protected CharSequence getDefaultChoice(final Object selected) {
CharSequence charSequence = super.getDefaultChoice(selected);
System.out.println("=============================================================");
//System.out.println(charSequence);
//THIS CHARSEQUENCE IS RENRING EMPTY STRING
if(StringUtils.isBlank(charSequence.toString())) {
System.out.println("CHARSEQUENCE IS BLANK");
} else {
System.out.println("CHARSEQUENCE IS NOT BLANK");
}
return charSequence;
}
};
dateSpanChoice.setNullValid(false);
我正在尝试将 style="background-color: red"添加到所选选项。所以我重写了 getDefaultChoice() 但正如你所看到的,它在代码中被注释,CharSequence 是空的。
有没有办法为 DropDownChoice 的特定选项设置属性?
感谢和问候。
注意:日期时间是 Joda 时间
最佳答案
为了更复杂地使用元素,您需要 Select/SelectOption 而不是 DropDownChoice。
关于java - 将属性设置为 DropDownChoice 的选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5947078/
Wicket 中有什么东西可以做两个 下拉选项,以便第一个 doprdownchoice 的第一个选择更改第二个的所有选项吗? 最佳答案 您应该使用第一个选择的值来确定第二个的值。 在这个例子中,我选
我在使用 DropDownChoice 时遇到问题。我必须预先选择一个项目,但我找到的每个教程和示例都只考虑原始类型列表。 我有一个对象列表。 class myObject { private
您好,我创建了 web 应用程序,并且有 DropDownChoice (默认值“A”),但是当我从 DropDownChoice 中选择了某些项目(“B”),然后我执行了一些操作(例如提交),然后在
我有带字段的表单: public VyjimkyForm(final Parametry parametry) { super("vyjimkyForm", new Compo
我有一个 DropDownChoice : DropDownChoice timePeriod = new DropDownChoice("timePeriod", Arrays.asL
在我的项目中,我有 50 多个表单,它们大多彼此相似并使用相同的 DropDownChoice成分。我可以创建单独的 Panel ,在这里我定义了我的 DropDownChoice ,然后我将使用该
所以我在 Wicket 中有我的 DropDownChoice: final DropDownChoice drop_down_status = new DropDownChoice("status"
我在 DropDownChoice (wicket 1.6) 中显示选项时遇到问题。 DropDownChoice choice = new DropDownChoice("enabled", Arr
我的 web 应用程序上的一个 DropDownChoice 列表需要很长时间才能创建,因为通过 LDAP 连接和 SQL 连接的某些操作获取选项。因此,整个页面的加载时间远远超过了几秒钟 - 我想说
我试图在 wicket 框架中获取 dropdownchoice 的选定值,但我无法获取它。如何在 dropdownchoice 的更改事件上获取 DropDownChoice 的选定值???谢谢。我
我有一个 DropDownChoice: DropDownChoice dateSpanChoice = new DropDownChoice("dateSpan", new Prop
我正在使用 Wicket 口向导让用户执行多个步骤进行注册。 但不知怎的,我得到了这个错误: Last cause: Attempt to set model object on null model
我试图在 DropDownChoice 上获取我所选选项的 ID,但出现错误。我知道,当我选择一个值时,我只是更新模型而不是对象(反射)。我希望通过 getModelObject() 获取对象“Use
我正在使用 Wicket 口 DropDownChoice我的列表很长,有没有一种方法可以让当我单击下拉列表然后单击一个字符时,列表将跳转到以相同字符开头的第一个选择 最佳答案 我知道这不是您问题的确
我有 3 个 DropDownChoice COuntry>State>Cities 及其更新可以使用 Ajax onchage 方法使用 ajax 行为。 如果我想通过 JAVA 而不是 AJAX
是否有一些明显的方法可以将分隔符添加到 Wicket DropDownChoice 中的选项列表?在我的例子中,我使用来 self 的数据源的两种类型的域对象来填充选择。我想我可以手动将某种虚拟域对象
我正在尝试访问用户在 apache wicket 的 DropDownChoices 中选择的值。我将 AjaxFormComponentUpdatingBehavior 添加到 DropDownCh
我需要在选择后立即更新模型或对象DropDownChoice 项。 贝娄是我正在工作的代码: add(new ListView[Company]("listCompanies", listData)
我需要创建一个 wicket dropdownchoice 组件,我可以通过设置将默认的“选择一个”文本替换为“全部” nullValid=All null=All 在其属性文件中。我也想将“All”
有没有办法让 Wicket 中的 DropDownChoice 将工具提示(例如标题属性)分配给各个选项元素? 我有以下形式的选择框项目: public class SelectBoxItem {
我是一名优秀的程序员,十分优秀!