本文整理汇总了Java中org.apache.wicket.model.Model.of方法的典型用法代码示例。如果您正苦于以下问题:Java Model.of方法的具体用法?Java Model.of怎么用?Java Model.of使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.wicket.model.Model
的用法示例。
在下文中一共展示了Model.of方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AllFacetValuesPage
import org.apache.wicket.model.Model; //导入方法依赖的package包/类
public AllFacetValuesPage(PageParameters params) {
super(params);
this.selectionModel = Model.of(parametersConverter.fromParameters(params));
final StringValue facetValue = params.get(SELECTED_FACET_PARAM);
if (facetValue.isEmpty()) {
Session.get().error("No facet provided for all values page");
throw new RestartResponseException(new FacetedSearchPage(selectionModel));
}
final String facet = facetParamMapper.getFacet(facetValue.toString());
if (vloConfig.getFacetsInSearch().contains(facet)) {
// create a new model so that all values will be retrieved
setModel(new FacetFieldModel(facet, facetFieldsService, selectionModel)); // gets all facet values
}
if (getModelObject() == null) {
Session.get().error(String.format("Facet '%s' could not be found", facet));
ErrorPage.triggerErrorPage(ErrorPage.ErrorType.PAGE_NOT_FOUND, params);
}
addComponents();
}
示例2: 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);
}
示例3: SelectEntryPanel
import org.apache.wicket.model.Model; //导入方法依赖的package包/类
/**
* Constructor for a checkbox inside of a form. The checkbox informs the
* given {@link AbstractDataProvider} about ajax state changes.
*
* @param id
* @param entryId
* @param dataProvider
*/
public SelectEntryPanel(final String id, final int entryId, final AbstractDataProvider dataProvider) {
super(id);
final Form<Void> form = new Form<Void>("form");
final CheckBox checkBox = new CheckBox("checkBoxID", Model.of(dataProvider.isEntrySelected(entryId)));
checkBox.add(new AjaxFormComponentUpdatingBehavior("onchange") {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(final AjaxRequestTarget target) {
if (dataProvider.isEntrySelected(entryId)) {
dataProvider.deselectEntry(entryId);
} else if (!dataProvider.isEntrySelected(entryId)) {
dataProvider.selectEntry(entryId);
}
}
});
form.add(checkBox);
this.add(form);
}
示例4: ProbabilityEntryPanel
import org.apache.wicket.model.Model; //导入方法依赖的package包/类
public ProbabilityEntryPanel(final String id, final int entryId, final SimulationTreeTableProvider<Object> simulationTreeTableProvider) {
super(id);
final Form<Void> form = new Form<Void>("form");
this.textField = new TextField<String>("textFieldID", Model.of(simulationTreeTableProvider.getProbabilityForEntry(entryId)));
this.textField.setOutputMarkupPlaceholderTag(true);
this.textField.setOutputMarkupId(true);
this.textField.add(new AjaxFormComponentUpdatingBehavior("onchange") {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(final AjaxRequestTarget target) {
simulationTreeTableProvider.setProbabilityForEntry(ProbabilityEntryPanel.this.textField.getValue(), entryId);
}
});
form.add(this.textField);
this.add(form);
}
示例5: createHistoryLink
import org.apache.wicket.model.Model; //导入方法依赖的package包/类
public static ExternalLink createHistoryLink(NaefDto dto) {
try {
CoreConfiguration config = CoreConfiguration.getInstance();
String url = config.getInventoryHistoryUrl() + (dto != null ? DtoUtil.getMvoId(dto).toString() : "");
ExternalLink link = new ExternalLink("history", Model.of(url), Model.of("History"));
link.setEnabled(dto != null);
link.setVisible(dto != null);
return link;
} catch (Exception e) {
throw ExceptionUtils.throwAsRuntime(e);
}
}
示例6: onInitialize
import org.apache.wicket.model.Model; //导入方法依赖的package包/类
@Override
protected void onInitialize() {
super.onInitialize();
DateTextFieldConfig config = new DateTextFieldConfig();
config.autoClose(true);
config.clearButton(true);
config.withFormat(DateEditSupport.DATE_INPUT_FORMAT);
input = new DateTextField("input", Model.of(getModelObject()), config);
input.setType(getPropertyDescriptor().getPropertyClass());
Method propertyGetter = getPropertyDescriptor().getPropertyGetter();
if (propertyGetter.getAnnotation(OmitName.class) != null)
input.add(AttributeModifier.replace("placeholder", EditableUtils.getName(propertyGetter)));
add(input);
add(new AttributeAppender("class", new LoadableDetachableModel<String>() {
@Override
protected String load() {
if (hasErrors(true))
return " has-error";
else
return "";
}
}));
}
示例7: ProjectSettingTab
import org.apache.wicket.model.Model; //导入方法依赖的package包/类
public ProjectSettingTab(String title, String iconClass,
Class<? extends ProjectSettingPage> mainPageClass,
Class<? extends ProjectSettingPage> additionalPageClass1,
Class<? extends ProjectSettingPage> additionalPageClass2,
Class<? extends ProjectSettingPage> additionalPageClass3) {
super(Model.of(title), mainPageClass, additionalPageClass1, additionalPageClass2, additionalPageClass3);
this.iconClass = iconClass;
}
示例8: UserTab
import org.apache.wicket.model.Model; //导入方法依赖的package包/类
public UserTab(String title, String iconClass, Class<? extends UserPage> mainPageClass,
Class<? extends UserPage> additionalPageClass1,
Class<? extends UserPage> additionalPageClass2) {
super(Model.of(title), mainPageClass, additionalPageClass1, additionalPageClass2);
this.iconClass = iconClass;
}
示例9: testIteratorNameOrderDescending
import org.apache.wicket.model.Model; //导入方法依赖的package包/类
/**
* Test of iterator method, of class FacetFieldValuesProvider.
*/
@Test
public void testIteratorNameOrderDescending() {
final FacetFieldValuesProvider instance = new FacetFieldValuesProvider(Model.of(facetField), 10, LOW_PRIORITY_VALUES, new SortParam<FieldValuesOrder>(FieldValuesOrder.NAME, false), valueConverterProvider);
final long first = 0;
final long count = 100;
final Iterator<? extends FacetField.Count> result = instance.iterator(first, count);
//sorted by name (descending)
assertTrue(result.hasNext());
FacetField.Count valueCount = result.next();
assertEquals("Xlow priority", valueCount.getName()); // priority only affects sort by count
assertTrue(result.hasNext());
valueCount = result.next();
assertEquals("third value", valueCount.getName());
assertTrue(result.hasNext());
valueCount = result.next();
assertEquals("second value*", valueCount.getName());
assertTrue(result.hasNext());
valueCount = result.next();
assertEquals("FOURTH value", valueCount.getName()); // case insensitive sorting
assertTrue(result.hasNext());
valueCount = result.next();
assertEquals("first value", valueCount.getName());
assertFalse(result.hasNext());
}
示例10: SimpleSearchPage
import org.apache.wicket.model.Model; //导入方法依赖的package包/类
public SimpleSearchPage(PageParameters parameters) {
super(parameters, Model.of(true));
//see if another page would be more suitable
final Set<String> keys = parameters.getNamedKeys();
if (keys.contains(DOCUMENT_ID)) {
//document id -> redirect to record page
setResponsePage(new RecordPage(parameters));
} else if (keys.contains(QUERY) || keys.contains(FILTER_QUERY)) {
//query or selection parameters -> redirect to non-simple page
setResponsePage(new FacetedSearchPage(parameters));
}
}
示例11: createMainPanel
import org.apache.wicket.model.Model; //导入方法依赖的package包/类
@Override
protected AbstractObjectMainPanel<ServiceType> createMainPanel(String id) {
return new AbstractRoleMainPanel<ServiceType>(id, getObjectModel(), getAssignmentsModel(), getPolicyRulesModel(),
getProjectionModel(), getInducementsModel(), this) {
private static final long serialVersionUID = 1L;
@Override
public AbstractRoleMemberPanel<ServiceType> createMemberPanel(String panelId) {
return new ServiceMemberPanel(panelId, Model.of(getObject().asObjectable()), PageService.this);
}
};
}
示例12: model
import org.apache.wicket.model.Model; //导入方法依赖的package包/类
@Override
public IModel<ProjectFolderTreeNode> model(ProjectFolderTreeNode object) {
return Model.of(object);
}
示例13: TooltipBehavior
import org.apache.wicket.model.Model; //导入方法依赖的package包/类
public TooltipBehavior(final TooltipConfig config) {
this(Model.of(""), config);
}
示例14: newActivityRow
import org.apache.wicket.model.Model; //导入方法依赖的package包/类
private Component newActivityRow(String id, PullRequestActivity activity) {
WebMarkupContainer row = new WebMarkupContainer(id, Model.of(activity)) {
@Override
public void onEvent(IEvent<?> event) {
super.onEvent(event);
if (event.getPayload() instanceof RequestCommentDeleted) {
RequestCommentDeleted commentRemoved = (RequestCommentDeleted) event.getPayload();
remove();
commentRemoved.getHandler().appendJavaScript(String.format("$('#%s').remove();", getMarkupId()));
}
}
};
row.setOutputMarkupId(true);
String anchor = activity.getAnchor();
if (anchor != null)
row.setMarkupId(anchor);
if (row.get("content") == null)
row.add(activity.render("content"));
WebMarkupContainer avatarColumn = new WebMarkupContainer("avatar");
row.add(avatarColumn);
if (activity instanceof OpenedActivity) {
row.add(AttributeAppender.append("class", " discussion"));
PullRequest request = ((OpenedActivity)activity).getRequest();
avatarColumn.add(new AvatarLink("avatar",
User.getForDisplay(request.getSubmitter(), request.getSubmitterName())));
} else if (activity instanceof CommentedActivity) {
row.add(AttributeAppender.append("class", " discussion"));
PullRequestComment comment = ((CommentedActivity)activity).getComment();
avatarColumn.add(new AvatarLink("avatar", User.getForDisplay(comment.getUser(), comment.getUserName())));
} else {
row.add(AttributeAppender.append("class", " non-discussion"));
avatarColumn.add(new WebMarkupContainer("avatar"));
}
if (activity instanceof UpdatedActivity)
row.add(AttributeAppender.append("class", " update"));
else
row.add(AttributeAppender.append("class", " non-update"));
return row;
}
示例15: RsvpLspCreationPage
import org.apache.wicket.model.Model; //导入方法依赖的package包/类
public RsvpLspCreationPage(WebPage backPage, RsvpLspIdPoolDto pool) {
try {
this.editorName = AAAWebUtil.checkAAA(this, OPERATION_NAME);
if (pool == null) {
throw new IllegalArgumentException("pool is null.");
}
this.pool = pool;
this.backPage = backPage;
Form<Void> backForm = new Form<Void>("backForm");
add(backForm);
Button backButton = new Button("back") {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit() {
setResponsePage(getBackPage());
}
};
backForm.add(backButton);
add(new FeedbackPanel("feedback"));
Label nodeLabel = new Label("poolName", Model.of(pool.getName()));
add(nodeLabel);
Form<Void> form = new Form<Void>("form");
add(form);
Button proceedButton = new Button("proceed") {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit() {
processCreate();
RsvpLspDto published = RsvpLspUtil.getRsvpLsp(getPool(), getLspName());
setResponsePage(new RsvpLspEditPage(getBackPage(), published, getIngress()));
}
};
form.add(proceedButton);
TextField<Integer> idField = new TextField<Integer>("lspName", new PropertyModel<Integer>(this, "name"));
idField.setRequired(true);
form.add(idField);
MplsNmsInventoryConnector conn = MplsNmsInventoryConnector.getInstance();
DropDownChoice<NodeDto> ingressList = new DropDownChoice<NodeDto>(
"ingressNodes",
new PropertyModel<NodeDto>(this, "ingress"),
conn.getActiveNodes(),
new ChoiceRenderer<NodeDto>("name"));
ingressList.setRequired(true);
form.add(ingressList);
} catch (Exception e) {
throw ExceptionUtils.throwAsRuntime(e);
}
}