001/** 002 * Copyright 2005-2015 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 public static final String SELECT_FIELD_STYLE_CLASS = "uif-select-line"; 092 public static final String ACTION_COLUMN_STYLE_CLASS = "uif-collection-column-action"; 093 public static final String HAS_HELPER = "has-helper"; 094 public static final String IGNORE_VALID = "ignoreValid"; 095 public static final String NEW_COLLECTION_ITEM = "uif-newCollectionItem"; 096 public static final String TOOLTIP = "uif-tooltip"; 097 public static final String BTN = "btn"; 098 public static final String BTN_DEFAULT = "btn-default"; 099 public static final String ICON_ONLY_BUTTON = "uif-iconOnly"; 100 public static final String TRUNCATE = "uif-truncate"; 101 } 102 103 public static class ProgressBar { 104 public static final String VERTICAL_STEP_PROGRESS_BAR = "uif-stepProgressBar-vertical"; 105 public static final String PROGRESS_BAR = "progress-bar"; 106 public static final String SUCCESS_PROGRESS_BAR = "progress-bar-success"; 107 public static final String WARNING_PROGRESS_BAR = "progress-bar-warning"; 108 public static final String INFO_PROGRESS_BAR = "progress-bar-info"; 109 public static final String EMPTY_PROGRESS_BAR = "progress-bar-empty"; 110 public static final String STEP_LABEL = "uif-step"; 111 public static final String ACTIVE = "active"; 112 public static final String COMPLETE = "complete"; 113 } 114 115 public static class Tabs { 116 public static final String TABS_LEFT = "tabs-left"; 117 public static final String TABS_RIGHT = "tabs-right"; 118 public static final String TABS_BOTTOM = "tabs-below"; 119 } 120 121 public static class CssGrid { 122 public static final String CONTAINER = "container"; 123 public static final String ROW = "row"; 124 125 public static final String XS_COL_PREFIX = "col-xs-"; 126 public static final String SM_COL_PREFIX = "col-sm-"; 127 public static final String MD_COL_PREFIX = "col-md-"; 128 public static final String LG_COL_PREFIX = "col-lg-"; 129 130 public static final String SM_OFFSET_PREFIX = "col-sm-offset-"; 131 public static final String MD_OFFSET_PREFIX = "col-md-offset-"; 132 public static final String LG_OFFSET_PREFIX = "col-lg-offset-"; 133 134 public static final String XS_FLOAT_RIGHT = "xs-float-right"; 135 public static final String SM_FLOAT_RIGHT = "sm-float-right"; 136 public static final String MD_FLOAT_RIGHT = "md-float-right"; 137 public static final String LG_FLOAT_RIGHT = "lg-float-right"; 138 139 public static final String XS_CLEAR_LEFT = "xs-clear-left"; 140 public static final String SM_CLEAR_LEFT = "sm-clear-left"; 141 public static final String MD_CLEAR_LEFT = "md-clear-left"; 142 public static final String LG_CLEAR_LEFT = "lg-clear-left"; 143 } 144}