当前位置: 首页>>代码示例>>Java>>正文


Java Model.of方法代码示例

本文整理汇总了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();
}
 
开发者ID:acdh-oeaw,项目名称:vlo-curation,代码行数:24,代码来源:AllFacetValuesPage.java

示例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);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:20,代码来源:UserSingleChoiceEditor.java

示例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);
}
 
开发者ID:bptlab,项目名称:Unicorn,代码行数:32,代码来源:SelectEntryPanel.java

示例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);
}
 
开发者ID:bptlab,项目名称:Unicorn,代码行数:23,代码来源:ProbabilityEntryPanel.java

示例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);
    }
}
 
开发者ID:openNaEF,项目名称:openNaEF,代码行数:13,代码来源:HistoryUtil.java

示例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 "";
		}
		
	}));
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:29,代码来源:DatePropertyEditor.java

示例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;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:9,代码来源:ProjectSettingTab.java

示例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;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:8,代码来源:UserTab.java

示例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());
}
 
开发者ID:acdh-oeaw,项目名称:vlo-curation,代码行数:35,代码来源:FacetFieldValuesProviderTest.java

示例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));
    }
}
 
开发者ID:acdh-oeaw,项目名称:vlo-curation,代码行数:14,代码来源:SimpleSearchPage.java

示例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);
		}
	};
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:13,代码来源:PageService.java

示例12: model

import org.apache.wicket.model.Model; //导入方法依赖的package包/类
@Override
public IModel<ProjectFolderTreeNode> model(ProjectFolderTreeNode object) {
    return Model.of(object);
}
 
开发者ID:intuit,项目名称:karate,代码行数:5,代码来源:ProjectFolderTreeProvider.java

示例13: TooltipBehavior

import org.apache.wicket.model.Model; //导入方法依赖的package包/类
public TooltipBehavior(final TooltipConfig config) {
	this(Model.of(""), config);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:4,代码来源:TooltipBehavior.java

示例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;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:48,代码来源:RequestOverviewPage.java

示例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);
    }
}
 
开发者ID:openNaEF,项目名称:openNaEF,代码行数:58,代码来源:RsvpLspCreationPage.java


注:本文中的org.apache.wicket.model.Model.of方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。