View Javadoc

1   /*
2    * Copyright 2006-2016 The JGUIraffe Team.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License")
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package net.sf.jguiraffe.gui.builder.components.model;
17  
18  
19  /**
20   * <p>
21   * Definition of an interface for describing the properties of a <em>static
22   * text</em> element.
23   * </p>
24   * <p>
25   * A <em>static text</em> is an element that appears like a label, but can be
26   * changed after the GUI was created. For this purpose the
27   * {@link net.sf.jguiraffe.gui.builder.components.ComponentHandler
28   * ComponentHandler} of the static text element is used. It maintains a data
29   * object of the type of this interface. The methods defined by this interface
30   * can then be used to query the current properties of the static text or modify
31   * them.
32   * </p>
33   * <p>
34   * Note: static text elements are created by the
35   * {@link net.sf.jguiraffe.gui.builder.components.tags.StaticTextTag
36   * StaticTextTag} tag handler class.
37   * </p>
38   *
39   * @author Oliver Heger
40   * @version $Id: StaticTextData.java 205 2012-01-29 18:29:57Z oheger $
41   */
42  public interface StaticTextData
43  {
44      /**
45       * Returns the text of the affected element.
46       *
47       * @return the text (can be <b>null</b> if there is no text)
48       */
49      String getText();
50  
51      /**
52       * Sets the text of the affected element.
53       *
54       * @param s the new text
55       */
56      void setText(String s);
57  
58      /**
59       * Returns the icon of the affected element.
60       *
61       * @return the icon (can be <b>null</b> if none was defined)
62       */
63      Object getIcon();
64  
65      /**
66       * Sets the icon of the affected element. The passed in object must be a
67       * valid icon that is compatible with the used GUI library. It may have been
68       * created using the
69       * {@link net.sf.jguiraffe.gui.builder.components.tags.IconTag IconTag} tag
70       * handler class for instance.
71       *
72       * @param icon the icon
73       */
74      void setIcon(Object icon);
75  
76      /**
77       * Returns the alignment of the text and the icon.
78       *
79       * @return the alignment
80       */
81      TextIconAlignment getAlignment();
82  
83      /**
84       * Sets the alignment of the text and the icon.
85       *
86       * @param alignment the new alignment (must not be <b>null</b>)
87       */
88      void setAlignment(TextIconAlignment alignment);
89  }