View Javadoc

1   package org.apache.myfaces.tobago.taglib.sandbox;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one or more
5    * contributor license agreements.  See the NOTICE file distributed with
6    * this work for additional information regarding copyright ownership.
7    * The ASF licenses this file to You under the Apache License, Version 2.0
8    * (the "License"); you may not use this file except in compliance with
9    * the License.  You may obtain a copy of the License at
10   *
11   *      http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  
20  import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STATE_PREVIEW;
21  import static org.apache.myfaces.tobago.TobagoConstants.FACET_LAYOUT;
22  import org.apache.myfaces.tobago.component.ComponentUtil;
23  import org.apache.myfaces.tobago.taglib.component.TextInputTag;
24  
25  import javax.faces.component.UIComponent;
26  import javax.servlet.jsp.JspException;
27  
28  /**
29   * TODO: under construction
30   */
31  public class RichTextEditorTag extends TextInputTag
32      implements org.apache.myfaces.tobago.taglib.sandbox.RichTextEditorTagDeclaration {
33  
34    private String statePreview;
35  
36  
37    public int doEndTag() throws JspException {
38      // TODO: own layout for editor?
39      int result = super.doEndTag();
40      getComponentInstance().getFacets().remove(FACET_LAYOUT);
41      return result;
42    }
43  
44    protected void setProperties(UIComponent component) {
45      super.setProperties(component);
46      ComponentUtil.setBooleanProperty(component, ATTR_STATE_PREVIEW, statePreview);
47    }
48  
49    public void release() {
50      super.release();
51      statePreview = null;
52    }
53  
54    public String getStatePreview() {
55      return statePreview;
56    }
57  
58    public void setStatePreview(String statePreview) {
59      this.statePreview = statePreview;
60    }
61  }