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


Java Model类代码示例

本文整理汇总了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);
}
 
开发者ID:jorcox,项目名称:GeoCrawler,代码行数:17,代码来源:SeedPage.java

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

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

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

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

示例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)));
		}

	});
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:27,代码来源:ReflectionBeanViewer.java

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

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

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

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

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

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

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

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

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


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