View Javadoc
1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
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 org.kuali.rice.krad.uif;
17  
18  import java.text.MessageFormat;
19  
20  /**
21   * Constants for CSS style strings
22   *
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public class CssConstants {
26  
27      public static final String DISPLAY = "display: ";
28  
29      public static class Displays {
30          public static final String BLOCK = DISPLAY + "block;";
31          public static final String INLINE = DISPLAY + "inline;";
32          public static final String INLINE_BLOCK = DISPLAY + "inline-block;";
33          public static final String NONE = DISPLAY + "none;";
34      }
35  
36      public static final String TEXT_ALIGN = "text-align: ";
37  
38      public static class TextAligns {
39          public static final String LEFT = TEXT_ALIGN + "left;";
40          public static final String RIGHT = TEXT_ALIGN + "right;";
41          public static final String CENTER = TEXT_ALIGN + "center;";
42          public static final String JUSTIFY = TEXT_ALIGN + "justify;";
43          public static final String INHERIT = TEXT_ALIGN + "inherit;";
44      }
45  
46      public static final String VERTICAL_ALIGN = "vertical-align: ";
47  
48      public static class VerticalAligns {
49          public static final String BASELINE = VERTICAL_ALIGN + "Baseline;";
50          public static final String BOTTOM = VERTICAL_ALIGN + "bottom;";
51          public static final String MIDDLE = VERTICAL_ALIGN + "middle;";
52          public static final String TOP = VERTICAL_ALIGN + "top;";
53      }
54  
55      public static class Margins {
56          public static final String MARGIN_LEFT = "margin-left: {0};";
57          public static final String MARGIN_RIGHT = "margin-right: {0};";
58          public static final String MARGIN_TOP = "margin-top: {0};";
59          public static final String MARGIN_BOTTOM = "margin-bottom: {0};";
60      }
61  
62      public static class Padding {
63          public static final String PADDING_LEFT = "padding-left: {0};";
64          public static final String PADDING_RIGHT = "padding-right: {0};";
65          public static final String PADDING_TOP = "padding-top: {0};";
66          public static final String PADDING_BOTTOM = "padding-bottom: {0};";
67      }
68  
69      public static final String WIDTH = "width: ";
70      public static final String HEIGHT = "height: ";
71      public static final String OVERFLOW = "overflow: ";
72  
73      /**
74       * Replaces parameters in the given CSS string with the corresponding
75       * parameter values given
76       *
77       * @param style string with parameters to replace
78       * @param parameters one or more parameter values
79       * @return given string with filled parameters
80       */
81      public static final String getCssStyle(String style, String... parameters) {
82          MessageFormat cssStyle = new MessageFormat(style);
83  
84          return cssStyle.format(parameters);
85      }
86  
87      public static class Classes {
88          public static final String SUPPORT_TITLE_STYLE_CLASS = "uif-viewHeader-supportTitle";
89          public static final String HIDE_HEADER_TEXT_STYLE_CLASS = "uif-hideHeaderText";
90          public static final String HAS_ADD_LINE = "uif-hasAddLine";
91          public static final String SELECT_FIELD_STYLE_CLASS = "uif-select-line";
92          public static final String ACTION_COLUMN_STYLE_CLASS = "uif-collection-column-action";
93          public static final String HAS_HELPER = "has-helper";
94          public static final String IGNORE_VALID = "ignoreValid";
95          public static final String NEW_COLLECTION_ITEM = "uif-newCollectionItem";
96      }
97  }