是否可以指定在div上放置垂直滚动条的位置(左侧或右侧)?
例如,请查看此页面,其中说明了如何使用overflow属性.有没有办法将滚动条放在可滚动区域的左侧?
我有一个wicket表单,其中包含许多TextField输入组件.大多数输入都附有Validator.
假设我输入了50个值,其中一个值未通过范围验证器.Wicket然后生成错误反馈消息,但也不更新与每个组件关联的模型.结果是我丢失了刚刚输入的所有50个值,并且必须再次键入它们.
我的问题是,我可以告诉Wicket更新那些具有有效值的组件的模型,但只报告错误值的错误吗?
在框架中挖掘,我注意到FormComponent中的这个代码片段,它似乎表明如果有错误,则不要更新模型.
public final void processInput()
{
inputChanged();
validate();
if (hasErrorMessage())
{
invalid();
}
else
{
valid();
updateModel();
}
}
Run Code Online (Sandbox Code Playgroud)
有没有办法自定义此行为,并实现保留所有有效值的目的?
我有一个包含整数值的Wicket Textfield
currentValueTextField = new TextField<IntParameter>("valueText", new PropertyModel<IntParameter>(model, "value"));
Run Code Online (Sandbox Code Playgroud)
我正在附加一个自定义验证器,如下所示
currentValueTextField.add(new IntegerValidator());
Run Code Online (Sandbox Code Playgroud)
验证器类是
class IntegerValidator extends AbstractValidator<IntParameter> {
private static final long serialVersionUID = 5899174401360212883L;
public IntegerValidator() {
}
@Override
public void onValidate(IValidatable<IntParameter> validatable) {
ValidationError error = new ValidationError();
if (model.getValue() == null) {
AttributeAppender redOutline = new AttributeAppender("style", new Model<String>("border-style:solid; border-color:#f86b5c; border-width: 3px"), ";");
currentValueTextField.add(redOutline);
currentValueTextField.getParent().getParent().add(redOutline);
validatable.error(error);
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是,如果我在文本字段中没有输入任何内容,onValidate()则不会调用我的方法.
在这种情况下,检查空值的推荐方法是什么?我还想对输入的值进行范围检查.
嗨,我有一个Autowired UsrDetailsService的问题,我发现很多其他人有同样的问题,但没有其他解决方案适合我(我不知道为什么)我使用java配置(没有xml)
Error code
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'securityConfig':
Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException:
Could not autowire field: private com.mycompany.delivery.service.AccountServiceImpl com.mycompany.delivery.config.SecurityConfig.accUserDetailsService;
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type [com.mycompany.delivery.service.AccountServiceImpl] found for dependency:
expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations:
{@org.springframework.beans.factory.annotation.Autowired(required=true), @org.springframework.beans.factory.annotation.Qualifier(value=accUserDetailsService)}
Run Code Online (Sandbox Code Playgroud)
当我将这个类自动连接到Controller时,或者其它任何地方都可以正常工作,其他一切都是自动装配好的,只有WebSecurityConfigurerAdapter我不能.
我的安全配置:
Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
@Qualifier("accUserDetailsService")
private AccountServiceImpl accUserDetailsService;
public AccountServiceImpl getAccUserDetailsService() {
return accUserDetailsService;
}
public …Run Code Online (Sandbox Code Playgroud) 假设我创建了一个DropDownChoice包含许多项目的Wicket .
是否可以显示所有项目,但有选择地禁用其中一项或多项?
您对项目外观的唯一控制是由提供的IChoiceRenderer,但这只允许您修改为每个项目显示的文本.
基本问题描述:我正在尝试构建一个ListView(表),它动态添加行。表中的每一行都包含一个DropDownChoice,并附有“onchange”Ajax 行为。
我所看到的:DropDownChoice表中的第一个行为正确。添加到表中的任何其他内容都不会触发onUpdate我的 Java 代码中的方法。
我检查了 HTML,发生这种情况是因为只有DropDownChoice表中的第一个onchange附加了处理程序。
这是我的表创建方法:-
private WebMarkupContainer createCommandTable() {
commandTable = new WebMarkupContainer("commandTable");
commandView = new ListView<CommandModel>("commandRow", new PropertyModel<List<CommandModel>>(this, "commandListModels")) {
private static final long serialVersionUID = 6376139649874160166L;
@Override
protected void populateItem(ListItem<CommandModel> item) {
final CommandModel model = item.getModelObject();
item.add(createCommandDropdown(model));
item.add(createParameterTable(model));
item.add(createDeleteLink(model));
}
};
commandTable.add(commandView);
commandTable.setOutputMarkupId(true);
return commandTable;
}
Run Code Online (Sandbox Code Playgroud)
这是我的DropDownChoice创作方法:-
private DropDownChoice<Root.Command> createCommandDropdown(CommandModel model) {
IChoiceRenderer<Command> renderer = new ChoiceRenderer<Command>("name");
DropDownChoice<Root.Command> commandDropdown = …Run Code Online (Sandbox Code Playgroud) 我想动态更改为HTML锚标记显示的文本.所以,例如,如果我的标记中有以下内容 -
<a class="point" style="font-family:courier" wicket:id="link">[+]</a>
Run Code Online (Sandbox Code Playgroud)
我想将'[+]'更改为其他内容.目前代码片段如下所示:
equipmentFamilyName.add(new Link<String>("link") {
@Override
protected void onComponentTag(ComponentTag tag) {
String id = "link" + equipmentFamilyName.getModelObject();
tag.put("onclick", "toggle('" + collapsibleId + "','" + id + "')");
tag.put("id", id);
}
@Override
public void onClick() {
}
});
Run Code Online (Sandbox Code Playgroud)
这只是添加各种属性.我尝试使用与Link对象关联的模型
IModel<String> linkModel = new Model<String>("-");
equipmentFamilyName.add(new Link<String>("link", linkModel) {
...
Run Code Online (Sandbox Code Playgroud)
但这对显示的文本没有影响,即我仍然在我的网页上显示"[+]".任何建议或代码示例澄清如何做到这一点将不胜感激.
编辑:在注释中的指针之后,我添加了一个覆盖onComponentTagBody()的方法.我现在为我们当前版本的Wicket(1.4.17)提供了解决方案.
@Override
protected void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) {
replaceComponentTagBody(markupStream, openTag, "[-]");
}
Run Code Online (Sandbox Code Playgroud) 问题涉及Wicket 1.6
我有一个向导步骤,其中包括一个Textfield组件.当我按下Enter键时,这将由向导栏的默认按钮("下一步")处理,然后进入向导中的下一步.我不希望这种情况发生.当我在文本字段上按Enter键时,我只想更新值,但保留在同一页面上.
我尝试覆盖onBeforeRender()我的Wizard类的方法,正如您所看到的,将包含表单的默认按钮设置为null.但是现在这会导致在我按Enter键时触发'Prev'按钮,因此向导将返回上一步.
public class ConfigurationWizard extends Wizard {
....
@Override
protected void onBeforeRender()
{
super.onBeforeRender();
Component buttonBar = getForm().get(BUTTONS_ID);
if (buttonBar instanceof IDefaultButtonProvider)
{
getForm().setDefaultButton(null);
}
}
}
Run Code Online (Sandbox Code Playgroud)
所以基本的问题是,如何禁用向导的默认按钮行为?