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


Java IModel类代码示例

本文整理汇总了Java中org.apache.wicket.model.IModel的典型用法代码示例。如果您正苦于以下问题:Java IModel类的具体用法?Java IModel怎么用?Java IModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IModel类属于org.apache.wicket.model包,在下文中一共展示了IModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: QuickSearchPanel

import org.apache.wicket.model.IModel; //导入依赖的package包/类
public QuickSearchPanel(String id, IModel<Project> projectModel, IModel<String> revisionModel) {
	super(id);
	
	this.projectModel = projectModel;
	this.revisionModel = revisionModel;
	
	Project project = projectModel.getObject();
	for (String blobPath: getRecentOpened()) {
		try {
			RevTree revTree = project.getRevCommit(revisionModel.getObject()).getTree();
			TreeWalk treeWalk = TreeWalk.forPath(project.getRepository(), blobPath, revTree);
			if (treeWalk != null && treeWalk.getRawMode(0) != FileMode.TREE.getBits()) {
				symbolHits.add(new FileHit(blobPath, null));
			}
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:20,代码来源:QuickSearchPanel.java

示例2: getBreadcrumbs

import org.apache.wicket.model.IModel; //导入依赖的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

示例3: AdvancedSearchPanel

import org.apache.wicket.model.IModel; //导入依赖的package包/类
public AdvancedSearchPanel(String id, IModel<Project> projectModel, IModel<String> revisionModel) {
	super(id);
	
	this.projectModel = projectModel;
	this.revisionModel = revisionModel;
	
	WebRequest request = (WebRequest) RequestCycle.get().getRequest();
	Cookie cookie = request.getCookie(COOKIE_SEARCH_TYPE);
	if (cookie != null) {
		try {
			option = (SearchOption) Class.forName(cookie.getValue()).newInstance();
		} catch (Exception e) {
			logger.debug("Error restoring search option from cookie", e);
		}
	}
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:17,代码来源:AdvancedSearchPanel.java

示例4: SelectToAddChoice

import org.apache.wicket.model.IModel; //导入依赖的package包/类
public SelectToAddChoice(String id, ChoiceProvider<T> choiceProvider) {
	super(id);
	
	setModel(new IModel<T>() {

		@Override
		public void detach() {
		}

		@Override
		public T getObject() {
			return selection;
		}

		@Override
		public void setObject(T object) {
			selection = object;
		}
		
	});

	setProvider(choiceProvider);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:24,代码来源:SelectToAddChoice.java

示例5: CommitMessageLabel

import org.apache.wicket.model.IModel; //导入依赖的package包/类
public CommitMessageLabel(String id, IModel<Project> projectModel, IModel<String> messageModel) {
	super(id, new LoadableDetachableModel<String>() {

		@Override
		protected String load() {
			String message = HtmlEscape.escapeHtml5(messageModel.getObject());
			for (CommitMessageTransformer transformer: GitPlex.getExtensions(CommitMessageTransformer.class)) {
				message = transformer.transform(projectModel.getObject(), message);
			}
			return message;
		}

		@Override
		protected void onDetach() {
			projectModel.detach();
			messageModel.detach();
			super.onDetach();
		}
		
	});
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:22,代码来源:CommitMessageLabel.java

示例6: getBreadcrumbs

import org.apache.wicket.model.IModel; //导入依赖的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, GroupListPage.class) {

				@Override
				public IModel<?> getBody() {
					return Model.of("Groups");
				}
				
			};
		}
		
	});

	return breadcrumbs;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:23,代码来源:GroupListPage.java

示例7: getBreadcrumbs

import org.apache.wicket.model.IModel; //导入依赖的package包/类
protected List<ComponentRenderer> getBreadcrumbs() {
	List<ComponentRenderer> breadcrumbs = new ArrayList<>();
	
	breadcrumbs.add(new ComponentRenderer() {
		
		@Override
		public Component render(String componentId) {
			return new ViewStateAwarePageLink<Void>(componentId, DashboardPage.class) {

				@Override
				public IModel<?> getBody() {
					return Model.of("Home");
				}
				
			};
		}
	});
	
	return breadcrumbs;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:21,代码来源:LayoutPage.java

示例8: wrapAsSelfUpdating

import org.apache.wicket.model.IModel; //导入依赖的package包/类
public IModel<T> wrapAsSelfUpdating(final IModel<T> model) {
	return new IModel<T>() {

		@Override
		public void detach() {
			model.detach();
		}

		@Override
		public T getObject() {
			return model.getObject();
		}

		@Override
		public void setObject(T object) {
			copyProperties(object, getObject());
		}
		
	};
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:21,代码来源:BeanContext.java

示例9: editBean

import org.apache.wicket.model.IModel; //导入依赖的package包/类
public static BeanEditor<Serializable> editBean(String componentId, final Serializable bean, 
		Set<String> excludeProperties) {
	IModel<Serializable> beanModel = new IModel<Serializable>() {

		@Override
		public void detach() {
		}

		@Override
		public Serializable getObject() {
			return bean;
		}

		@Override
		public void setObject(Serializable object) {
			throw new IllegalStateException();
		}
		
	};
	EditSupportRegistry registry = AppLoader.getInstance(EditSupportRegistry.class);
	Class<?> beanClass = ClassUtils.unproxy(beanModel.getObject().getClass());
	BeanContext<Serializable> editContext = registry.getBeanEditContext(beanClass, excludeProperties);
	beanModel = editContext.wrapAsSelfUpdating(beanModel);
	return editContext.renderForEdit(componentId, beanModel);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:26,代码来源:BeanContext.java

示例10: getBreadcrumbs

import org.apache.wicket.model.IModel; //导入依赖的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

示例11: PolymorphicListPropertyEditor

import org.apache.wicket.model.IModel; //导入依赖的package包/类
public PolymorphicListPropertyEditor(String id, PropertyDescriptor propertyDescriptor, IModel<List<Serializable>> model) {
	super(id, propertyDescriptor, model);
	
	implementations = new ArrayList<>();
	Class<?> baseClass = EditableUtils.getElementClass(propertyDescriptor.getPropertyGetter().getGenericReturnType());
	Preconditions.checkNotNull(baseClass);
	
	ImplementationRegistry registry = AppLoader.getInstance(ImplementationRegistry.class);
	implementations.addAll(registry.getImplementations(baseClass));

	Preconditions.checkArgument(
			!implementations.isEmpty(), 
			"Can not find implementations for '" + baseClass + "'.");
	
	EditableUtils.sortAnnotatedElements(implementations);

	Method propertyGetter = propertyDescriptor.getPropertyGetter();
	if (propertyGetter.getAnnotation(Horizontal.class) != null)
		horizontal = true;
	else if (propertyGetter.getAnnotation(Vertical.class) != null)
		horizontal = false;
	else 
		horizontal = true;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:25,代码来源:PolymorphicListPropertyEditor.java

示例12: getBlobBlameModel

import org.apache.wicket.model.IModel; //导入依赖的package包/类
private @Nullable IModel<Boolean> getBlobBlameModel(BlobChange change) {
	if (blameModel != null) {
		return new IModel<Boolean>() {

			@Override
			public void detach() {
			}

			@Override
			public Boolean getObject() {
				return change.getPath().equals(blameModel.getObject());
			}

			@Override
			public void setObject(Boolean object) {
				if (object)
					blameModel.setObject(change.getPath());
				else
					blameModel.setObject(null);
			}
			
		};
	} else {
		return null;
	}
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:27,代码来源:RevisionDiffPanel.java

示例13: PolymorphicPropertyEditor

import org.apache.wicket.model.IModel; //导入依赖的package包/类
public PolymorphicPropertyEditor(String id, PropertyDescriptor propertyDescriptor, IModel<Serializable> propertyModel) {
	super(id, propertyDescriptor, propertyModel);
	
	Class<?> baseClass = propertyDescriptor.getPropertyClass();
	ImplementationRegistry registry = AppLoader.getInstance(ImplementationRegistry.class);
	implementations.addAll(registry.getImplementations(baseClass));
	
	Preconditions.checkArgument(
			!implementations.isEmpty(), 
			"Can not find implementations for '" + baseClass + "'.");
	
	EditableUtils.sortAnnotatedElements(implementations);
	
	Method propertyGetter = propertyDescriptor.getPropertyGetter();
	if (propertyGetter.getAnnotation(Vertical.class) != null)
		vertical = true;
	else if (propertyGetter.getAnnotation(Horizontal.class) != null)
		vertical = false;
	else 
		vertical = true;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:22,代码来源:PolymorphicPropertyEditor.java

示例14: MarkdownEditor

import org.apache.wicket.model.IModel; //导入依赖的package包/类
/**
 * @param id 
 * 			component id of the editor
 * @param model
 * 			markdown model of the editor
 * @param compactMode
 * 			editor in compact mode occupies horizontal space and is suitable 
 * 			to be used in places such as comment aside the code
 */
public MarkdownEditor(String id, IModel<String> model, boolean compactMode) {
	super(id, model);
	this.compactMode = compactMode;
	
	String cookieKey;
	if (compactMode)
		cookieKey = "markdownEditor.compactMode.split";
	else
		cookieKey = "markdownEditor.normalMode.split";
	
	WebRequest request = (WebRequest) RequestCycle.get().getRequest();
	Cookie cookie = request.getCookie(cookieKey);
	if (cookie!=null && "true".equals(cookie.getValue())) {
		initialSplit = true;
	} else {
		initialSplit = !compactMode;
	}
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:28,代码来源:MarkdownEditor.java

示例15: getBreadcrumbs

import org.apache.wicket.model.IModel; //导入依赖的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, UserListPage.class) {

				@Override
				public IModel<?> getBody() {
					return Model.of("Users");
				}
				
			};
		}
		
	});

	return breadcrumbs;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:23,代码来源:UserListPage.java


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