001 /* 002 * Licensed under the Apache License, Version 2.0 (the "License"); 003 * you may not use this file except in compliance with the License. 004 * You may obtain a copy of the License at 005 * 006 * http://www.apache.org/licenses/LICENSE-2.0 007 * 008 * Unless required by applicable law or agreed to in writing, software 009 * distributed under the License is distributed on an "AS IS" BASIS, 010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 011 * See the License for the specific language governing permissions and 012 * limitations under the License. 013 * 014 * See the NOTICE file distributed with this work for additional 015 * information regarding copyright ownership. 016 */ 017 018 package com.osbcp.css; 019 020 import java.io.File; 021 import java.io.Serializable; 022 import java.util.HashMap; 023 import java.util.Map; 024 025 import com.osbcp.css.constants.BackgroundAttachment; 026 import com.osbcp.css.constants.BackgroundPosition; 027 import com.osbcp.css.constants.BackgroundRepeat; 028 import com.osbcp.css.constants.BorderStyle; 029 import com.osbcp.css.constants.BorderWidth; 030 import com.osbcp.css.constants.Clear; 031 import com.osbcp.css.constants.Cursor; 032 import com.osbcp.css.constants.Display; 033 import com.osbcp.css.constants.Float; 034 import com.osbcp.css.constants.FontStyle; 035 import com.osbcp.css.constants.FontVariant; 036 import com.osbcp.css.constants.FontWeight; 037 import com.osbcp.css.constants.ListStylePosition; 038 import com.osbcp.css.constants.ListStyleType; 039 import com.osbcp.css.constants.OutlineStyle; 040 import com.osbcp.css.constants.OutlineWidth; 041 import com.osbcp.css.constants.Overflow; 042 import com.osbcp.css.constants.Position; 043 import com.osbcp.css.constants.PseudoSelector; 044 import com.osbcp.css.constants.TextAlign; 045 import com.osbcp.css.constants.TextDecoration; 046 import com.osbcp.css.constants.TextDirection; 047 import com.osbcp.css.constants.TextTransform; 048 import com.osbcp.css.constants.VerticalAlign; 049 import com.osbcp.css.constants.Visibility; 050 import com.osbcp.css.constants.WhiteSpace; 051 import com.osbcp.css.unit.AUTO; 052 import com.osbcp.css.unit.CM; 053 import com.osbcp.css.unit.EM; 054 import com.osbcp.css.unit.EX; 055 import com.osbcp.css.unit.IN; 056 import com.osbcp.css.unit.MM; 057 import com.osbcp.css.unit.PC; 058 import com.osbcp.css.unit.PCT; 059 import com.osbcp.css.unit.PT; 060 import com.osbcp.css.unit.PX; 061 import com.osbcp.css.unit.Unit; 062 063 /** 064 * Java representation of CSS which can be exported to a stylesheet file. 065 * 066 * @author <a href="mailto:christoffer@christoffer.me">Christoffer Pettersson</a> 067 */ 068 069 public class CSS implements Serializable { 070 071 private static final long serialVersionUID = 1L; 072 073 private Map<String, Serializable> values; 074 private AttributeSelector attributeSelector; 075 private Map<PseudoSelector, CSS> pseudoSelectors; 076 077 /* 078 * ************************************************************************************************************************* * 079 * * 080 * Constructors * 081 * * 082 * ************************************************************************************************************************* * 083 */ 084 085 /** 086 * Constructor that creates a new CSS instance. 087 */ 088 089 public CSS() { 090 this(new HashMap<String, Serializable>(), null, new HashMap<PseudoSelector, CSS>()); 091 } 092 093 /** 094 * Constructor that creates a new CSS instance with a given sheet with attributes. 095 * 096 * @param values A map of property values selectors that should be inserted. 097 * @param attributeSelector If any attribute selector should be used. 098 * @see <a href="http://www.w3schools.com/css/css_attribute_selectors.asp">CSS Attribute Selectors</a> 099 * @param pseudoSelectors A map of pseudo selectors that should be inserted. 100 */ 101 102 private CSS(final Map<String, Serializable> values, final AttributeSelector attributeSelector, final Map<PseudoSelector, CSS> pseudoSelectors) { 103 this.values = values; 104 this.attributeSelector = attributeSelector; 105 this.pseudoSelectors = pseudoSelectors; 106 } 107 108 /* 109 * ************************************************************************************************************************* * 110 * * 111 * Core methods * 112 * * 113 * ************************************************************************************************************************* * 114 */ 115 116 /** 117 * Returns the class name for the CSS, based on the declared attributes. This class name is also used when creating a CSS block. 118 * 119 * @return The class name for the CSS, based on the declared attributes. 120 */ 121 122 public String getClassName() { 123 return "c" + StringUtil.md5(toString()); 124 } 125 126 /** 127 * Copies the current CSS object to a new CSS object. 128 * 129 * @return The current CSS object to a new CSS object. 130 */ 131 132 public CSS copy() { 133 Map<String, Serializable> newSheet = new HashMap<String, Serializable>(values); 134 Map<PseudoSelector, CSS> newPseudoSelectors = new HashMap<PseudoSelector, CSS>(pseudoSelectors); 135 return new CSS(newSheet, attributeSelector, newPseudoSelectors); 136 } 137 138 /** 139 * Clears a specific CSS attribute. 140 * 141 * @param key The CSS attribute name to be cleared 142 * @return The current CSS object 143 */ 144 145 public CSS clear(final String key) { 146 values.remove(key); 147 return this; 148 } 149 150 /** 151 * Returns all the current declared CSS attributes. 152 * 153 * @return All the current declared CSS attributes. 154 */ 155 156 public Map<String, Serializable> getSheet() { 157 return values; 158 } 159 160 /** 161 * Sets the attribute selector. 162 * 163 * @param attribute The attribute. 164 * @see <a href="http://www.w3schools.com/css/css_attribute_selectors.asp">CSS Attribute Selectors</a> 165 */ 166 167 public void setAttributeSelector(final Serializable attribute) { 168 setAttributeSelector(attribute, null); 169 } 170 171 /** 172 * Sets the attribute selector. 173 * 174 * @param attribute The attribute. 175 * @param value The value. 176 * @see <a href="http://www.w3schools.com/css/css_attribute_selectors.asp">CSS Attribute Selectors</a> 177 */ 178 179 public void setAttributeSelector(final Serializable attribute, final Serializable value) { 180 attributeSelector = new AttributeSelector(attribute, value); 181 } 182 183 /** 184 * Exports all the CSS declared in a specific class to a specific file. 185 * 186 * @param stylesheetClass The class that contains the declared CSS fields. 187 * @param stylesheetFile The output file to be created and written to. 188 * @param includeComments True if comments should be written as well. 189 * @throws Exception If any error occurs 190 */ 191 192 public static void export(final Class<?> stylesheetClass, final File stylesheetFile, boolean includeComments) throws Exception { 193 Exporter.export(stylesheetClass, stylesheetFile, includeComments); 194 } 195 196 /** 197 * Adds a property and value. 198 * 199 * @param property Property to add. 200 * @param value Property value to add. 201 * @return The current CSS object. 202 */ 203 204 private CSS put(final String property, final Serializable value) { 205 values.put(property, value); 206 return this; 207 } 208 209 /** 210 * Returns the CSS properties in a structured block, for example: 211 * 212 * <pre> 213 * #4cafc7ba191a3557d9fe40b67957dbaa { 214 * background-color: color; 215 * } 216 * </pre> 217 * 218 * @return The CSS in a structured block 219 */ 220 221 public String toStringBlock() { 222 223 String attributeSelectorString = attributeSelector == null ? "" : attributeSelector.toString(); 224 225 StringBuilder output = new StringBuilder(""); 226 227 output.append("." + this.getClassName() + attributeSelectorString + " {\n"); 228 229 for (final Map.Entry<String, Serializable> entry : values.entrySet()) { 230 output.append(" " + entry.getKey() + ": " + entry.getValue().toString() + ";\n"); 231 } 232 233 output.append("}\n\n"); 234 235 /* 236 * Print out any attached psuedo selectors 237 */ 238 239 for (final Map.Entry<PseudoSelector, CSS> entry : pseudoSelectors.entrySet()) { 240 241 PseudoSelector pseudoSelector = entry.getKey(); 242 CSS psuedoCSS = entry.getValue(); 243 String attributeSelectorStringInner = attributeSelector == null ? "" : attributeSelector.toString(); 244 245 output.append("." + this.getClassName() + ":" + pseudoSelector + attributeSelectorStringInner + " {\n"); 246 247 for (final Map.Entry<String, Serializable> pseudoEntry : psuedoCSS.getSheet().entrySet()) { 248 output.append(" " + pseudoEntry.getKey() + ": " + pseudoEntry.getValue() + ";\n"); 249 } 250 251 output.append("}\n\n"); 252 253 } 254 255 return output.toString(); 256 } 257 258 /** 259 * Returns the CSS properties on a single row, for example: 260 * 261 * <pre> 262 * background-color: color; text-align: right; color: blue; 263 * </pre> 264 * 265 * @return The CSS properties on a single row, for example: 266 */ 267 268 public String toString() { 269 270 StringBuilder output = new StringBuilder(""); 271 272 for (final Map.Entry<String, Serializable> entry : values.entrySet()) { 273 output.append(entry.getKey() + ": " + entry.getValue().toString() + "; "); 274 } 275 276 return output.toString().trim(); 277 } 278 279 /* 280 * ************************************************************************************************************************* * 281 * * 282 * Unit methods * 283 * * 284 * ************************************************************************************************************************* * 285 */ 286 287 /** 288 * Convenient variable that represents the AUTO unit 289 */ 290 291 public static AUTO AUTO = new AUTO(); 292 293 /** 294 * Creates a new centimeter (cm) CSS unit. 295 * 296 * @param length The numeric length value. 297 * @return A new centimeter (cm) CSS unit. 298 * @see <a href="http://w3schools.com/cssref/css_units.asp">CSS Units</a> 299 */ 300 301 public static CM CM(final int length) { 302 return new CM(length); 303 } 304 305 /** 306 * Creates a new em CSS unit. 307 * 308 * @param length The numeric length value. 309 * @return A new em CSS unit. 310 * @see <a href="http://w3schools.com/cssref/css_units.asp">CSS Units</a> 311 */ 312 313 public static EM EM(final int length) { 314 return new EM(length); 315 } 316 317 /** 318 * Creates a new ex CSS unit. 319 * 320 * @param length The numeric length value. 321 * @return A new ex CSS unit. 322 * @see <a href="http://w3schools.com/cssref/css_units.asp">CSS Units</a> 323 */ 324 325 public static EX EX(final int length) { 326 return new EX(length); 327 } 328 329 /** 330 * Creates a new inch (in) CSS unit. 331 * 332 * @param length The numeric length value. 333 * @return A new inch (in) CSS unit. 334 * @see <a href="http://w3schools.com/cssref/css_units.asp">CSS Units</a> 335 */ 336 337 public static IN IN(final int length) { 338 return new IN(length); 339 } 340 341 /** 342 * Creates a new millimeter (mm) CSS unit. 343 * 344 * @param length The numeric length value. 345 * @return A new millimeter (mm) CSS unit. 346 * @see <a href="http://w3schools.com/cssref/css_units.asp">CSS Units</a> 347 */ 348 349 public static MM MM(final int length) { 350 return new MM(length); 351 } 352 353 /** 354 * Creates a new pica (pc) CSS unit. 355 * 356 * @param length The numeric length value. 357 * @return A new pica (pc) CSS unit. 358 * @see <a href="http://w3schools.com/cssref/css_units.asp">CSS Units</a> 359 */ 360 361 public static PC PC(final int length) { 362 return new PC(length); 363 } 364 365 /** 366 * Creates a new percent (%) CSS unit. 367 * 368 * @param length The numeric length value. 369 * @return A new percent (%) CSS unit. 370 * @see <a href="http://w3schools.com/cssref/css_units.asp">CSS Units</a> 371 */ 372 373 public static PCT PCT(final int length) { 374 return new PCT(length); 375 } 376 377 /** 378 * Creates a new point (pt) CSS unit. 379 * 380 * @param length The numeric length value. 381 * @return A new point (pt) CSS unit. 382 * @see <a href="http://w3schools.com/cssref/css_units.asp">CSS Units</a> 383 */ 384 385 public static PT PT(final int length) { 386 return new PT(length); 387 } 388 389 /** 390 * Creates a new pixel (px) CSS unit. 391 * 392 * @param length The numeric length value. 393 * @return A new pixel (px) CSS unit. 394 * @see <a href="http://w3schools.com/cssref/css_units.asp">CSS Units</a> 395 */ 396 397 public static PX PX(final int length) { 398 return new PX(length); 399 } 400 401 /* 402 * ************************************************************************************************************************* * 403 * * 404 * Attribute methods * 405 * * 406 * ************************************************************************************************************************* * 407 */ 408 409 /* 410 * 411 * Pseudo selectors 412 * 413 */ 414 415 /** 416 * Adds a pseudo selector to the current CSS. 417 * 418 * @param pseudoSelector The pseudo selector the CSS should add. 419 * @param css The CSS associated with the pseudo selector. 420 * @return The current CSS object. 421 * @see <a href="http://www.w3schools.com/css/css_pseudo_classes.asp">CSS Pseudo-classes</a> 422 */ 423 424 public CSS addPseudoSelector(final PseudoSelector pseudoSelector, final CSS css) { 425 this.pseudoSelectors.put(pseudoSelector, css); 426 return this; 427 } 428 429 /* 430 * 431 * Background 432 * 433 */ 434 435 /** 436 * Sets the <i>background</i> property. 437 * 438 * @param color The color value to be set. 439 * @param url The url value to be set. 440 * @param repeat The repeat value to be set. 441 * @param position The position value to be set. 442 * @return The current CSS object. 443 * @see <a href="http://www.w3schools.com/css/css_background.asp">CSS Background</a> 444 */ 445 446 public CSS setBackground(final Serializable color, final Serializable url, final BackgroundRepeat repeat, final BackgroundPosition position) { 447 return put("background", color + " url(" + url + ") " + repeat + " " + position); 448 } 449 450 /** 451 * Sets the <i>background-color</i> property. 452 * 453 * @param color The color value to be set. 454 * @return The current CSS object. 455 * @see <a href="http://www.w3schools.com/cssref/pr_background-color.asp">CSS background-color Property</a> 456 */ 457 458 public CSS setBackgroundColor(final Serializable color) { 459 return put("background-color", color); 460 } 461 462 /** 463 * Sets the <i>background-image</i> property. 464 * 465 * @param url The url value to be set. 466 * @return The current CSS object. 467 * @see <a href="http://www.w3schools.com/cssref/pr_background-image.asp">CSS background-image Property</a> 468 */ 469 470 public CSS setBackgroundImage(final Serializable url) { 471 return put("background-image", "url(" + url + ")"); 472 } 473 474 /** 475 * Sets the <i>background-repeat</i> property. 476 * 477 * @param repeat The repeat value to be set. 478 * @return The current CSS object. 479 * @see <a href="http://www.w3schools.com/cssref/pr_background-repeat.asp">CSS background-repeat Property</a> 480 */ 481 482 public CSS setBackgroundRepeat(final BackgroundRepeat repeat) { 483 return put("background-repeat", repeat); 484 } 485 486 /** 487 * Sets the <i>background-attachment</i> property. 488 * 489 * @param attachment The attachment value to be set. 490 * @return The current CSS object. 491 * @see <a href="http://www.w3schools.com/cssref/pr_background-attachment.asp">CSS background-attachment Property</a> 492 */ 493 494 public CSS setBackgroundAttachment(final BackgroundAttachment attachment) { 495 return put("background-attachment", attachment); 496 } 497 498 /** 499 * Sets the <i>background-position</i> property. 500 * 501 * @param position The position value to be set. 502 * @return The current CSS object. 503 * @see <a href="http://www.w3schools.com/cssref/pr_background-position.asp">CSS background-position Property</a> 504 */ 505 506 public CSS setBackgroundPosition(final BackgroundPosition position) { 507 return put("background-position", position); 508 } 509 510 /** 511 * Sets the <i>background-position</i> property. 512 * 513 * @param xpos The horizontal position. 514 * @param ypos The vertical position. 515 * @return The current CSS object. 516 * @see <a href="http://www.w3schools.com/cssref/pr_background-position.asp">CSS background-position Property</a> 517 */ 518 519 public CSS setBackgroundPosition(final Unit xpos, final Unit ypos) { 520 return put("background-position", xpos + " " + ypos); 521 } 522 523 /* 524 * Text 525 */ 526 527 /** 528 * Sets the <i>color</i> property. 529 * 530 * @param color The color value to be set. 531 * @return The current CSS object. 532 * @see <a href="http://www.w3schools.com/cssref/css_colors.asp">CSS Colors</a> 533 */ 534 535 public CSS setColor(final Serializable color) { 536 return put("color", color); 537 } 538 539 /** 540 * Sets the <i>text-align</i> property. 541 * 542 * @param alignment The alignment value to be set. 543 * @return The current CSS object. 544 * @see <a href="http://www.w3schools.com/cssref/pr_text_text-align.asp">CSS text-align Property</a> 545 */ 546 547 public CSS setTextAlign(final TextAlign alignment) { 548 return put("text-align", alignment); 549 } 550 551 /** 552 * Sets the <i>direction</i> property. 553 * 554 * @param direction The direction value to be set. 555 * @return The current CSS object. 556 * @see <a href="http://www.w3schools.com/cssref/pr_text_direction.asp">CSS direction Property</a> 557 */ 558 559 public CSS setDirection(final TextDirection direction) { 560 return put("direction", direction); 561 } 562 563 /** 564 * Sets the <i>letter-spacing</i> property. 565 * 566 * @param spacing The spacing value to be set. 567 * @return The current CSS object. 568 * @see <a href="http://www.w3schools.com/cssref/pr_text_letter-spacing.asp">CSS letter-spacing Property</a> 569 */ 570 571 public CSS setLetterSpacing(final Unit spacing) { 572 return put("letter-spacing", spacing); 573 } 574 575 /** 576 * Sets the <i>line-height</i> property. 577 * 578 * @param height The height value to be set. 579 * @return The current CSS object. 580 * @see <a href="http://www.w3schools.com/cssref/pr_dim_line-height.asp">CSS line-height Property</a> 581 */ 582 583 public CSS setLineHeight(final Unit height) { 584 return put("line-height", height); 585 } 586 587 /** 588 * Sets the <i>text-decoration</i> property. 589 * 590 * @param decoration The decoration value to be set. 591 * @return The current CSS object. 592 * @see <a href="http://www.w3schools.com/cssref/pr_text_text-decoration.asp">CSS text-decoration Property</a> 593 */ 594 595 public CSS setTextDecoration(final TextDecoration decoration) { 596 return put("text-decoration", decoration); 597 } 598 599 /** 600 * Sets the <i>text-indent</i> property. 601 * 602 * @param indent The indent value to be set. 603 * @return The current CSS object. 604 * @see <a href="http://www.w3schools.com/cssref/pr_text_text-indent.asp">CSS text-indent Property</a> 605 */ 606 607 public CSS setTextIndent(final Unit indent) { 608 return put("text-indent", indent); 609 } 610 611 /** 612 * Sets the <i>text-shadow</i> property. 613 * 614 * @param hShadow The horizontal shadow value to be set. 615 * @param vShadow The vertical shadow value to be set. 616 * @param blur The blue value to be set. 617 * @param color The color value to be set. 618 * @return The current CSS object. 619 * @see <a href="http://www.w3schools.com/cssref/css3_pr_text-shadow.asp">CSS text-shadow Property</a> 620 */ 621 622 public CSS setTextShadow(final Unit hShadow, final Unit vShadow, final Unit blur, final Serializable color) { 623 return put("text-shadow", hShadow + " " + vShadow + " " + blur + " " + color); 624 } 625 626 /** 627 * Sets the <i>text-transform</i> property. 628 * 629 * @param transform The transform value to be set. 630 * @return The current CSS object. 631 * @see <a href="http://www.w3schools.com/cssref/pr_text_text-transform.asp">CSS text-transform Property</a> 632 */ 633 634 public CSS setTextTransform(final TextTransform transform) { 635 return put("text-transform", transform); 636 } 637 638 /** 639 * Sets the <i>vertical-align</i> property. 640 * 641 * @param alignment The alignment value to be set. 642 * @return The current CSS object. 643 * @see <a href="http://www.w3schools.com/cssref/pr_pos_vertical-align.asp">CSS vertical-align Property</a> 644 */ 645 646 public CSS setVerticalAlign(final VerticalAlign alignment) { 647 return put("vertical-align", alignment); 648 } 649 650 /** 651 * Sets the <i>vertical-align</i> property. 652 * 653 * @param alignment The alignment value to be set. 654 * @return The current CSS object. 655 * @see <a href="http://www.w3schools.com/cssref/pr_pos_vertical-align.asp">CSS vertical-align Property</a> 656 */ 657 658 public CSS setVerticalAlign(final Unit alignment) { 659 return put("vertical-align", alignment); 660 } 661 662 /** 663 * Sets the <i>white-space</i> property. 664 * 665 * @param space The space value to be set. 666 * @return The current CSS object. 667 * @see <a href="http://www.w3schools.com/cssref/pr_text_white-space.asp">CSS white-space Property</a> 668 */ 669 670 public CSS setWhiteSpace(final WhiteSpace space) { 671 return put("white-space", space); 672 } 673 674 /** 675 * Sets the <i>word-spacing</i> property. 676 * 677 * @param spacing The spacing value to be set. 678 * @return The current CSS object. 679 * @see <a href="http://www.w3schools.com/cssref/pr_text_word-spacing.asp">CSS word-spacing Property</a> 680 */ 681 682 public CSS setWordSpacing(final Unit spacing) { 683 return put("word-spacing", spacing); 684 } 685 686 /* 687 * Font 688 */ 689 690 /** 691 * Sets the <i>font-family</i> property. 692 * 693 * @param family The family value to be set. 694 * @return The current CSS object. 695 * @see <a href="http://www.w3schools.com/cssref/pr_font_font-family.asp">CSS font-family Property</a> 696 */ 697 698 public CSS setFontFamily(final Serializable family) { 699 return put("font-family", family); 700 } 701 702 /** 703 * Sets the <i>font-size</i> property. 704 * 705 * @param size The family value to be set. 706 * @return The current CSS object. 707 * @see <a href="http://www.w3schools.com/cssref/pr_font_font-size.asp">CSS font-size Property</a> 708 */ 709 710 public CSS setFontSize(final Unit size) { 711 return put("font-size", size); 712 } 713 714 /** 715 * Sets the <i>font-style</i> property. 716 * 717 * @param style The style value to be set. 718 * @return The current CSS object. 719 * @see <a href="http://www.w3schools.com/cssref/pr_font_font-style.asp">CSS font-style Property</a> 720 */ 721 722 public CSS setFontStyle(final FontStyle style) { 723 return put("font-style", style); 724 } 725 726 /** 727 * Sets the <i>font-variant</i> property. 728 * 729 * @param variant The variant value to be set. 730 * @return The current CSS object. 731 * @see <a href="http://www.w3schools.com/cssref/pr_font_font-variant.asp">CSS font-variant Property</a> 732 */ 733 734 public CSS setFontVariant(final FontVariant variant) { 735 return put("font-variant", variant); 736 } 737 738 /** 739 * Sets the <i>font-weight</i> property. 740 * 741 * @param weight The weight value to be set. 742 * @return The current CSS object. 743 * @see <a href="http://www.w3schools.com/cssref/pr_font_font-weight.asp">CSS font-weight Property</a> 744 */ 745 746 public CSS setFontWeight(final FontWeight weight) { 747 return put("font-weight", weight); 748 } 749 750 /* 751 * List 752 */ 753 754 /** 755 * Sets the <i>list-style-type</i> property. 756 * 757 * @param type The type value to be set. 758 * @return The current CSS object. 759 * @see <a href="http://www.w3schools.com/cssref/pr_list-style-type.asp">CSS list-style-type Property</a> 760 */ 761 762 public CSS setListStyleType(final ListStyleType type) { 763 return put("list-style-type", type); 764 } 765 766 /** 767 * Sets the <i>list-style-position</i> property. 768 * 769 * @param position The position value to be set. 770 * @return The current CSS object. 771 * @see <a href="http://www.w3schools.com/cssref/pr_list-style-position.asp">CSS list-style-position Property</a> 772 */ 773 774 public CSS setListStylePosition(final ListStylePosition position) { 775 return put("list-style-position", position); 776 } 777 778 /** 779 * Sets the <i>list-style-image</i> property. 780 * 781 * @param url The url value to be set. 782 * @return The current CSS object. 783 * @see <a href="http://www.w3schools.com/cssref/pr_list-style-image.asp">CSS list-style-image Property</a> 784 */ 785 786 public CSS setListStyleImage(final Serializable url) { 787 return put("list-style-image", url); 788 } 789 790 /* 791 * Border 792 */ 793 794 /** 795 * Sets the <i>border</i> property. 796 * 797 * @param width The position value to be set. 798 * @param style The style value to be set. 799 * @param color The color value to be set. 800 * @return The current CSS object. 801 * @see <a href="http://www.w3schools.com/cssref/pr_border.asp">CSS border Property</a> 802 */ 803 804 public CSS setBorder(final Unit width, final BorderStyle style, final Serializable color) { 805 return put("border", width + " " + style + " " + color); 806 } 807 808 /** 809 * Sets the <i>border</i> property. 810 * 811 * @param width The position value to be set. 812 * @param style The style value to be set. 813 * @param color The color value to be set. 814 * @return The current CSS object. 815 * @see <a href="http://www.w3schools.com/cssref/pr_border.asp">CSS border Property</a> 816 */ 817 818 public CSS setBorder(final BorderWidth width, final BorderStyle style, final Serializable color) { 819 return put("border", width + " " + style + " " + color); 820 } 821 822 /** 823 * Sets the <i>border-width</i> property. 824 * 825 * @param width The width value to be set. 826 * @return The current CSS object. 827 * @see <a href="http://www.w3schools.com/cssref/pr_border-width.asp">CSS border-width Property</a> 828 */ 829 830 public CSS setBorderWidth(final Unit width) { 831 return put("border-width", width); 832 } 833 834 /** 835 * Sets the <i>border-width</i> property. 836 * 837 * @param width The width value to be set. 838 * @return The current CSS object. 839 * @see <a href="http://www.w3schools.com/cssref/pr_border-width.asp">CSS border-width Property</a> 840 */ 841 842 public CSS setBorderWidth(final BorderWidth width) { 843 return put("border-width", width); 844 } 845 846 /** 847 * Sets the <i>border-style</i> property. 848 * 849 * @param style The style value to be set. 850 * @return The current CSS object. 851 * @see <a href="http://www.w3schools.com/cssref/pr_border-style.asp">CSS border-style Property</a> 852 */ 853 854 public CSS setBorderStyle(final BorderStyle style) { 855 return put("border-style", style); 856 } 857 858 /** 859 * Sets the <i>border-color</i> property. 860 * 861 * @param color The color value to be set. 862 * @return The current CSS object. 863 * @see <a href="http://www.w3schools.com/cssref/pr_border-color.asp">CSS border-color Property</a> 864 */ 865 866 public CSS setBorderColor(final Serializable color) { 867 return put("border-color", color); 868 } 869 870 // ----- TOP ----- 871 872 /** 873 * Sets the <i>border-top</i> property. 874 * 875 * @param width The width value to be set. 876 * @param style The style value to be set. 877 * @param color The color value to be set. 878 * @return The current CSS object. 879 * @see <a href="http://www.w3schools.com/cssref/pr_border-top.asp">CSS border-top Property</a> 880 */ 881 882 public CSS setBorderTop(final Unit width, final BorderStyle style, final Serializable color) { 883 return put("border-top", width + " " + style + " " + color); 884 } 885 886 /** 887 * Sets the <i>border-top</i> property. 888 * 889 * @param width The width value to be set. 890 * @param style The style value to be set. 891 * @param color The color value to be set. 892 * @return The current CSS object. 893 * @see <a href="http://www.w3schools.com/cssref/pr_border-top.asp">CSS border-top Property</a> 894 */ 895 896 public CSS setBorderTop(final BorderWidth width, final BorderStyle style, final Serializable color) { 897 return put("border-top", width + " " + style + " " + color); 898 } 899 900 /** 901 * Sets the <i>border-top-width</i> property. 902 * 903 * @param width The width value to be set. 904 * @return The current CSS object. 905 * @see <a href="http://www.w3schools.com/cssref/pr_border-top_width.asp">CSS border-top-width Property</a> 906 */ 907 908 public CSS setBorderTopWidth(final Unit width) { 909 return put("border-top-width", width); 910 } 911 912 /** 913 * Sets the <i>border-top-width</i> property. 914 * 915 * @param width The width value to be set. 916 * @return The current CSS object. 917 * @see <a href="http://www.w3schools.com/cssref/pr_border-top_width.asp">CSS border-top-width Property</a> 918 */ 919 920 public CSS setBorderTopWidth(final BorderWidth width) { 921 return put("border-top-width", width); 922 } 923 924 /** 925 * Sets the <i>border-top-style</i> property. 926 * 927 * @param style The style value to be set. 928 * @return The current CSS object. 929 * @see <a href="http://www.w3schools.com/cssref/pr_border-top_style.asp">CSS border-top-style Property</a> 930 */ 931 932 public CSS setBorderTopStyle(final BorderStyle style) { 933 return put("border-top-style", style); 934 } 935 936 /** 937 * Sets the <i>border-top-color</i> property. 938 * 939 * @param color The color value to be set. 940 * @return The current CSS object. 941 * @see <a href="http://www.w3schools.com/cssref/pr_border-top_color.asp">CSS border-top-color Property</a> 942 */ 943 944 public CSS setBorderTopColor(final Serializable color) { 945 return put("border-top-color", color); 946 } 947 948 // ----- RIGHT ----- 949 950 /** 951 * Sets the <i>border-right</i> property. 952 * 953 * @param width The width value to be set. 954 * @param style The style value to be set. 955 * @param color The color value to be set. 956 * @return The current CSS object. 957 * @see <a href="http://www.w3schools.com/cssref/pr_border-right.asp">CSS border-right Property</a> 958 */ 959 960 public CSS setBorderRight(final Unit width, final BorderStyle style, final Serializable color) { 961 return put("border-right", width + " " + style + " " + color); 962 } 963 964 /** 965 * Sets the <i>border-right</i> property. 966 * 967 * @param width The width value to be set. 968 * @param style The style value to be set. 969 * @param color The color value to be set. 970 * @return The current CSS object. 971 * @see <a href="http://www.w3schools.com/cssref/pr_border-right.asp">CSS border-right Property</a> 972 */ 973 974 public CSS setBorderRight(final BorderWidth width, final BorderStyle style, final Serializable color) { 975 return put("border-right", width + " " + style + " " + color); 976 } 977 978 /** 979 * Sets the <i>border-right-width</i> property. 980 * 981 * @param width The width value to be set. 982 * @return The current CSS object. 983 * @see <a href="http://www.w3schools.com/cssref/pr_border-right_width.asp">CSS border-right-width Property</a> 984 */ 985 986 public CSS setBorderRightWidth(final Unit width) { 987 return put("border-right-width", width); 988 } 989 990 /** 991 * Sets the <i>border-right-width</i> property. 992 * 993 * @param width The width value to be set. 994 * @return The current CSS object. 995 * @see <a href="http://www.w3schools.com/cssref/pr_border-right_width.asp">CSS border-right-width Property</a> 996 */ 997 998 public CSS setBorderRightWidth(final BorderWidth width) { 999 return put("border-right-width", width); 1000 } 1001 1002 /** 1003 * Sets the <i>border-right-style</i> property. 1004 * 1005 * @param style The style value to be set. 1006 * @return The current CSS object. 1007 * @see <a href="http://www.w3schools.com/cssref/pr_border-right_style.asp">CSS border-right-style Property</a> 1008 */ 1009 1010 public CSS setBorderRightStyle(final BorderStyle style) { 1011 return put("border-right-style", style); 1012 } 1013 1014 /** 1015 * Sets the <i>border-right-color</i> property. 1016 * 1017 * @param color The color value to be set. 1018 * @return The current CSS object. 1019 * @see <a href="http://www.w3schools.com/cssref/pr_border-right_color.asp">CSS border-right-color Property</a> 1020 */ 1021 1022 public CSS setBorderRightColor(final Serializable color) { 1023 return put("border-right-color", color); 1024 } 1025 1026 // ----- LEFT ----- 1027 1028 /** 1029 * Sets the <i>border-left</i> property. 1030 * 1031 * @param width The width value to be set. 1032 * @param style The style value to be set. 1033 * @param color The color value to be set. 1034 * @return The current CSS object. 1035 * @see <a href="http://www.w3schools.com/cssref/pr_border-left.asp">CSS border-left Property</a> 1036 */ 1037 1038 public CSS setBorderLEft(final Unit width, final BorderStyle style, final Serializable color) { 1039 return put("border-left", width + " " + style + " " + color); 1040 } 1041 1042 /** 1043 * Sets the <i>border-left</i> property. 1044 * 1045 * @param width The width value to be set. 1046 * @param style The style value to be set. 1047 * @param color The color value to be set. 1048 * @return The current CSS object. 1049 * @see <a href="http://www.w3schools.com/cssref/pr_border-left.asp">CSS border-left Property</a> 1050 */ 1051 1052 public CSS setBorderLeft(final BorderWidth width, final BorderStyle style, final Serializable color) { 1053 return put("border-left", width + " " + style + " " + color); 1054 } 1055 1056 /** 1057 * Sets the <i>border-left-width</i> property. 1058 * 1059 * @param width The width value to be set. 1060 * @return The current CSS object. 1061 * @see <a href="http://www.w3schools.com/cssref/pr_border-left_width.asp">CSS border-left-width Property</a> 1062 */ 1063 1064 public CSS setBorderLeftWidth(final Unit width) { 1065 return put("border-left-width", width); 1066 } 1067 1068 /** 1069 * Sets the <i>border-left-width</i> property. 1070 * 1071 * @param width The width value to be set. 1072 * @return The current CSS object. 1073 * @see <a href="http://www.w3schools.com/cssref/pr_border-left_width.asp">CSS border-left-width Property</a> 1074 */ 1075 1076 public CSS setBorderLeftWidth(final BorderWidth width) { 1077 return put("border-left-width", width); 1078 } 1079 1080 /** 1081 * Sets the <i>border-left-style</i> property. 1082 * 1083 * @param style The style value to be set. 1084 * @return The current CSS object. 1085 * @see <a href="http://www.w3schools.com/cssref/pr_border-left_style.asp">CSS border-left-style Property</a> 1086 */ 1087 1088 public CSS setBorderLeftStyle(final BorderStyle style) { 1089 return put("border-left-style", style); 1090 } 1091 1092 /** 1093 * Sets the <i>border-left-color</i> property. 1094 * 1095 * @param color The color value to be set. 1096 * @return The current CSS object. 1097 * @see <a href="http://www.w3schools.com/cssref/pr_border-left_color.asp">CSS border-left-color Property</a> 1098 */ 1099 1100 public CSS setBorderLeftColor(final Serializable color) { 1101 return put("border-left-color", color); 1102 } 1103 1104 // ----- BOTTOM ----- 1105 1106 /** 1107 * Sets the <i>border-bottom</i> property. 1108 * 1109 * @param width The width value to be set. 1110 * @param style The style value to be set. 1111 * @param color The color value to be set. 1112 * @return The current CSS object. 1113 * @see <a href="http://www.w3schools.com/cssref/pr_border-bottom.asp">CSS border-bottom Property</a> 1114 */ 1115 1116 public CSS setBorderBottom(final Unit width, final BorderStyle style, final Serializable color) { 1117 return put("border-bottom", width + " " + style + " " + color); 1118 } 1119 1120 /** 1121 * Sets the <i>border-bottom</i> property. 1122 * 1123 * @param width The width value to be set. 1124 * @param style The style value to be set. 1125 * @param color The color value to be set. 1126 * @return The current CSS object. 1127 * @see <a href="http://www.w3schools.com/cssref/pr_border-bottom.asp">CSS border-bottom Property</a> 1128 */ 1129 1130 public CSS setBorderBottom(final BorderWidth width, final BorderStyle style, final Serializable color) { 1131 return put("border-bottom", width + " " + style + " " + color); 1132 } 1133 1134 /** 1135 * Sets the <i>border-bottom-width</i> property. 1136 * 1137 * @param width The width value to be set. 1138 * @return The current CSS object. 1139 * @see <a href="http://www.w3schools.com/cssref/pr_border-bottom_width.asp">CSS border-bottom-width Property</a> 1140 */ 1141 1142 public CSS setBorderBottomWidth(final Unit width) { 1143 return put("border-bottom-width", width); 1144 } 1145 1146 /** 1147 * Sets the <i>border-bottom-width</i> property. 1148 * 1149 * @param width The width value to be set. 1150 * @return The current CSS object. 1151 * @see <a href="http://www.w3schools.com/cssref/pr_border-bottom_width.asp">CSS border-bottom-width Property</a> 1152 */ 1153 1154 public CSS setBorderBottomWidth(final BorderWidth width) { 1155 return put("border-bottom-width", width); 1156 } 1157 1158 /** 1159 * Sets the <i>border-bottom-style</i> property. 1160 * 1161 * @param style The style value to be set. 1162 * @return The current CSS object. 1163 * @see <a href="http://www.w3schools.com/cssref/pr_border-bottom_style.asp">CSS border-bottom-style Property</a> 1164 */ 1165 1166 public CSS setBorderBottomStyle(final BorderStyle style) { 1167 return put("border-bottom-style", style); 1168 } 1169 1170 /** 1171 * Sets the <i>border-bottom-color</i> property. 1172 * 1173 * @param color The color value to be set. 1174 * @return The current CSS object. 1175 * @see <a href="http://www.w3schools.com/cssref/pr_border-bottom_color.asp">CSS border-bottom-color Property</a> 1176 */ 1177 1178 public CSS setBorderBottomColor(final Serializable color) { 1179 return put("border-bottom-color", color); 1180 } 1181 1182 /* 1183 * Outline 1184 */ 1185 1186 /** 1187 * Sets the <i>outline</i> property. 1188 * 1189 * @param color The color value to be set. 1190 * @param style The style value to be set. 1191 * @param width The width value to be set. 1192 * @return The current CSS object. 1193 * @see <a href="http://www.w3schools.com/cssref/pr_outline.asp">CSS outline Property</a> 1194 */ 1195 1196 public CSS setOutline(final Serializable color, final OutlineStyle style, final Unit width) { 1197 return put("outline", color + " " + style + " " + width); 1198 } 1199 1200 /** 1201 * Sets the <i>outline</i> property. 1202 * 1203 * @param color The color value to be set. 1204 * @param style The style value to be set. 1205 * @param width The width value to be set. 1206 * @return The current CSS object. 1207 * @see <a href="http://www.w3schools.com/cssref/pr_outline.asp">CSS outline Property</a> 1208 */ 1209 1210 public CSS setOutline(final Serializable color, final OutlineStyle style, final OutlineWidth width) { 1211 return put("outline", color + " " + style + " " + width); 1212 } 1213 1214 /** 1215 * Sets the <i>outline-color</i> property. 1216 * 1217 * @param color The color value to be set. 1218 * @return The current CSS object. 1219 * @see <a href="http://www.w3schools.com/cssref/pr_outline-color.asp">CSS outline-color Property</a> 1220 */ 1221 1222 public CSS setOutlineColor(final Serializable color) { 1223 return put("outline-color", color); 1224 } 1225 1226 /** 1227 * Sets the <i>outline-style</i> property. 1228 * 1229 * @param style The style value to be set. 1230 * @return The current CSS object. 1231 * @see <a href="http://www.w3schools.com/cssref/pr_outline-style.asp">CSS outline-style Property</a> 1232 */ 1233 1234 public CSS setOutlineStyle(final OutlineStyle style) { 1235 return put("outline-style", style); 1236 } 1237 1238 /** 1239 * Sets the <i>outline-width</i> property. 1240 * 1241 * @param width The width value to be set. 1242 * @return The current CSS object. 1243 * @see <a href="http://www.w3schools.com/cssref/pr_outline-width.asp">CSS outline-width Property</a> 1244 */ 1245 1246 public CSS setOutlineWidth(final Unit width) { 1247 return put("outline-width", width); 1248 } 1249 1250 /** 1251 * Sets the <i>outline-width</i> property. 1252 * 1253 * @param width The width value to be set. 1254 * @return The current CSS object. 1255 * @see <a href="http://www.w3schools.com/cssref/pr_outline-width.asp">CSS outline-width Property</a> 1256 */ 1257 1258 public CSS setOutlineStyle(final OutlineWidth width) { 1259 return put("outline-width", width); 1260 } 1261 1262 /* 1263 * Margin 1264 */ 1265 1266 /** 1267 * Sets the <i>margin</i> property. 1268 * 1269 * @param margin The margin value to be set. 1270 * @return The current CSS object. 1271 * @see <a href="http://www.w3schools.com/cssref/pr_margin.asp">CSS margin Property</a> 1272 */ 1273 1274 public CSS setMargin(final Unit margin) { 1275 return put("margin", margin); 1276 } 1277 1278 /** 1279 * Sets the <i>margin</i> property. 1280 * 1281 * @param topBottom The top and bottom values to be set. 1282 * @param rightLeft The right and left values to be set. 1283 * @return The current CSS object. 1284 * @see <a href="http://www.w3schools.com/cssref/pr_margin.asp">CSS margin Property</a> 1285 */ 1286 1287 public CSS setMargin(final Unit topBottom, final Unit rightLeft) { 1288 return put("margin", topBottom + " " + rightLeft); 1289 } 1290 1291 /** 1292 * Sets the <i>margin</i> property. 1293 * 1294 * @param top The top value to be set. 1295 * @param rightLeft The right and left values to be set. 1296 * @param bottom The bottom value to be set. 1297 * @return The current CSS object. 1298 * @see <a href="http://www.w3schools.com/cssref/pr_margin.asp">CSS margin Property</a> 1299 */ 1300 1301 public CSS setMargin(final Unit top, final Unit rightLeft, final Unit bottom) { 1302 return put("margin", top + " " + rightLeft + " " + bottom); 1303 } 1304 1305 /** 1306 * Sets the <i>margin</i> property. 1307 * 1308 * @param top The top value to be set. 1309 * @param right The right value to be set. 1310 * @param bottom The bottom value to be set. 1311 * @param left The left value to be set. 1312 * @return The current CSS object. 1313 * @see <a href="http://www.w3schools.com/cssref/pr_margin.asp">CSS margin Property</a> 1314 */ 1315 1316 public CSS setMargin(final Unit top, final Unit right, final Unit bottom, final Unit left) { 1317 return put("margin", top + " " + right + " " + bottom + " " + left); 1318 } 1319 1320 /** 1321 * Sets the <i>margin-bottom</i> property. 1322 * 1323 * @param margin The margin value to be set. 1324 * @return The current CSS object. 1325 * @see <a href="http://www.w3schools.com/cssref/pr_margin-bottom.asp">CSS margin-bottom Property</a> 1326 */ 1327 1328 public CSS setMarginBottom(final Unit margin) { 1329 return put("margin-bottom", margin); 1330 } 1331 1332 /** 1333 * Sets the <i>margin-left</i> property. 1334 * 1335 * @param margin The margin value to be set. 1336 * @return The current CSS object. 1337 * @see <a href="http://www.w3schools.com/cssref/pr_margin-left.asp">CSS margin-left Property</a> 1338 */ 1339 1340 public CSS setMarginLeft(final Unit margin) { 1341 return put("margin-left", margin); 1342 } 1343 1344 /** 1345 * Sets the <i>margin-right</i> property. 1346 * 1347 * @param margin The margin value to be set. 1348 * @return The current CSS object. 1349 * @see <a href="http://www.w3schools.com/cssref/pr_margin-right.asp">CSS margin-right Property</a> 1350 */ 1351 1352 public CSS setMarginRight(final Unit margin) { 1353 return put("margin-right", margin); 1354 } 1355 1356 /** 1357 * Sets the <i>margin-top</i> property. 1358 * 1359 * @param margin The margin value to be set. 1360 * @return The current CSS object. 1361 * @see <a href="http://www.w3schools.com/cssref/pr_margin-top.asp">CSS margin-top Property</a> 1362 */ 1363 1364 public CSS setMarginTop(final Unit margin) { 1365 return put("margin-top", margin); 1366 } 1367 1368 /* 1369 * Padding 1370 */ 1371 1372 /** 1373 * Sets the <i>padding</i> property. 1374 * 1375 * @param padding The padding value to be set. 1376 * @return The current CSS object. 1377 * @see <a href="http://www.w3schools.com/css/css_padding.asp">CSS Padding</a> 1378 */ 1379 1380 public CSS setPadding(final Unit padding) { 1381 return put("padding", padding); 1382 } 1383 1384 /** 1385 * Sets the <i>padding</i> property. 1386 * 1387 * @param topBottom The top and bottom values to be set. 1388 * @param rightLeft The right and left values to be set. 1389 * @return The current CSS object. 1390 * @see <a href="http://www.w3schools.com/css/css_padding.asp">CSS Padding</a> 1391 */ 1392 1393 public CSS setPadding(final Unit topBottom, final Unit rightLeft) { 1394 return put("padding", topBottom + " " + rightLeft); 1395 } 1396 1397 /** 1398 * Sets the <i>padding</i> property. 1399 * 1400 * @param top The top value to be set. 1401 * @param rightLeft The right and left values to be set. 1402 * @param bottom The bottom value to be set. 1403 * @return The current CSS object. 1404 * @see <a href="http://www.w3schools.com/css/css_padding.asp">CSS Padding</a> 1405 */ 1406 1407 public CSS setPadding(final Unit top, final Unit rightLeft, final Unit bottom) { 1408 return put("padding", top + " " + rightLeft + " " + bottom); 1409 } 1410 1411 /** 1412 * Sets the <i>padding</i> property. 1413 * 1414 * @param top The top value to be set. 1415 * @param right The right value to be set. 1416 * @param bottom The bottom value to be set. 1417 * @param left The left value to be set. 1418 * @return The current CSS object. 1419 * @see <a href="http://www.w3schools.com/css/css_padding.asp">CSS Padding</a> 1420 */ 1421 1422 public CSS setPadding(final Unit top, final Unit right, final Unit bottom, final Unit left) { 1423 return put("padding", top + " " + right + " " + bottom + " " + left); 1424 } 1425 1426 /** 1427 * Sets the <i>padding-bottom</i> property. 1428 * 1429 * @param margin The margin value to be set. 1430 * @return The current CSS object. 1431 * @see <a href="http://www.w3schools.com/cssref/pr_padding-bottom.asp">CSS padding-bottom</a> 1432 */ 1433 1434 public CSS setPaddingBottom(final Unit margin) { 1435 return put("padding-bottom", margin); 1436 } 1437 1438 /** 1439 * Sets the <i>padding-left</i> property. 1440 * 1441 * @param margin The margin value to be set. 1442 * @return The current CSS object. 1443 * @see <a href="http://www.w3schools.com/cssref/pr_padding-left.asp">CSS padding-left</a> 1444 */ 1445 1446 public CSS setPaddingLeft(final Unit margin) { 1447 return put("padding-left", margin); 1448 } 1449 1450 /** 1451 * Sets the <i>padding-right</i> property. 1452 * 1453 * @param margin The margin value to be set. 1454 * @return The current CSS object. 1455 * @see <a href="http://www.w3schools.com/cssref/pr_padding-right.asp">CSS padding-right</a> 1456 */ 1457 1458 public CSS setPaddingRight(final Unit margin) { 1459 return put("padding-right", margin); 1460 } 1461 1462 /** 1463 * Sets the <i>padding-top</i> property. 1464 * 1465 * @param margin The margin value to be set. 1466 * @return The current CSS object. 1467 * @see <a href="http://www.w3schools.com/cssref/pr_padding-top.asp">CSS padding-top</a> 1468 */ 1469 1470 public CSS setPaddingTop(final Unit margin) { 1471 return put("padding-top", margin); 1472 } 1473 1474 /* 1475 * Dimensions 1476 */ 1477 1478 /** 1479 * Sets the <i>width</i> property. 1480 * 1481 * @param width The width value to be set. 1482 * @return The current CSS object. 1483 * @see <a href="http://www.w3schools.com/cssref/pr_dim_width.asp">CSS width property</a> 1484 */ 1485 1486 public CSS setWidth(final Unit width) { 1487 return put("width", width); 1488 } 1489 1490 /** 1491 * Sets the <i>min-width</i> property. 1492 * 1493 * @param width The minimal width value to be set. 1494 * @return The current CSS object. 1495 * @see <a href="http://www.w3schools.com/cssref/pr_dim_min-width.asp">CSS min-width property</a> 1496 */ 1497 1498 public CSS setMinWidth(final Unit width) { 1499 return put("min-width", width); 1500 } 1501 1502 /** 1503 * Sets the <i>max-width</i> property. 1504 * 1505 * @param width The maximum width value to be set. 1506 * @return The current CSS object. 1507 * @see <a href="http://www.w3schools.com/cssref/pr_dim_max-width.asp">CSS max-width property</a> 1508 */ 1509 1510 public CSS setMaxWidth(final Unit width) { 1511 return put("max-width", width); 1512 } 1513 1514 /** 1515 * Sets the <i>height</i> property. 1516 * 1517 * @param height The height value to be set. 1518 * @return The current CSS object. 1519 * @see <a href="http://www.w3schools.com/cssref/pr_dim_height.asp">CSS height property</a> 1520 */ 1521 1522 public CSS setHeight(final Unit height) { 1523 return put("height", height); 1524 } 1525 1526 /** 1527 * Sets the <i>min-height</i> property. 1528 * 1529 * @param height The height value to be set. 1530 * @return The current CSS object. 1531 * @see <a href="http://www.w3schools.com/cssref/pr_dim_min-height.asp">CSS min-height property</a> 1532 */ 1533 1534 public CSS setMinHeight(final Unit height) { 1535 return put("min-height", height); 1536 } 1537 1538 /** 1539 * Sets the <i>max-height</i> property. 1540 * 1541 * @param height The height value to be set. 1542 * @return The current CSS object. 1543 * @see <a href="http://www.w3schools.com/cssref/pr_dim_max-height.asp">CSS max-height property</a> 1544 */ 1545 1546 public CSS setMaxHeight(final Unit height) { 1547 return put("max-height", height); 1548 } 1549 1550 /* 1551 * Position 1552 */ 1553 1554 /** 1555 * Sets the <i>bottom</i> property. 1556 * 1557 * @param bottom The bottom value to be set. 1558 * @return The current CSS object. 1559 * @see <a href="http://www.w3schools.com/cssref/pr_pos_bottom.asp">CSS bottom Property</a> 1560 */ 1561 1562 public CSS setBottom(final Unit bottom) { 1563 return put("bottom", bottom); 1564 } 1565 1566 /** 1567 * Sets the <i>left</i> property. 1568 * 1569 * @param left The left value to be set. 1570 * @return The current CSS object. 1571 * @see <a href="http://www.w3schools.com/cssref/pr_pos_left.asp">CSS left Property</a> 1572 */ 1573 1574 public CSS setLeft(final Unit left) { 1575 return put("left", left); 1576 } 1577 1578 /** 1579 * Sets the <i>right</i> property. 1580 * 1581 * @param right The right value to be set. 1582 * @return The current CSS object. 1583 * @see <a href="http://www.w3schools.com/cssref/pr_pos_right.asp">CSS right Property</a> 1584 */ 1585 1586 public CSS setRight(final Unit right) { 1587 return put("right", right); 1588 } 1589 1590 /** 1591 * Sets the <i>top</i> property. 1592 * 1593 * @param top The top value to be set. 1594 * @return The current CSS object. 1595 * @see <a href="http://www.w3schools.com/cssref/pr_pos_top.asp">CSS top Property</a> 1596 */ 1597 1598 public CSS setTop(final Unit top) { 1599 return put("top", top); 1600 } 1601 1602 /** 1603 * Sets the <i>clip</i> property. 1604 * 1605 * @param top The top value to be set. 1606 * @param right The right value to be set. 1607 * @param bottom The bottom value to be set. 1608 * @param left The left value to be set. 1609 * @return The current CSS object. 1610 * @see <a href="http://www.w3schools.com/cssref/pr_pos_clip.asp">CSS clip Property</a> 1611 */ 1612 1613 public CSS setClipShape(final Unit top, final Unit right, final Unit bottom, final Unit left) { 1614 return put("clip", "rect(" + top + ", " + right + ", " + bottom + ", " + left + ")"); 1615 } 1616 1617 /** 1618 * Sets the <i>cursor</i> property. 1619 * 1620 * @param cursor The cursor value to be set. 1621 * @return The current CSS object. 1622 * @see <a href="http://www.w3schools.com/cssref/pr_class_cursor.asp">CSS cursor Property</a> 1623 */ 1624 1625 public CSS setCursor(final Cursor cursor) { 1626 return put("cursor", cursor); 1627 } 1628 1629 /** 1630 * Sets the <i>cursor</i> property. 1631 * 1632 * @param url The cursor url value to be set. 1633 * @return The current CSS object. 1634 * @see <a href="http://www.w3schools.com/cssref/pr_class_cursor.asp">CSS cursor Property</a> 1635 */ 1636 1637 public CSS setCursor(final Serializable url) { 1638 return put("cursor", "url(" + url + ")"); 1639 } 1640 1641 /** 1642 * Sets the <i>overflow</i> property. 1643 * 1644 * @param overflow The overflow value to be set. 1645 * @return The current CSS object. 1646 * @see <a href="http://www.w3schools.com/cssref/pr_pos_overflow.asp">CSS overflow Property</a> 1647 */ 1648 1649 public CSS setOverflow(final Overflow overflow) { 1650 return put("overflow", overflow); 1651 } 1652 1653 /** 1654 * Sets the <i>position</i> property. 1655 * 1656 * @param position The position value to be set. 1657 * @return The current CSS object. 1658 * @see <a href="http://www.w3schools.com/css/css_positioning.asp">CSS Positioning</a> 1659 */ 1660 1661 public CSS setPosition(final Position position) { 1662 return put("position", position); 1663 } 1664 1665 /** 1666 * Sets the <i>z-index</i> property. 1667 * 1668 * @param zIndex The z-index value to be set. 1669 * @return The current CSS object. 1670 * @see <a href="http://www.w3schools.com/cssref/pr_pos_z-index.asp">CSS z-index Property</a> 1671 */ 1672 1673 public CSS setZIndex(final int zIndex) { 1674 return put("z-index", zIndex); 1675 } 1676 1677 /* 1678 * Float 1679 */ 1680 1681 /** 1682 * Sets the <i>clear</i> property. 1683 * 1684 * @param clear The clear value to be set. 1685 * @return The current CSS object. 1686 * @see <a href="http://www.w3schools.com/cssref/pr_class_clear.asp">CSS clear Property</a> 1687 */ 1688 1689 public CSS setClear(final Clear clear) { 1690 return put("clear", clear); 1691 } 1692 1693 /** 1694 * Sets the <i>float</i> property. 1695 * 1696 * @param f The float value to be set. 1697 * @return The current CSS object. 1698 * @see <a href="http://www.w3schools.com/cssref/pr_class_float.asp">CSS float Property</a> 1699 */ 1700 1701 public CSS setFloat(final Float f) { 1702 return put("float", f); 1703 } 1704 1705 /* 1706 * Display 1707 */ 1708 1709 /** 1710 * Sets the <i>display</i> property. 1711 * 1712 * @param display The display value to be set. 1713 * @return The current CSS object. 1714 * @see <a href="http://www.w3schools.com/cssref/pr_class_display.asp">CSS display Property</a> 1715 */ 1716 1717 public CSS setDisplay(final Display display) { 1718 return put("display", display); 1719 } 1720 1721 /** 1722 * Sets the <i>visibility</i> property. 1723 * 1724 * @param visibility The visibility to be set 1725 * @return The current CSS object. 1726 * @see <a href="http://www.w3schools.com/cssref/pr_class_visibility.asp">CSS visibility Property</a> 1727 */ 1728 1729 public CSS setVisibility(final Visibility visibility) { 1730 return put("visibility", visibility); 1731 } 1732 1733 }