本文整理匯總了Java中org.apache.wicket.markup.html.form.Button.add方法的典型用法代碼示例。如果您正苦於以下問題:Java Button.add方法的具體用法?Java Button.add怎麽用?Java Button.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.wicket.markup.html.form.Button
的用法示例。
在下文中一共展示了Button.add方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: ModalInstancePage
import org.apache.wicket.markup.html.form.Button; //導入方法依賴的package包/類
public ModalInstancePage(String id, TopicModel<Topic> topicModel, TopicTypeModel topicTypeModel, FieldsViewModel fieldsViewModel) {
super(id);
this.topicModel = topicModel;
this.topicTypeModel = topicTypeModel;
this.fieldsViewModel = fieldsViewModel;
// page is read-only if topic type is read-only
this.isReadOnly = ((topicTypeModel != null && topicTypeModel.getTopicType().isReadOnly()) || (Objects.equals(getRequest().getParameter("ro"), "true")));
this.popupContent = new WebMarkupContainer("popupContent");
popupContent.setOutputMarkupId(true);
add(popupContent);
popupContent.add(createInstancePanel("instancePanel"));
Button closeOkButton = new Button("closeOK");
closeOkButton.add(new AjaxFormComponentUpdatingBehavior("onclick") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
onCloseOk(target);
}
});
popupContent.add(closeOkButton);
}
示例2: AssociationTransformFunctionBoxPanel
import org.apache.wicket.markup.html.form.Button; //導入方法依賴的package包/類
public AssociationTransformFunctionBoxPanel(String id, final TopicModel<Topic> topicModel) {
super(id);
add(new Label("title", new ResourceModel("transform.association.instances")));
Button addButton = new Button("button", new ResourceModel("transform"));
addButton.add(new AjaxFormComponentUpdatingBehavior("onclick") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
Topic instance = topicModel.getTopic();
Map<String,String> pageParametersMap = new HashMap<String,String>();
pageParametersMap.put("topicMapId", instance.getTopicMap().getId());
pageParametersMap.put("topicId", instance.getId());
setResponsePage(AssociationTransformPage.class, new PageParameters(pageParametersMap));
}
});
add(addButton);
}
示例3: LoginPage
import org.apache.wicket.markup.html.form.Button; //導入方法依賴的package包/類
public LoginPage() {
final Form<User> form = new Form<User>("loginForm",
new CompoundPropertyModel<User>(user));
TextField<String> nameField = new TextField<String>(User.NAME);
form.add(nameField);
PasswordTextField passwordField = new PasswordTextField(User.PASSWORD);
form.add(passwordField);
Button submit = new Button("loginButton") {
@Override
public void onSubmit() {
User dbUser = userDAO.findByUsername(user.getName());
if (dbUser != null
&& dbUser.getPassword().equals(user.getPassword())) {
LoginPage.this.getSession().setUser(dbUser);
setResponsePage(NotesPage.class);
} else {
form.error("Invalid login");
}
};
};
submit.add(new ButtonBehavior());
form.add(submit);
add(form);
}
示例4: newAddRuleButton
import org.apache.wicket.markup.html.form.Button; //導入方法依賴的package包/類
private Button newAddRuleButton(final SimpleSearch clonedSimpleSearch,
final SearchRule rule) {
Button addRule = new Button("addRule");
SearchRule addedSearchRule;
if (rule instanceof TextSearchRule) {
addedSearchRule = rule.cloneRule();
} else {
addedSearchRule = SearchRulesFactory.getDefaultSearchRule();
}
String url = getAddRuleUrl(clonedSimpleSearch, rule, addedSearchRule);
addRule.add(new SimpleAttributeModifier("name", "addRule"));
addRule.add(new SimpleAttributeModifier("onclick", url));
return addRule;
}
示例5: createAuthenticationToken
import org.apache.wicket.markup.html.form.Button; //導入方法依賴的package包/類
@SuppressWarnings("serial")
public static void createAuthenticationToken(final GridBuilder gridBuilder, final PFUserDO user, final UserDao userDao,
final Form< ? > form)
{
// Authentication token
final FieldsetPanel fs = gridBuilder.newFieldset(gridBuilder.getString("user.authenticationToken")).suppressLabelForWarning();
fs.add(new DivTextPanel(fs.newChildId(), new Model<String>() {
@Override
public String getObject()
{
if (PFUserContext.getUserId().equals(user.getId()) == true) {
return userDao.getAuthenticationToken(user.getId());
} else {
// Administrators shouldn't see the token.
return "*****";
}
}
}));
fs.addHelpIcon(gridBuilder.getString("user.authenticationToken.tooltip"));
final Button button = new Button(SingleButtonPanel.WICKET_ID, new Model<String>("renewAuthenticationKey")) {
@Override
public final void onSubmit()
{
userDao.renewAuthenticationToken(user.getId());
form.error(getString("user.authenticationToken.renew.successful"));
}
};
button.add(WicketUtils.javaScriptConfirmDialogOnClick(form.getString("user.authenticationToken.renew.securityQuestion")));
fs.add(new SingleButtonPanel(fs.newChildId(), button, gridBuilder.getString("user.authenticationToken.renew"), SingleButtonPanel.DANGER));
WicketUtils.addTooltip(button, gridBuilder.getString("user.authenticationToken.renew.tooltip"));
}
示例6: ButtonPanel
import org.apache.wicket.markup.html.form.Button; //導入方法依賴的package包/類
public ButtonPanel(final String id, final String label, final ButtonType... buttonTypes)
{
super(id);
button = new Button(BUTTON_ID, new Model<String>(label));
button.add(new Label("title", label));
for (final ButtonType buttonType : buttonTypes) {
button.add(AttributeModifier.append("class", buttonType.getClassAttrValue()));
}
add(button);
}
示例7: SingleButtonPanel
import org.apache.wicket.markup.html.form.Button; //導入方法依賴的package包/類
/**
*
* @param id
* @param button
* @param label
* @param classnames css class names
*/
public SingleButtonPanel(final String id, final Button button, final IModel<String> label, final String... classnames)
{
super(id);
this.button = button;
add(button);
button.add(new Label("label", label).setRenderBodyOnly(true));
if (classnames != null) {
button.add(AttributeModifier.append("class", StringHelper.listToString(" ", classnames)));
}
}
示例8: newDeleteButton
import org.apache.wicket.markup.html.form.Button; //導入方法依賴的package包/類
private Button newDeleteButton(final SimpleSearch clonedSimpleSearch,
final SearchRule rule) {
SimpleParams withRowDeleted = new SimpleParams();
String restrictedPrefix = rule.getPrefix();
if (rule.getParent() == null) {
RecordCollectionServices recordCollectionServices = ConstellioSpringUtils.getRecordCollectionServices();
RecordCollection recordcollection = recordCollectionServices.get(clonedSimpleSearch.getCollectionName());
clonedSimpleSearch.setAdvancedSearchRule(SearchRulesFactory.getInitialSearchRuleFor(recordcollection));
withRowDeleted = clonedSimpleSearch.toSimpleParams(true);
} else {
withRowDeleted = clonedSimpleSearch.toSimpleParams(true);
List<String> params = new ArrayList<String>();
params.addAll(withRowDeleted.keySet());
for(String param : params) {
if (param.contains(rule.getPrefix())) {
withRowDeleted.remove(param);
}
}
}
String url = urlFor(
getPage().getClass(),
SimpleParamsUtils.toPageParameters(withRowDeleted)).toString();
Button delete = new Button("delete");
delete.add(new SimpleAttributeModifier("name", "delete"));
delete.add(new SimpleAttributeModifier("onclick", "goToUrl('" + url
+ "', '" + SearchRule.ROOT_PREFIX + "', '" + restrictedPrefix
+ "')"));
return delete;
}
示例9: newAddGroupButton
import org.apache.wicket.markup.html.form.Button; //導入方法依賴的package包/類
private Button newAddGroupButton(final SimpleSearch clonedSimpleSearch,
final SearchRule rule) {
Button addGroup = new Button("addGroup");
String url = getAddRuleUrl(clonedSimpleSearch, rule,
SearchRulesFactory.getDefaultSearchRulesGroup());
addGroup.add(new SimpleAttributeModifier("name", "addGroup"));
addGroup.add(new SimpleAttributeModifier("onclick", url));
return addGroup;
}
示例10: getEditLink
import org.apache.wicket.markup.html.form.Button; //導入方法依賴的package包/類
@Override
protected MarkupContainer getEditLink(String id, final IModel<? extends Project> projectModel) {
Button editLink = new Button(id);
editLink.add(new AjaxModalOpenBehavior(editProjectPopup, MouseEvent.CLICK) {
private static final long serialVersionUID = 1L;
@Override
protected void onShow(AjaxRequestTarget target) {
editProjectPopup.getModel().setObject(projectModel.getObject());
}
});
return editLink;
}
示例11: ProjectListPage
import org.apache.wicket.markup.html.form.Button; //導入方法依賴的package包/類
public ProjectListPage(PageParameters parameters) {
super(parameters);
String term = parameters.get(LinkUtils.SEARCH_TERM_PARAMETER).toString();
long pageNumber = LinkUtils.extractPageNumberParameter(parameters);
IModel<String> searchTermModel = Model.of(term);
addBreadCrumbElement(new BreadCrumbElement(new ResourceModel("project.list.pageTitle"),
ProjectListPage.linkDescriptor()));
// Add project button
final ProjectFormPopupPanel addProjectPopup = new ProjectFormPopupPanel("addProjectPopup", FormPanelMode.ADD);
add(addProjectPopup);
Button addProjectButton = new AuthenticatedOnlyButton("addProject") {
private static final long serialVersionUID = 1L;
@Override
protected void onConfigure() {
super.onConfigure();
setVisible(MavenArtifactNotifierSession.get().hasRoleAdmin());
}
};
addProjectButton.add(new AjaxModalOpenBehavior(addProjectPopup, MouseEvent.CLICK));
add(addProjectButton);
// Page content
ProjectPortfolioPanel portfolioPanel = new ProjectPortfolioPanel("portfolio",
new ProjectDataProvider(searchTermModel), configurer.getPortfolioItemsPerPage());
portfolioPanel.getPageable().setCurrentPage(pageNumber);
add(portfolioPanel);
add(new ProjectSearchPanel("searchPanel", portfolioPanel.getPageable(), searchTermModel));
}
示例12: AdministrationUserPortfolioPage
import org.apache.wicket.markup.html.form.Button; //導入方法依賴的package包/類
public AdministrationUserPortfolioPage(PageParameters parameters) {
super(parameters);
addBreadCrumbElement(new BreadCrumbElement(new ResourceModel("navigation.administration.user"),
AdministrationUserPortfolioPage.linkDescriptor()));
IModel<String> searchTermModel = Model.of("");
UserPortfolioPanel portfolioPanel = new UserPortfolioPanel("portfolio", new UserDataProvider(searchTermModel),
configurer.getPortfolioItemsPerPage());
add(portfolioPanel);
add(new AdministrationUserSearchPanel("searchPanel", portfolioPanel.getPageable(), searchTermModel));
// User create popup
UserFormPopupPanel userCreatePanel = new UserFormPopupPanel("userCreatePopupPanel");
add(userCreatePanel);
Button createUser = new Button("createUser");
createUser.add(new AjaxModalOpenBehavior(userCreatePanel, MouseEvent.CLICK) {
private static final long serialVersionUID = 5414159291353181776L;
@Override
protected void onShow(AjaxRequestTarget target) {
}
});
add(createUser);
}
示例13: AdministrationUserGroupPortfolioPage
import org.apache.wicket.markup.html.form.Button; //導入方法依賴的package包/類
public AdministrationUserGroupPortfolioPage(PageParameters parameters) {
super(parameters);
addBreadCrumbElement(new BreadCrumbElement(new ResourceModel("navigation.administration.usergroup"),
AdministrationUserGroupPortfolioPage.linkDescriptor()));
IModel<List<UserGroup>> userGroupListModel = new LoadableDetachableModel<List<UserGroup>>() {
private static final long serialVersionUID = -4518288683578265677L;
@Override
protected List<UserGroup> load() {
return userGroupService.list();
}
};
add(new UserGroupPortfolioPanel("portfolio", userGroupListModel, configurer.getPortfolioItemsPerPage()));
// User group create popup
UserGroupFormPopupPanel userGroupCreatePanel = new UserGroupFormPopupPanel("userGroupCreatePopupPanel");
add(userGroupCreatePanel);
Button createUserGroup = new Button("createUserGroup");
createUserGroup.add(new AjaxModalOpenBehavior(userGroupCreatePanel, MouseEvent.CLICK) {
private static final long serialVersionUID = 5414159291353181776L;
@Override
protected void onShow(AjaxRequestTarget target) {
}
});
add(createUserGroup);
}
示例14: createPanel
import org.apache.wicket.markup.html.form.Button; //導入方法依賴的package包/類
private void createPanel() {
Form<Object> form = new Form<Object>("form");
add(form);
AssociationType associationType = getAssociationType();
// get used role type combinations
Collection<List<RoleType>> roleCombos = associationType.getUsedRoleTypeCombinations();
// then remove the combination that is valid according to declaration
List<RoleType> declaredRoleTypes = associationType.getDeclaredRoleTypes();
Collections.sort(declaredRoleTypes, new Comparator<RoleType>() {
@Override
public int compare(RoleType rt1, RoleType rt2) {
return ObjectIdComparator.INSTANCE.compare(rt1.getTopicIF(), rt2.getTopicIF());
}
});
roleCombos.remove(declaredRoleTypes);
RepeatingView rview = new RepeatingView("combos");
Iterator<List<RoleType>> citer = roleCombos.iterator();
while (citer.hasNext()) {
List<RoleType> roleTypes = citer.next();
if (roleTypes.size() != declaredRoleTypes.size()) {
citer.remove();
continue;
}
rview.add(new AssociationTransformerPanel(rview.newChildId(), associationType, roleTypes));
}
form.add(rview);
Label message = new Label("message", new ResourceModel("transform.association.instances.none"));
message.setVisible(roleCombos.isEmpty());
form.add(message);
Button button = new Button("button", new ResourceModel("button.ok"));
button.setVisible(roleCombos.isEmpty());
button.add(new AjaxFormComponentUpdatingBehavior("onclick") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
Topic t = getAssociationType();
Map<String,String> pageParametersMap = new HashMap<String,String>();
pageParametersMap.put("topicMapId", t.getTopicMap().getId());
pageParametersMap.put("topicId", t.getId());
pageParametersMap.put("ontology", "true");
setResponsePage(InstancePage.class, new PageParameters(pageParametersMap));
}
});
form.add(button);
}
示例15: CreateNewTopicMapPanel
import org.apache.wicket.markup.html.form.Button; //導入方法依賴的package包/類
public CreateNewTopicMapPanel(String id) {
super(id);
IModel<List<TopicMapSource>> sourcesChoicesModel = new LoadableDetachableModel<List<TopicMapSource>>() {
@Override
protected List<TopicMapSource> load() {
List<TopicMapSource> result = OntopolyContext.getOntopolyRepository().getEditableSources();
numberOfSources = result.size();
return result;
}
};
List<TopicMapSource> sources = sourcesChoicesModel.getObject();
TopicMapSourceModel topicMapSourceModel = null;
if (numberOfSources > 0) {
topicMapSourceModel = new TopicMapSourceModel((TopicMapSource)sources.get(0));
}
WebMarkupContainer sourcesDropDownContainer = new WebMarkupContainer("sourcesDropDownContainer") {
@Override
public boolean isVisible() {
return numberOfSources > 1 ? true : false;
}
};
sourcesDropDownContainer.setOutputMarkupPlaceholderTag(true);
add(sourcesDropDownContainer);
final AjaxOntopolyDropDownChoice<TopicMapSource> sourcesDropDown = new AjaxOntopolyDropDownChoice<TopicMapSource>("sourcesDropDown",
topicMapSourceModel, sourcesChoicesModel, new ChoiceRenderer<TopicMapSource>("title", "id"));
sourcesDropDownContainer.add(sourcesDropDown);
final AjaxOntopolyTextField nameField = new AjaxOntopolyTextField("content", new Model<String>(""));
add(nameField);
final Button button = new Button("button", new ResourceModel("create"));
button.setOutputMarkupId(true);
button.add(new AjaxFormComponentUpdatingBehavior("onclick") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
String name = nameField.getModel().getObject();
if(!name.isEmpty()) {
TopicMapSource topicMapSource = (TopicMapSource) sourcesDropDown.getModelObject();
String referenceId = OntopolyContext.getOntopolyRepository().createOntopolyTopicMap(topicMapSource.getId(), name);
Map<String,String> pageParametersMap = new HashMap<String,String>();
pageParametersMap.put("topicMapId", referenceId);
setResponsePage(TopicTypesPage.class, new PageParameters(pageParametersMap));
}
}
});
add(button);
}