本文整理匯總了Java中org.apache.wicket.model.Model類的典型用法代碼示例。如果您正苦於以下問題:Java Model類的具體用法?Java Model怎麽用?Java Model使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Model類屬於org.apache.wicket.model包,在下文中一共展示了Model類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addUrlForm
import org.apache.wicket.model.Model; //導入依賴的package包/類
private void addUrlForm() {
urlForm = new Form<SeedUrl>("urlForm", CompoundPropertyModel.of(Model
.of(new SeedUrl())));
urlForm.setOutputMarkupId(true);
urlForm.add(new TextField<String>("url"));
urlForm.add(new AjaxSubmitLink("addUrl", urlForm) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
addSeedUrl();
urlForm.setModelObject(new SeedUrl());
target.add(urlForm);
target.add(seedUrlsTable);
}
});
add(urlForm);
}
示例2: onInitialize
import org.apache.wicket.model.Model; //導入依賴的package包/類
@Override
protected void onInitialize() {
super.onInitialize();
input = new TextField<Number>("input", Model.of(getModelObject()));
input.setType(getPropertyDescriptor().getPropertyClass());
add(input);
add(new AttributeAppender("class", new LoadableDetachableModel<String>() {
@Override
protected String load() {
if (hasErrors(true))
return " has-error";
else
return "";
}
}));
}
示例3: onInitialize
import org.apache.wicket.model.Model; //導入依賴的package包/類
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected void onInitialize() {
super.onInitialize();
List<UserFacade> users = new ArrayList<>();
if (getModelObject() != null) {
UserManager userManager = GitPlex.getInstance(UserManager.class);
for (String userName: getModelObject()) {
User user = userManager.findByName(userName);
if (user != null)
users.add(user.getFacade());
}
}
input = new UserMultiChoice("input", new Model((Serializable)users), new UserChoiceProvider(type));
input.setConvertEmptyInputStringToNull(true);
add(input);
}
示例4: onInitialize
import org.apache.wicket.model.Model; //導入依賴的package包/類
@Override
protected void onInitialize() {
super.onInitialize();
User user;
if (getModelObject() != null)
user = GitPlex.getInstance(UserManager.class).findByName(getModelObject());
else
user = null;
UserFacade facade = user!=null?user.getFacade():null;
input = new UserSingleChoice("input", Model.of(facade), new UserChoiceProvider(type));
input.setConvertEmptyInputStringToNull(true);
// add this to control allowClear flag of select2
input.setRequired(propertyDescriptor.isPropertyRequired());
add(input);
}
示例5: onInitialize
import org.apache.wicket.model.Model; //導入依賴的package包/類
@Override
protected void onInitialize() {
super.onInitialize();
add(input = new CheckBox("input", Model.of(getModelObject())));
add(new AttributeAppender("class", new LoadableDetachableModel<String>() {
@Override
protected String load() {
if (hasErrors(true))
return " has-error";
else
return "";
}
}));
}
示例6: onInitialize
import org.apache.wicket.model.Model; //導入依賴的package包/類
@Override
protected void onInitialize() {
super.onInitialize();
add(new ListView<PropertyContext<Serializable>>("properties", propertyContexts) {
@Override
protected void populateItem(ListItem<PropertyContext<Serializable>> item) {
PropertyContext<Serializable> propertyContext = item.getModelObject();
Method propertyGetter = propertyContext.getPropertyGetter();
Label nameLabel = new Label("name", EditableUtils.getName(propertyGetter));
item.add(nameLabel);
OmitName omitName = propertyGetter.getAnnotation(OmitName.class);
if (omitName != null && omitName.value() != OmitName.Place.EDITOR) {
nameLabel.setVisible(false);
item.add(AttributeAppender.append("class", "name-omitted"));
}
Serializable bean = (Serializable) ReflectionBeanViewer.this.getDefaultModelObject();
Serializable propertyValue = (Serializable) propertyContext.getPropertyValue(bean);
item.add(propertyContext.renderForView("value", Model.of(propertyValue)));
}
});
}
示例7: onInitialize
import org.apache.wicket.model.Model; //導入依賴的package包/類
@Override
protected void onInitialize() {
super.onInitialize();
input = new PasswordTextField("input", Model.of(getModelObject()));
input.setRequired(false);
input.setResetPassword(false);
add(input);
String autocomplete = EditableUtils.getAutocomplete(getPropertyDescriptor().getPropertyGetter());
if (autocomplete != null)
input.add(AttributeAppender.append("autocomplete", autocomplete));
add(new AttributeAppender("class", new LoadableDetachableModel<String>() {
@Override
protected String load() {
if (hasErrors(true))
return " has-error";
else
return "";
}
}));
}
示例8: onInitialize
import org.apache.wicket.model.Model; //導入依賴的package包/類
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected void onInitialize() {
super.onInitialize();
BranchChoiceProvider branchProvider = new BranchChoiceProvider(new LoadableDetachableModel<Project>() {
@Override
protected Project load() {
ProjectPage page = (ProjectPage) getPage();
return page.getProject();
}
});
ArrayList<String> projectAndBranches = new ArrayList<>();
if (getModelObject() != null)
projectAndBranches.addAll(getModelObject());
input = new BranchMultiChoice("input", new Model(projectAndBranches), branchProvider);
add(input);
}
示例9: onInitialize
import org.apache.wicket.model.Model; //導入依賴的package包/類
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected void onInitialize() {
super.onInitialize();
List<String> verifications = new ArrayList<>();
if (getModelObject() != null) {
verifications.addAll(getModelObject());
}
input = new VerificationMultiChoice("input", new Model((Serializable) verifications),
new VerificationChoiceProvider());
input.setConvertEmptyInputStringToNull(true);
add(input);
}
示例10: onInitialize
import org.apache.wicket.model.Model; //導入依賴的package包/類
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected void onInitialize() {
super.onInitialize();
List<GroupFacade> groups = new ArrayList<>();
if (getModelObject() != null) {
GroupManager groupManager = GitPlex.getInstance(GroupManager.class);
for (String groupName: getModelObject()) {
Group group = groupManager.find(groupName);
if (group != null)
groups.add(group.getFacade());
}
}
input = new GroupMultiChoice("input", new Model((Serializable)groups), new GroupChoiceProvider());
input.setConvertEmptyInputStringToNull(true);
add(input);
}
示例11: onInitialize
import org.apache.wicket.model.Model; //導入依賴的package包/類
@Override
protected void onInitialize() {
super.onInitialize();
Group group;
if (getModelObject() != null)
group = GitPlex.getInstance(GroupManager.class).find(getModelObject());
else
group = null;
GroupFacade facade = group!=null?group.getFacade():null;
input = new GroupSingleChoice("input", Model.of(facade), new GroupChoiceProvider());
input.setConvertEmptyInputStringToNull(true);
// add this to control allowClear flag of select2
input.setRequired(propertyDescriptor.isPropertyRequired());
add(input);
}
示例12: getBody
import org.apache.wicket.model.Model; //導入依賴的package包/類
@Override
public IModel<?> getBody() {
String iconClass;
ProjectAndRevision repoAndRevision = new ProjectAndRevision(projectModel.getObject(), revision);
String label = repoAndRevision.getBranch();
if (label != null) {
iconClass = "fa fa-code-fork";
} else {
label = repoAndRevision.getTag();
if (label != null) {
iconClass = "fa fa-tag";
} else {
label = revision;
if (GitUtils.isHash(label))
label = GitUtils.abbreviateSHA(label);
iconClass = "fa fa-ext fa-commit";
}
}
return Model.of(String.format("<i class='%s'></i> <span>%s</span> <i class='fa fa-caret-down'></i>", iconClass, label));
}
示例13: newAdditionalActions
import org.apache.wicket.model.Model; //導入依賴的package包/類
@Override
public WebMarkupContainer newAdditionalActions(String id) {
WebMarkupContainer actions = new Fragment(id, "actionsFrag", this);
if (!symbols.isEmpty()) {
actions.add(new CheckBox("outline", Model.of(isOutlineVisibleInitially())).add(new OnChangeAjaxBehavior() {
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);
attributes.setMethod(Method.POST);
}
@Override
protected void onUpdate(AjaxRequestTarget target) {
toggleOutline(target);
}
}));
} else {
actions.add(new WebMarkupContainer("outline").setVisible(false));
}
return actions;
}
示例14: getBreadcrumbs
import org.apache.wicket.model.Model; //導入依賴的package包/類
@Override
protected List<ComponentRenderer> getBreadcrumbs() {
List<ComponentRenderer> breadcrumbs = super.getBreadcrumbs();
breadcrumbs.add(new ComponentRenderer() {
@Override
public Component render(String componentId) {
return new ViewStateAwarePageLink<Void>(componentId, ProjectListPage.class) {
@Override
public IModel<?> getBody() {
return Model.of("Projects");
}
};
}
});
return breadcrumbs;
}
示例15: getBreadcrumbs
import org.apache.wicket.model.Model; //導入依賴的package包/類
@Override
protected List<ComponentRenderer> getBreadcrumbs() {
List<ComponentRenderer> breadcrumbs = super.getBreadcrumbs();
breadcrumbs.add(new ComponentRenderer() {
@Override
public Component render(String componentId) {
return new ViewStateAwarePageLink<Void>(componentId, SystemSettingPage.class) {
@Override
public IModel<?> getBody() {
return Model.of("Administration");
}
};
}
});
return breadcrumbs;
}