本文整理汇总了Java中org.apache.wicket.model.IModel.getObject方法的典型用法代码示例。如果您正苦于以下问题:Java IModel.getObject方法的具体用法?Java IModel.getObject怎么用?Java IModel.getObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.wicket.model.IModel
的用法示例。
在下文中一共展示了IModel.getObject方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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());
}
};
}
示例2: RevisionSelector
import org.apache.wicket.model.IModel; //导入方法依赖的package包/类
public RevisionSelector(String id, IModel<Project> projectModel, @Nullable String revision, boolean canCreateRef) {
super(id);
Preconditions.checkArgument(revision!=null || !canCreateRef);
this.projectModel = projectModel;
this.revision = revision;
if (canCreateRef) {
Project project = projectModel.getObject();
canCreateBranch = SecurityUtils.canWrite(project);
canCreateTag = SecurityUtils.canCreateTag(project, Constants.R_TAGS);
} else {
canCreateBranch = false;
canCreateTag = false;
}
if (revision != null) {
Ref ref = projectModel.getObject().getRef(revision);
branchesActive = ref == null || GitUtils.ref2tag(ref.getName()) == null;
} else {
branchesActive = true;
}
refs = findRefs();
}
示例3: CommitListPanel
import org.apache.wicket.model.IModel; //导入方法依赖的package包/类
public CommitListPanel(String id, IModel<Project> projectModel, IModel<List<RevCommit>> commitsModel) {
super(id);
this.projectModel = projectModel;
this.commitsModel = new LoadableDetachableModel<List<RevCommit>>() {
@Override
protected List<RevCommit> load() {
List<RevCommit> commits = commitsModel.getObject();
if (commits.size() > WebConstants.MAX_DISPLAY_COMMITS)
commits = commits.subList(commits.size()-WebConstants.MAX_DISPLAY_COMMITS, commits.size());
CommitGraphUtils.sort(commits, 0);
return separateByDate(commits);
}
@Override
protected void onDetach() {
commitsModel.detach();
super.onDetach();
}
};
}
示例4: TextDiffPanel
import org.apache.wicket.model.IModel; //导入方法依赖的package包/类
public TextDiffPanel(String id, IModel<Project> projectModel, IModel<PullRequest> requestModel,
BlobChange change, DiffViewMode diffMode, @Nullable IModel<Boolean> blameModel,
@Nullable BlobCommentSupport markSupport) {
super(id);
this.projectModel = projectModel;
this.requestModel = requestModel;
this.change = change;
this.diffMode = diffMode;
this.markSupport = markSupport;
this.blameModel = blameModel;
if (blameModel != null && blameModel.getObject()) {
blameInfo = getBlameInfo();
}
}
示例5: 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);
}
}
}
示例6: validate
import org.apache.wicket.model.IModel; //导入方法依赖的package包/类
@Override
public Set<Violation> validate(IFieldValidator fieldValidator,
JcrNodeModel model, IModel childModel)
throws ValidationException {
Set<Violation> violations = new HashSet<>();
String value = (String) childModel.getObject();
if (value.length() > maxLength) {
violations.add(fieldValidator.newValueViolation(childModel, getTranslation()));
}
return violations;
}
示例7: createPortLink
import org.apache.wicket.model.IModel; //导入方法依赖的package包/类
public static Link<Void> createPortLink(String id, IModel<PortDto> model) {
PortDto port = model.getObject();
Label caption = new Label("ifName",
new org.apache.wicket.model.Model<String>(
NameUtil.getCaption(port)));
final PageParameters params = NodeUtil.getNodeParameters(port);
BookmarkablePageLink<Void> link = new BookmarkablePageLink<Void>(id, SimpleNodeDetailPage.class, params);
link.setEnabled(port != null);
link.add(caption);
return link;
}
示例8: RevisionDiffPanel
import org.apache.wicket.model.IModel; //导入方法依赖的package包/类
public RevisionDiffPanel(String id, IModel<Project> projectModel, IModel<PullRequest> requestModel,
String oldRev, String newRev, IModel<String> pathFilterModel, IModel<WhitespaceOption> whitespaceOptionModel,
@Nullable IModel<String> blameModel, @Nullable MarkSupport markSupport) {
super(id);
this.projectModel = projectModel;
this.requestModel = requestModel;
this.oldRev = oldRev;
this.newRev = newRev;
this.pathFilterModel = pathFilterModel;
this.blameModel = new IModel<String>() {
@Override
public void detach() {
blameModel.detach();
}
@Override
public String getObject() {
return blameModel.getObject();
}
@Override
public void setObject(String object) {
AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class);
String prevBlameFile = blameModel.getObject();
blameModel.setObject(object);
if (prevBlameFile != null && object != null && !prevBlameFile.equals(object)) {
SourceAware sourceAware = getSourceAware(prevBlameFile);
sourceAware.onUnblame(target);
}
target.appendJavaScript("gitplex.server.revisionDiff.reposition();");
}
};
this.whitespaceOptionModel = whitespaceOptionModel;
this.markSupport = markSupport;
WebRequest request = (WebRequest) RequestCycle.get().getRequest();
Cookie cookie = request.getCookie(COOKIE_VIEW_MODE);
if (cookie == null)
diffMode = DiffViewMode.UNIFIED;
else
diffMode = DiffViewMode.valueOf(cookie.getValue());
}
示例9: newOutlineSearchSymbolTree
import org.apache.wicket.model.IModel; //导入方法依赖的package包/类
private NestedTree<Symbol> newOutlineSearchSymbolTree(ModalPanel modal, List<Symbol> symbols,
@Nullable String searchInput) {
IModel<HashSet<Symbol>> state;
if (StringUtils.isNotBlank(searchInput)) {
state = new Model<HashSet<Symbol>>(new HashSet<>(symbols));
} else {
state = new Model<HashSet<Symbol>>(new HashSet<>(getChildSymbols(symbols, null)));
}
NestedTree<Symbol> tree = new NestedTree<Symbol>("result", newSymbolTreeProvider(symbols), state) {
private boolean matchFound;
@Override
protected void onInitialize() {
super.onInitialize();
add(new HumanTheme());
}
@Override
protected Component newContentComponent(String id, IModel<Symbol> nodeModel) {
Symbol symbol = nodeModel.getObject();
Fragment fragment = new Fragment(id, "outlineSearchNodeFrag", SourceViewPanel.this);
fragment.setOutputMarkupId(true);
AjaxLink<Void> link = new ViewStateAwareAjaxLink<Void>("link") {
@Override
public void onClick(AjaxRequestTarget target) {
modal.close();
context.onSelect(target, context.getBlobIdent(), symbol.getPosition());
}
};
link.add(symbol.renderIcon("icon"));
link.add(symbol.render("label", null));
link.add(AttributeAppender.append("data-symbolindex", symbols.indexOf(symbol)));
fragment.add(link);
if (!matchFound && matches(symbol, searchInput)) {
link.add(AttributeAppender.append("class", "active"));
matchFound = true;
}
return fragment;
}
};
tree.setOutputMarkupId(true);
return tree;
}