001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.krad.uif;
017
018import java.text.MessageFormat;
019
020/**
021 * Constants for CSS style strings
022 *
023 * @author Kuali Rice Team (rice.collab@kuali.org)
024 */
025public class CssConstants {
026
027        public static final String DISPLAY = "display: ";
028
029        public static class Displays {
030                public static final String BLOCK = DISPLAY + "block;";
031                public static final String INLINE = DISPLAY + "inline;";
032                public static final String INLINE_BLOCK = DISPLAY + "inline-block;";
033                public static final String NONE = DISPLAY + "none;";
034        }
035
036        public static final String TEXT_ALIGN = "text-align: ";
037
038        public static class TextAligns {
039                public static final String LEFT = TEXT_ALIGN + "left;";
040                public static final String RIGHT = TEXT_ALIGN + "right;";
041                public static final String CENTER = TEXT_ALIGN + "center;";
042                public static final String JUSTIFY = TEXT_ALIGN + "justify;";
043                public static final String INHERIT = TEXT_ALIGN + "inherit;";
044        }
045
046        public static final String VERTICAL_ALIGN = "vertical-align: ";
047
048        public static class VerticalAligns {
049                public static final String BASELINE = VERTICAL_ALIGN + "Baseline;";
050                public static final String BOTTOM = VERTICAL_ALIGN + "bottom;";
051                public static final String MIDDLE = VERTICAL_ALIGN + "middle;";
052                public static final String TOP = VERTICAL_ALIGN + "top;";
053        }
054
055        public static class Margins {
056                public static final String MARGIN_LEFT = "margin-left: {0};";
057                public static final String MARGIN_RIGHT = "margin-right: {0};";
058                public static final String MARGIN_TOP = "margin-top: {0};";
059                public static final String MARGIN_BOTTOM = "margin-bottom: {0};";
060        }
061
062        public static class Padding {
063                public static final String PADDING_LEFT = "padding-left: {0};";
064                public static final String PADDING_RIGHT = "padding-right: {0};";
065                public static final String PADDING_TOP = "padding-top: {0};";
066                public static final String PADDING_BOTTOM = "padding-bottom: {0};";
067        }
068
069        public static final String WIDTH = "width: ";
070    public static final String HEIGHT = "height: ";
071    public static final String OVERFLOW = "overflow: ";
072
073        /**
074         * Replaces parameters in the given CSS string with the corresponding
075         * parameter values given
076         *
077         * @param style string with parameters to replace
078         * @param parameters one or more parameter values
079         * @return given string with filled parameters
080         */
081        public static final String getCssStyle(String style, String... parameters) {
082                MessageFormat cssStyle = new MessageFormat(style);
083
084                return cssStyle.format(parameters);
085        }
086
087    public static class Classes {
088        public static final String SUPPORT_TITLE_STYLE_CLASS = "uif-viewHeader-supportTitle";
089        public static final String HIDE_HEADER_TEXT_STYLE_CLASS = "uif-hideHeaderText";
090        public static final String HAS_ADD_LINE = "uif-hasAddLine";
091    }
092}