001: /*
002: * $Id: AjaxApplication.java 4860 2006-03-12 08:57:48Z ivaynberg $ $Revision:
003: * 4860 $ $Date: 2006-03-12 09:57:48 +0100 (So, 12 Mrz 2006) $
004: *
005: * ==============================================================================
006: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
007: * use this file except in compliance with the License. You may obtain a copy of
008: * the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing, software
013: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
014: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
015: * License for the specific language governing permissions and limitations under
016: * the License.
017: */
018: package wicket.examples.ajax.builtin;
019:
020: import java.util.Arrays;
021: import java.util.List;
022:
023: import wicket.Component;
024: import wicket.extensions.ajax.markup.html.AjaxEditableChoiceLabel;
025: import wicket.extensions.ajax.markup.html.AjaxEditableLabel;
026: import wicket.extensions.ajax.markup.html.AjaxEditableMultiLineLabel;
027: import wicket.markup.html.basic.Label;
028: import wicket.markup.html.link.Link;
029: import wicket.model.AbstractReadOnlyModel;
030: import wicket.model.CompoundPropertyModel;
031:
032: /**
033: * Page to demo the inplace edit label {@link AjaxEditableLabel}
034: *
035: * @author Igor Vaynberg (ivaynberg)
036: */
037: public class EditableLabelPage extends BasePage {
038: /** available sites for the multiple select. */
039: private static final List SITES = Arrays.asList(new String[] {
040: "The Server Side", "Java Lobby", "Java.Net" });
041: private String site = (String) SITES.get(0);
042: private String text1 = "fox";
043: private String text2 = "dog";
044: private String text3 = "multiple\nlines of\ntextual content";
045: private int refreshCounter = 0;
046:
047: /**
048: * Constructor
049: */
050: public EditableLabelPage() {
051: setModel(new CompoundPropertyModel(this ));
052: add(new AjaxEditableLabel("text1"));
053: add(new AjaxEditableLabel("text2"));
054: add(new AjaxEditableMultiLineLabel("text3"));
055: add(new AjaxEditableChoiceLabel("site", SITES));
056:
057: add(new Label("refresh-counter", new AbstractReadOnlyModel() {
058: public Object getObject(Component component) {
059: return "" + refreshCounter;
060: }
061: }));
062:
063: add(new Link("refresh-link") {
064: public void onClick() {
065: refreshCounter++;
066: }
067: });
068: }
069:
070: /**
071: * @return text1
072: */
073: public String getText1() {
074: return text1;
075: }
076:
077: /**
078: * @return text2
079: */
080: public String getText2() {
081: return text2;
082: }
083:
084: /**
085: * @return gets text3
086: */
087: public String getText3() {
088: return text3;
089: }
090:
091: /**
092: * @param text1
093: */
094: public void setText1(String text1) {
095: this .text1 = text1;
096: }
097:
098: /**
099: * @param text2
100: */
101: public void setText2(String text2) {
102: this .text2 = text2;
103: }
104:
105: /**
106: * @param text3
107: * the text3 to set
108: */
109: public void setText3(String text3) {
110: this .text3 = text3;
111: }
112:
113: /**
114: * @return gets site
115: */
116: public String getSite() {
117: return site;
118: }
119:
120: /**
121: * @param site
122: * the site to set
123: */
124: public void setSite(String site) {
125: this.site = site;
126: }
127: }
|