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