本文整理匯總了Java中org.apache.wicket.markup.html.form.Button類的典型用法代碼示例。如果您正苦於以下問題:Java Button類的具體用法?Java Button怎麽用?Java Button使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Button類屬於org.apache.wicket.markup.html.form包,在下文中一共展示了Button類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
示例2: addLoginButton
import org.apache.wicket.markup.html.form.Button; //導入依賴的package包/類
private void addLoginButton() {
final Button applyButton = new Button("loginButton") {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit() {
final String email = LoginPage.this.emailInput.getValue();
final String password = LoginPage.this.passwordInput.getValue();
if (LoginPage.this.login(email, password)) {
this.setResponsePage(LoginPage.class);
}
}
};
this.loginForm.add(applyButton);
}
示例3: LoginForm
import org.apache.wicket.markup.html.form.Button; //導入依賴的package包/類
public LoginForm(String markupId) {
super(markupId);
this.setDefaultModel(new CompoundPropertyModel<Object>(this));
this.add(new TextField("username").setRequired(true));
this.add(new PasswordTextField("password").setRequired(true));
Button submitBtn = new AjaxButton("loginBtn", Model.of("Sign In")) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
if (AuthenticatedWebSession.get().signIn(username, password))
setResponsePage(DiscoverItemsPage.class);
else {
target.add(ComponentUtils.displayBlock(alert));
}
}
};
this.add(submitBtn);
this.setDefaultButton(submitBtn);
}
示例4: selectMessage
import org.apache.wicket.markup.html.form.Button; //導入依賴的package包/類
private void selectMessage(long id, AjaxRequestTarget target) {
PrivateMessage msg = getBean(PrivateMessageDao.class).get(id);
selectedMessage.addOrReplace(new Label("from", msg == null ? "" : getEmail(msg.getFrom())));
selectedMessage.addOrReplace(new Label("to", msg == null ? "" : getEmail(msg.getTo())));
selectedMessage.addOrReplace(new Label("subj", msg == null ? "" : msg.getSubject()));
selectedMessage.addOrReplace(new Label("body", msg == null ? "" : msg.getMessage()).setEscapeModelStrings(false));
if (msg != null) {
Room r = msg.getRoom();
if (r != null) {
Appointment a = getBean(AppointmentDao.class).getByRoom(r.getId());
roomContainer.addOrReplace(new Label("start", a == null ? "" : getDateFormat().format(a.getStart())));
roomContainer.addOrReplace(new Label("end", a == null ? "" : getDateFormat().format(a.getEnd())));
roomContainer.addOrReplace(new Button("enter").add(new RoomEnterBehavior(r.getId())));
}
roomContainer.setVisible(r != null);
}
if (target != null) {
target.add(selectedMessage);
updateControls(target);
}
}
示例5: ConfirmPanel
import org.apache.wicket.markup.html.form.Button; //導入依賴的package包/類
public ConfirmPanel(final String id, String message) {
super(id);
Form cform = new Form("cform");
cform.add(new Label("message", message));
cform.add(new Button("confirm") {
@Override
public void onSubmit() {
onConfirm();
}
});
cform.add(new Button("cancel") {
@Override
public void onSubmit() {
ConfirmPanel.this.setVisible(false);
}
});
add(cform);
}
示例6: EditRolePage
import org.apache.wicket.markup.html.form.Button; //導入依賴的package包/類
public EditRolePage(PageParameters parameters) {
super(ListRolesPage.class, parameters);
long roleId = parameters.get("id").toLong(-1L);
final UIRole role = roleService.getRole(roleId);
setDefaultModel(new CompoundPropertyModel<UIRole>(role));
Form form = new Form("form"){
@Override
protected void onSubmit() {
roleService.updateRole(role);
setResponsePage(ListRolesPage.class);
}
};
add(form);
form.add(new LabelValueRow<String>("role-name", new Model<String>(role.getRoleName()), "role.create.name"));
form.add(new LabelTextFieldRow<String>(role, "principalName", "role.create.principal-name", true));
form.add(new Button("form-submit"));
form.add(new BookmarkablePageLink<Page>("form-cancel", ListRolesPage.class));
}
示例7: LoginPageForm
import org.apache.wicket.markup.html.form.Button; //導入依賴的package包/類
public LoginPageForm( String id )
{
super( id );
HttpServletRequest servletReq = ( HttpServletRequest ) getRequest().getContainerRequest();
Principal principal = servletReq.getUserPrincipal();
if ( principal != null )
{
LOG.info( "user already logged in, route to launch page instead" );
setResponsePage( LaunchPage.class );
}
add( new Button( "login" ) );
TextField userId = new TextField( "userId", new PropertyModel<String>( this, "userId" ) );
add( userId );
PasswordTextField pw = new PasswordTextField( "pswdField", new PropertyModel<String>( this, "pswdField" ) );
pw.setRequired( false );
add( pw );
}
示例8: 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);
}
示例9: initExcluirButton
import org.apache.wicket.markup.html.form.Button; //導入依賴的package包/類
/**
* Exclui um artigo
*/
private void initExcluirButton() {
Button btn = new Button("excluir") {
@Override
public void onSubmit() {
try {
WikiLegisServiceUtil.excluiArtigo(EdicaoArtigoPage.this.getModelObject().getArtigoId());
} catch (Exception e) {
LOG.error("Erro ao excluir artigo", e);
}
setResponsePage(HomePage.class);
setRedirect(true);
}
};
btn.setDefaultFormProcessing(false);
form.add(btn);
}
示例10: Kunde_KartePanel
import org.apache.wicket.markup.html.form.Button; //導入依賴的package包/類
public Kunde_KartePanel(String id, IModel<?> model) {
super(id, model);
GeneratedBinding generatedBinding = new GeneratedBinding(this);
generatedBinding.withInterceptors(new BindingInterceptor() {
@Override
public Component createButton(ButtonElement e) {
if (e.getWicketId().equals(Kunde_KarteConstants.pruefen)) {
Button button = new GeneratedButton(e) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
super.onSubmit(target, form);
System.err.println("Button call intercepted");
}
};
return button;
}
return super.createButton(e);
}
});
generatedBinding.bind();
}
示例11: UploadForm
import org.apache.wicket.markup.html.form.Button; //導入依賴的package包/類
public UploadForm(String id) {
super(id);
setMultiPart(true);
setMaxSize(Bytes.megabytes(2));
fileUploadField = new FileUploadField("upload");
add(fileUploadField);
add(new Button("continuebutton"));
Button cancel = new Button("cancelbutton"){
public void onSubmit() {
// info("Cancel was pressed!");
setResponsePage(new GradebookPage());
}
};
cancel.setDefaultFormProcessing(false);
add(cancel);
}
示例12: 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);
}
示例13: AddCriteriaForm
import org.apache.wicket.markup.html.form.Button; //導入依賴的package包/類
/**
* @param id
* The wicket:id component ID of this form.
*/
public AddCriteriaForm(String id) {
super(id, new CompoundPropertyModel<ElementCrit>(new ElementCrit()));
List<Element> ptypeElements = fm.safeGetElementsForProductType(type);
Collections.sort(ptypeElements, new Comparator<Element>() {
public int compare(Element e1, Element e2) {
return e1.getElementName().compareTo(e2.getElementName());
}
});
add(new DropDownChoice<Element>("criteria_list", new PropertyModel(
getDefaultModelObject(), "elem"), new ListModel<Element>(
ptypeElements), new ChoiceRenderer<Element>("elementName",
"elementId")));
add(new TextField<TermQueryCriteria>(
"criteria_form_add_element_value",
new PropertyModel<TermQueryCriteria>(getDefaultModelObject(), "value")));
add(new Button("criteria_elem_add"));
}
示例14: EditForm
import org.apache.wicket.markup.html.form.Button; //導入依賴的package包/類
public EditForm(String id, final IModel<Setting> setting) {
super(id, new CompoundPropertyModel<Setting>(setting));
add(new LocalFeedbackPanel("feedback", this));
value = new RequiredTextField<String>("value");
value.add(new SettingValidator(setting.getObject().getName()));
add(value);
add(new Button("save") {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit() {
if (!value.hasErrorMessage()) {
BlogServiceHolder.get().updateSetting(EditForm.this.getModelObject());
getSession().info("Setting saved");
setRedirect(true);
setResponsePage(SettingsPage.class);
}
}
});
add(new CancelButton("cancel", SettingsPage.class));
}
示例15: LoginForm
import org.apache.wicket.markup.html.form.Button; //導入依賴的package包/類
public LoginForm(String id) {
super(id, new CompoundPropertyModel<LoginFormModel>(new LoginFormModel()));
add(new LocalFeedbackPanel("feedback", this));
add(new PasswordTextField("password"));
add(new Button("submit") {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit() {
if (BlogServiceHolder.get().isOwnerPasswordMatch(LoginForm.this.getModelObject().getPassword())) {
((BlogSession) getSession()).setAuthenticated(true);
setResponsePage(IndexPage.class);
} else {
error("Wrong password");
}
}
});
}