Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Sizeable.java 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /*
  2. @ITMillApache2LicenseForJavaFiles@
  3. */
  4. package com.itmill.toolkit.terminal;
  5. /**
  6. * Interface to be implemented by components wishing to display some object that
  7. * may be dynamically resized during runtime.
  8. *
  9. * @author IT Mill Ltd.
  10. * @version
  11. * @VERSION@
  12. * @since 3.0
  13. */
  14. public interface Sizeable {
  15. /**
  16. * Unit code representing pixels.
  17. */
  18. public static final int UNITS_PIXELS = 0;
  19. /**
  20. * Unit code representing points (1/72nd of an inch).
  21. */
  22. public static final int UNITS_POINTS = 1;
  23. /**
  24. * Unit code representing picas (12 points).
  25. */
  26. public static final int UNITS_PICAS = 2;
  27. /**
  28. * Unit code representing the font-size of the relevant font.
  29. */
  30. public static final int UNITS_EM = 3;
  31. /**
  32. * Unit code representing the x-height of the relevant font.
  33. */
  34. public static final int UNITS_EX = 4;
  35. /**
  36. * Unit code representing millimetres.
  37. */
  38. public static final int UNITS_MM = 5;
  39. /**
  40. * Unit code representing centimetres.
  41. */
  42. public static final int UNITS_CM = 6;
  43. /**
  44. * Unit code representing inches.
  45. */
  46. public static final int UNITS_INCH = 7;
  47. /**
  48. * Unit code representing in percentage of the containing element defined by
  49. * terminal.
  50. */
  51. public static final int UNITS_PERCENTAGE = 8;
  52. /**
  53. * Unit code representing in rows of text. This unit is only applicaple to
  54. * some components can it's meaning is specified by component
  55. * implementation.
  56. */
  57. public static final int UNITS_ROWS = 9;
  58. /**
  59. * Textual representations of units symbols. Supported units and their
  60. * symbols are:
  61. * <ul>
  62. * <li><code>UNITS_PIXELS</code>: "px"</li>
  63. * <li><code>UNITS_POINTS</code>: "pt"</li>
  64. * <li><code>UNITS_PICAS</code>: "pc"</li>
  65. * <li><code>UNITS_EM</code>: "em"</li>
  66. * <li><code>UNITS_EX</code>: "ex"</li>
  67. * <li><code>UNITS_MM</code>: "mm"</li>
  68. * <li><code>UNITS_CM</code>. "cm"</li>
  69. * <li><code>UNITS_INCH</code>: "in"</li>
  70. * <li><code>UNITS_PERCENTAGE</code>: "%"</li>
  71. * <li><code>UNITS_ROWS</code>: "rows"</li>
  72. * </ul>
  73. * These can be used like <code>Sizeable.UNIT_SYMBOLS[UNITS_PIXELS]</code>.
  74. */
  75. public static final String[] UNIT_SYMBOLS = { "px", "pt", "pc", "em", "ex",
  76. "mm", "cm", "in", "%", "rows" };
  77. /**
  78. * Gets the width of the object. Negative number implies unspecified size
  79. * (terminal is free to set the size).
  80. *
  81. * @return width of the object in units specified by widthUnits property.
  82. */
  83. public int getWidth();
  84. /**
  85. * Sets the width of the object. Negative number implies unspecified size
  86. * (terminal is free to set the size).
  87. *
  88. * @param width
  89. * the width of the object in units specified by widthUnits
  90. * property.
  91. */
  92. public void setWidth(int width);
  93. /**
  94. * Gets the height of the object. Negative number implies unspecified size
  95. * (terminal is free to set the size).
  96. *
  97. * @return height of the object in units specified by heightUnits property.
  98. */
  99. public int getHeight();
  100. /**
  101. * Sets the height of the object. Negative number implies unspecified size
  102. * (terminal is free to set the size).
  103. *
  104. * @param height
  105. * the height of the object in units specified by heightUnits
  106. * property.
  107. */
  108. public void setHeight(int height);
  109. /**
  110. * Gets the width property units.
  111. *
  112. * @return units used in width property.
  113. */
  114. public int getWidthUnits();
  115. /**
  116. * Sets the width property units.
  117. *
  118. * @param units
  119. * the units used in width property.
  120. */
  121. public void setWidthUnits(int units);
  122. /**
  123. * Gets the height property units.
  124. *
  125. * @return units used in height property.
  126. */
  127. public int getHeightUnits();
  128. /**
  129. * Sets the height property units.
  130. *
  131. * @param units
  132. * the units used in height property.
  133. */
  134. public void setHeightUnits(int units);
  135. /**
  136. * Sets the size to 100% x 100%.
  137. */
  138. public void setSizeFull();
  139. /**
  140. * Clears any size settings.
  141. */
  142. public void setSizeUndefined();
  143. }