001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.wicket.util.tester;
018:
019: import org.apache.wicket.markup.html.WebPage;
020: import org.apache.wicket.markup.html.form.Button;
021: import org.apache.wicket.markup.html.form.CheckBox;
022: import org.apache.wicket.markup.html.form.Form;
023: import org.apache.wicket.markup.html.form.TextArea;
024: import org.apache.wicket.markup.html.form.TextField;
025: import org.apache.wicket.model.CompoundPropertyModel;
026:
027: /**
028: * Mock page for testing basic FormTester functionality.
029: *
030: * @author frankbille
031: */
032: public class MockFormPage extends WebPage {
033: private static final long serialVersionUID = 1L;
034:
035: /**
036: * Domain object
037: */
038: public class MockDomainObject {
039: private String text;
040: private boolean checkbox;
041: private String textarea;
042:
043: /**
044: * @return checkbox
045: */
046: public boolean isCheckbox() {
047: return checkbox;
048: }
049:
050: /**
051: * @param checkbox
052: */
053: public void setCheckbox(boolean checkbox) {
054: this .checkbox = checkbox;
055: }
056:
057: /**
058: * @return text
059: */
060: public String getText() {
061: return text;
062: }
063:
064: /**
065: * @param text
066: */
067: public void setText(String text) {
068: this .text = text;
069: }
070:
071: /**
072: * @return textarea
073: */
074: public String getTextarea() {
075: return textarea;
076: }
077:
078: /**
079: * @param textarea
080: */
081: public void setTextarea(String textarea) {
082: this .textarea = textarea;
083: }
084: }
085:
086: private final MockDomainObject domainObject;
087:
088: /**
089: * Construct.
090: */
091: public MockFormPage() {
092: domainObject = new MockDomainObject();
093: Form form = new Form("form", new CompoundPropertyModel(
094: domainObject));
095: add(form);
096:
097: form.add(new TextField("text"));
098: form.add(new CheckBox("checkbox"));
099: form.add(new TextArea("textarea"));
100: form.add(new Button("submit"));
101: }
102:
103: /**
104: * @return domainObject
105: */
106: public MockDomainObject getDomainObject() {
107: return domainObject;
108: }
109: }
|