當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。