Permalink
Browse files

Merge branch '1.3'

Conflicts:
	nifty-examples/src/main/java/de/lessvoid/nifty/examples/defaultcontrols/treebox/TreeboxControlDialogController.java
  • Loading branch information...
2 parents e03b1c6 + 4a670ab commit 7e17a38235d8aa86aac7e6071ce25681fd2cdaf7 void committed May 17, 2012
Showing with 4,572 additions and 1,646 deletions.
  1. +1 −0 .gitignore
  2. BIN nifty-controls-style-black/artwork/tabs/single-tab.psd
  3. BIN nifty-controls-style-black/artwork/tabs/tab-content-panel.psd
  4. BIN nifty-controls-style-black/artwork/tabs/tabs-reloaded-content.psd
  5. BIN nifty-controls-style-black/artwork/tabs/tabs-reloaded-flat.psd
  6. BIN nifty-controls-style-black/artwork/tabs/tabs-reloaded-states.psd
  7. BIN nifty-controls-style-black/artwork/tabs/tabs-reloaded.psd
  8. +2 −2 nifty-controls-style-black/src/main/resources/dropdown/nifty-drop-down.xml
  9. +6 −2 nifty-controls-style-black/src/main/resources/fonts.xml
  10. +1 −7 nifty-controls-style-black/src/main/resources/radiobutton/nifty-radiobutton.xml
  11. BIN nifty-controls-style-black/src/main/resources/tabs/active-button.png
  12. BIN nifty-controls-style-black/src/main/resources/tabs/button.png
  13. +55 −24 nifty-controls-style-black/src/main/resources/tabs/nifty-tabs.xml
  14. BIN nifty-controls-style-black/src/main/resources/tabs/tab-background-border.png
  15. BIN nifty-controls-style-black/src/main/resources/tabs/tab-content-panel.png
  16. BIN nifty-controls-style-black/src/main/resources/tabs/tabs.png
  17. +5 −3 nifty-controls-style-black/src/main/resources/textfield/nifty-textfield.xml
  18. +19 −0 nifty-controls/src/main/java/de/lessvoid/nifty/controls/ConsoleCommands.java
  19. +49 −25 nifty-controls/src/main/java/de/lessvoid/nifty/controls/Tab.java
  20. +186 −0 nifty-controls/src/main/java/de/lessvoid/nifty/controls/TabGroup.java
  21. +70 −40 nifty-controls/src/main/java/de/lessvoid/nifty/controls/TabSelectedEvent.java
  22. +0 −52 nifty-controls/src/main/java/de/lessvoid/nifty/controls/Tabs.java
  23. +153 −45 nifty-controls/src/main/java/de/lessvoid/nifty/controls/TextField.java
  24. +8 −6 nifty-controls/src/main/java/de/lessvoid/nifty/controls/dragndrop/DraggableControl.java
  25. +2 −2 nifty-controls/src/main/java/de/lessvoid/nifty/controls/listbox/ListBoxControl.java
  26. +167 −123 nifty-controls/src/main/java/de/lessvoid/nifty/controls/nullobjects/TextFieldNull.java
  27. +107 −58 nifty-controls/src/main/java/de/lessvoid/nifty/controls/tabs/TabControl.java
  28. +544 −0 nifty-controls/src/main/java/de/lessvoid/nifty/controls/tabs/TabGroupControl.java
  29. +19 −0 nifty-controls/src/main/java/de/lessvoid/nifty/controls/tabs/TabGroupMember.java
  30. +0 −213 nifty-controls/src/main/java/de/lessvoid/nifty/controls/tabs/TabsControl.java
  31. +57 −29 nifty-controls/src/main/java/de/lessvoid/nifty/controls/tabs/builder/TabBuilder.java
  32. +93 −0 nifty-controls/src/main/java/de/lessvoid/nifty/controls/tabs/builder/TabGroupBuilder.java
  33. +0 −31 nifty-controls/src/main/java/de/lessvoid/nifty/controls/tabs/builder/TabsBuilder.java
  34. +41 −0 nifty-controls/src/main/java/de/lessvoid/nifty/controls/textfield/InputCharFilterWrapper.java
  35. +35 −0 ...y-controls/src/main/java/de/lessvoid/nifty/controls/textfield/InputCharSequenceFilterWrapper.java
  36. +100 −0 nifty-controls/src/main/java/de/lessvoid/nifty/controls/textfield/SingleCharSequence.java
  37. +202 −136 nifty-controls/src/main/java/de/lessvoid/nifty/controls/textfield/TextFieldControl.java
  38. +80 −60 nifty-controls/src/main/java/de/lessvoid/nifty/controls/textfield/TextFieldInputMapping.java
  39. +382 −194 nifty-controls/src/main/java/de/lessvoid/nifty/controls/textfield/TextFieldLogic.java
  40. +7 −7 nifty-controls/src/main/java/de/lessvoid/nifty/controls/textfield/TextFieldView.java
  41. +30 −26 nifty-controls/src/main/java/de/lessvoid/nifty/controls/textfield/builder/TextFieldBuilder.java
  42. +14 −0 nifty-controls/src/main/java/de/lessvoid/nifty/controls/textfield/filter/delete/FilterDeleteAll.java
  43. +18 −0 ...trols/src/main/java/de/lessvoid/nifty/controls/textfield/filter/delete/TextFieldDeleteFilter.java
  44. +18 −0 nifty-controls/src/main/java/de/lessvoid/nifty/controls/textfield/filter/input/FilterAcceptAll.java
  45. +13 −0 ...-controls/src/main/java/de/lessvoid/nifty/controls/textfield/filter/input/FilterAcceptDigits.java
  46. +45 −0 ...y-controls/src/main/java/de/lessvoid/nifty/controls/textfield/filter/input/FilterAcceptFloat.java
  47. +13 −0 ...controls/src/main/java/de/lessvoid/nifty/controls/textfield/filter/input/FilterAcceptLetters.java
  48. +13 −0 ...ntrols/src/main/java/de/lessvoid/nifty/controls/textfield/filter/input/FilterAcceptLowerCase.java
  49. +30 −0 ...s/src/main/java/de/lessvoid/nifty/controls/textfield/filter/input/FilterAcceptNegativeDigits.java
  50. +53 −0 ...y-controls/src/main/java/de/lessvoid/nifty/controls/textfield/filter/input/FilterAcceptRegex.java
  51. +13 −0 ...ntrols/src/main/java/de/lessvoid/nifty/controls/textfield/filter/input/FilterAcceptUpperCase.java
  52. +17 −0 ...ols/src/main/java/de/lessvoid/nifty/controls/textfield/filter/input/TextFieldInputCharFilter.java
  53. +17 −0 ...main/java/de/lessvoid/nifty/controls/textfield/filter/input/TextFieldInputCharSequenceFilter.java
  54. +9 −0 ...ontrols/src/main/java/de/lessvoid/nifty/controls/textfield/filter/input/TextFieldInputFilter.java
  55. +45 −0 nifty-controls/src/main/java/de/lessvoid/nifty/controls/textfield/format/FormatPassword.java
  56. +13 −0 nifty-controls/src/main/java/de/lessvoid/nifty/controls/textfield/format/FormatPlain.java
  57. +19 −0 nifty-controls/src/main/java/de/lessvoid/nifty/controls/textfield/format/TextFieldDisplayFormat.java
  58. +1 −2 nifty-controls/src/main/resources/nifty-controls/nifty-radiobutton.xml
  59. +17 −20 nifty-controls/src/main/resources/nifty-controls/nifty-tabs.xml
  60. +1 −1 nifty-controls/src/main/resources/nifty-controls/nifty-textfield.xml
  61. +68 −0 nifty-controls/src/test/java/de/lessvoid/nifty/controls/ConsoleCommandsTest.java
  62. +10 −10 nifty-controls/src/test/java/de/lessvoid/nifty/controls/textfield/EmptyTextFieldView.java
  63. +4 −6 ...ontrols/src/test/java/de/lessvoid/nifty/controls/textfield/TextFieldChangeEventClipboardTest.java
  64. +5 −7 nifty-controls/src/test/java/de/lessvoid/nifty/controls/textfield/TextFieldChangeEventTest.java
  65. +8 −9 nifty-controls/src/test/java/de/lessvoid/nifty/controls/textfield/TextFieldMaxLenClipboardTest.java
  66. +11 −11 nifty-controls/src/test/java/de/lessvoid/nifty/controls/textfield/TextFieldMaxLenTest.java
  67. +18 −12 nifty-controls/src/test/java/de/lessvoid/nifty/controls/textfield/TextFieldPasswordTest.java
  68. +67 −0 nifty-core/pom.xml
  69. +45 −89 nifty-core/src/main/java/de/lessvoid/nifty/Nifty.java
  70. +1 −0 nifty-core/src/main/java/de/lessvoid/nifty/NiftyDefaults.java
  71. +24 −0 nifty-core/src/main/java/de/lessvoid/nifty/builder/ElementBuilder.java
  72. +24 −0 nifty-core/src/main/java/de/lessvoid/nifty/builder/StyleBuilder.java
  73. +19 −0 nifty-core/src/main/java/de/lessvoid/nifty/controls/FocusHandler.java
  74. +24 −0 nifty-core/src/main/java/de/lessvoid/nifty/controls/dynamic/attributes/ControlAttributes.java
  75. +57 −0 nifty-core/src/main/java/de/lessvoid/nifty/effects/impl/PlayMusic.java
  76. +1 −1 nifty-core/src/main/java/de/lessvoid/nifty/effects/impl/PlaySound.java
  77. +7 −0 nifty-core/src/main/java/de/lessvoid/nifty/elements/Action.java
  78. +198 −6 nifty-core/src/main/java/de/lessvoid/nifty/elements/Element.java
  79. +6 −3 nifty-core/src/main/java/de/lessvoid/nifty/elements/ElementInteractionClickHandler.java
  80. +39 −0 nifty-core/src/main/java/de/lessvoid/nifty/elements/ElementMoveAction.java
  81. +30 −0 nifty-core/src/main/java/de/lessvoid/nifty/elements/ElementRemoveAction.java
  82. +25 −0 nifty-core/src/main/java/de/lessvoid/nifty/elements/EndOfFrameElementAction.java
  83. +17 −11 nifty-core/src/main/java/de/lessvoid/nifty/elements/tools/FontHelper.java
  84. +86 −12 nifty-core/src/main/java/de/lessvoid/nifty/layout/BoxConstraints.java
  85. +78 −0 nifty-core/src/main/java/de/lessvoid/nifty/layout/LayoutPart.java
  86. +21 −33 nifty-core/src/main/java/de/lessvoid/nifty/layout/manager/CenterLayout.java
  87. +20 −13 nifty-core/src/main/java/de/lessvoid/nifty/layout/manager/HorizontalLayout.java
  88. +20 −21 nifty-core/src/main/java/de/lessvoid/nifty/layout/manager/VerticalLayout.java
  89. +1 −0 nifty-core/src/main/java/de/lessvoid/nifty/loaderv2/types/EffectType.java
  90. +6 −0 nifty-core/src/main/java/de/lessvoid/nifty/loaderv2/types/RemoveStandardAttributes.java
  91. +1 −0 nifty-core/src/main/java/de/lessvoid/nifty/loaderv2/types/StyleType.java
  92. +2 −7 nifty-core/src/main/java/de/lessvoid/nifty/loaderv2/types/apply/Convert.java
  93. +20 −0 nifty-core/src/main/java/de/lessvoid/nifty/screen/Screen.java
  94. +66 −33 nifty-core/src/main/java/de/lessvoid/nifty/tools/SizeValue.java
  95. +8 −1 nifty-core/src/main/resources/nifty-1.3.xsd
  96. +7 −1 nifty-core/src/main/resources/nifty-styles-1.3.xsd
  97. +67 −2 nifty-core/src/test/java/de/lessvoid/nifty/SizeValueTest.java
  98. +69 −0 nifty-core/src/test/java/de/lessvoid/nifty/layout/BoxConstraintWithMarginTest.java
  99. +20 −0 nifty-core/src/test/java/de/lessvoid/nifty/layout/manager/BoxTestHelper.java
  100. +53 −0 nifty-core/src/test/java/de/lessvoid/nifty/layout/manager/CenterLayoutParentResizeTest.java
  101. +4 −11 nifty-core/src/test/java/de/lessvoid/nifty/layout/manager/CenterLayoutWithPaddingTest.java
  102. +61 −0 nifty-core/src/test/java/de/lessvoid/nifty/layout/manager/HorizontalLayoutMarginTest.java
  103. +53 −0 nifty-core/src/test/java/de/lessvoid/nifty/layout/manager/HorizontalLayoutParentResizeTest.java
  104. +2 −7 nifty-core/src/test/java/de/lessvoid/nifty/layout/manager/HorizontalLayoutTest.java
  105. +14 −28 nifty-core/src/test/java/de/lessvoid/nifty/layout/manager/KeepInsidePostProcessTest.java
  106. +61 −0 nifty-core/src/test/java/de/lessvoid/nifty/layout/manager/VerticalLayoutMarginTest.java
  107. +53 −0 nifty-core/src/test/java/de/lessvoid/nifty/layout/manager/VerticalLayoutParentResizeTest.java
  108. +2 −7 nifty-core/src/test/java/de/lessvoid/nifty/layout/manager/VerticalLayoutTest.java
  109. +1 −1 ...les-slick2d/src/main/java/de/lessvoid/nifty/examples/slick2d/defaultcontrolsxml/TabsDemoMain.java
  110. +67 −49 nifty-examples/src/main/java/de/lessvoid/nifty/examples/defaultcontrols/ControlsDemo.java
  111. +71 −67 ...es/src/main/java/de/lessvoid/nifty/examples/defaultcontrols/tabs/TabsControlDialogController.java
  112. +28 −29 ...es/src/main/java/de/lessvoid/nifty/examples/defaultcontrols/tabs/TabsControlDialogDefinition.java
  113. +2 −2 nifty-examples/src/main/java/de/lessvoid/nifty/examples/defaultcontrolsxml/TabsExample.java
  114. +1 −1 nifty-examples/src/main/java/de/lessvoid/nifty/examples/test/TestMain.java
  115. +18 −14 nifty-examples/src/main/resources/defaultcontrolsxml/13-textfield.xml
  116. +20 −23 nifty-examples/src/main/resources/defaultcontrolsxml/15-tabs.xml
  117. +31 −7 nifty-examples/src/main/resources/test/test.xml
  118. +32 −1 nifty-html/pom.xml
  119. +7 −2 nifty-html/src/main/java/de/lessvoid/nifty/html/NiftyVisitor.java
  120. +1 −1 nifty-html/src/test/resources/html/test-01.html
View
@@ -3,3 +3,4 @@
.DS_Store
*.iml
/.idea
+bin/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -8,7 +8,7 @@
</style>
<style id="nifty-drop-down#panel-text">
- <attributes childLayout="center" visibleToMouse="true" childClip="true" backgroundColor="#666f" padding="0px,2px" width="*" />
+ <attributes childLayout="center" childClip="true" backgroundColor="#666f" padding="0px,2px" width="*" />
<effect>
<onActive name="border" color="#222f" post="true" inset="1px" />
<onFocus name="colorBar" color="#800f" post="true" inset="1px" />
@@ -29,7 +29,7 @@
</style>
<style id="nifty-drop-down#icon">
- <attributes filename="scrollbar/scrollbar.png" width="23px" height="23px" imageMode="sprite:23,23,0" visibleToMouse="true" />
+ <attributes filename="scrollbar/scrollbar.png" width="23px" height="23px" imageMode="sprite:23,23,0" />
<effect>
<onClick name="focus" targetElement="#parent" />
<onClick name="imageOverlay" filename="scrollbar/scrollbar.png" imageMode="sprite:23,23,2" post="true" />
@@ -1,10 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<nifty-styles>
<style id="button-font">
- <attributes font="aurulent-sans-16.fnt" />
+ <attributes font="aurulent-sans-16.fnt"/>
+ </style>
+
+ <style id="tab-font">
+ <attributes font="aurulent-sans-16.fnt"/>
</style>
<style id="base-font">
- <attributes font="aurulent-sans-16.fnt" />
+ <attributes font="aurulent-sans-16.fnt"/>
</style>
</nifty-styles>
@@ -5,7 +5,7 @@
</style>
<style id="nifty-radiobutton-style#select">
- <attributes childLayout="overlay" align="center" valign="center" width="23px" height="23px" filename="radiobutton/radiobutton.png" visibleToMouse="true" />
+ <attributes childLayout="overlay" align="center" valign="center" width="23px" height="23px" filename="radiobutton/radiobutton.png" />
<effect overlay="true">
<onEnabled name="fade" start="#5" end="#f" post="false" length="150" inherit="true"/>
<onDisabled name="fade" start="#f" end="#5" post="false" length="150" inherit="true" neverStopRendering="true" />
@@ -14,12 +14,6 @@
<onCustom customKey="show" name="imageOverlay" filename="radiobutton/radiobutton-checked.png" width="23px" height="23px" post="true" neverStopRendering="true" />
<onCustom customKey="hide" name="fade" start="#f" end="#0" length="350" post="true" />
<onCustom customKey="hide" name="imageOverlay" filename="radiobutton/radiobutton-checked.png" width="23px" height="23px" post="true" length="350" />
- </effect>
- </style>
-
- <style id="nifty-radiobutton-style#overlay-select">
- <attributes align="center" valign="center" width="23px" height="23px" visibleToMouse="true" />
- <effect overlay="true">
<onFocus name="imageOverlay" filename="radiobutton/radiobutton-hover.png" width="23px" height="23px" post="true" />
<onHover name="imageOverlay" filename="radiobutton/radiobutton-hover.png" width="23px" height="23px" post="true" />
</effect>
Deleted file not rendered
@@ -1,24 +1,55 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<nifty-styles>
-
- <style id="nifty-tabs#tab-button">
- <attributes backgroundImage="tabs/button.png" imageMode="sprite-resize:100,23,0,2,96,2,2,2,96,2,19,2,96,2,2" paddingLeft="7px" paddingRight="7px" width="100px" height="23px" childLayout="center" visibleToMouse="true" />
- <effect>
- <onHover name="border" color="#822f" post="true" />
- <onFocus name="imageOverlay" filename="tabs/button.png" imageMode="sprite-resize:100,23,1,2,96,2,2,2,96,2,19,2,96,2,2" post="true" />
- <onEnabled name="renderQuad" startColor="#2228" endColor="#2220" post="true" length="150" />
- <onDisabled name="renderQuad" startColor="#2220" endColor="#2228" post="true" length="150" />
- </effect>
- </style>
-
- <style id="nifty-tabs#active-tab-button">
- <attributes backgroundImage="tabs/button.png" imageMode="sprite-resize:100,23,0,2,96,2,2,2,96,2,19,2,96,2,2" paddingLeft="7px" paddingRight="7px" width="100px" height="23px" childLayout="center" visibleToMouse="true" />
- <effect>
- <onHover name="border" color="#822f" post="true" />
- <onFocus name="imageOverlay" filename="tabs/active-button.png" imageMode="sprite-resize:100,23,1,2,96,2,2,2,96,2,19,2,96,2,2" post="true" />
- <onEnabled name="renderQuad" startColor="#2228" endColor="#2220" post="true" length="150" />
- <onDisabled name="renderQuad" startColor="#2220" endColor="#2228" post="true" length="150" />
- </effect>
- </style>
-
-</nifty-styles>
+<?xml version="1.0" encoding="UTF-8"?>
+<nifty-styles>
+ <!-- The Tabs require the Nifty-Panel to be displayed properly. -->
+ <useStyles filename="panel/nifty-panel.xml"/>
+
+ <!-- This style is applied to the panel that holds the content of each tab. -->
+ <style id="nifty-tabs#panel">
+ <attributes width="100%" padding="8px,16px,24px,16px" backgroundImage="tabs/tab-content-panel.png"
+ imageMode="resize:6,1,6,1,6,1,6,215,6,1,6,8"/>
+ </style>
+
+ <!-- This style is applied to the panel that holds the button -->
+ <style id="nifty-tabs#tab-button-panel">
+ <attributes width="100%" backgroundImage="tabs/tab-background-border.png"
+ imageMode="resize:0,3,0,0,0,3,0,2,0,3,0,1"/>
+ </style>
+
+ <!-- The style of a single tab element. -->
+ <style id="nifty-tab">
+ <attributes width="100%"/>
+ </style>
+
+ <!-- The style of a tab button that is not the activated one. -->
+ <style id="nifty-tab-button">
+ <attributes backgroundImage="tabs/tabs.png"
+ imageMode="sprite-resize:31,23,2,15,1,15,11,15,1,15,1,15,1,15,11" paddingLeft="11px"
+ paddingRight="11px" width="100px" height="23px" childLayout="center" visibleToMouse="true"/>
+ <effect>
+ <onHover name="imageOverlay" filename="tabs/tabs.png"
+ imageMode="sprite-resize:31,23,1,15,1,15,11,15,1,15,1,15,1,15,11" post="true"/>
+ </effect>
+ </style>
+
+ <!-- The style of the text on a tab button that is not the activated one. -->
+ <style id="nifty-tab-button#text" base="tab-font">
+ <attributes align="center" valign="center" textHAlign="center" textVAlign="center" visibleToMouse="false"
+ color="#000"/>
+ </style>
+
+ <!-- The style of a tab button that is the activated one. -->
+ <style id="nifty-tab-button-active">
+ <attributes backgroundImage="tabs/tabs.png"
+ imageMode="sprite-resize:31,23,0,15,1,15,11,15,1,15,1,15,1,15,11" paddingLeft="11px"
+ paddingRight="11px" width="100px" height="23px" childLayout="center" visibleToMouse="true"/>
+ <effect>
+ <!-- weiss noch net :)
+ <onHover name="imageOverlay" filename="tabs/tabs.png"
+ imageMode="sprite-resize:31,23,0,15,1,15,11,15,1,15,1,15,1,15,11" post="true"/>
+ -->
+ </effect>
+ </style>
+
+ <!-- The style of the text on a tab button that is the activated one. -->
+ <style id="nifty-tab-button-active#text" base="nifty-tab-button#text"/>
+</nifty-styles>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -5,16 +5,18 @@
<!-- the background of the textfield -->
<style id="nifty-textfield#panel">
<attributes childLayout="overlay" height="23px" />
+ <effect>
+ <onHover name="changeMouseCursor" id="textFieldCursor" />
+ <onHover name="border" color="#822f" post="true" />
+ </effect>
</style>
<!-- the actual input field -->
<style id="nifty-textfield#field">
- <attributes childLayout="center" visibleToMouse="true" childClip="true" backgroundColor="#666f" padding="0px,2px"/>
+ <attributes childLayout="center" childClip="true" backgroundColor="#666f" padding="0px,2px"/>
<effect>
<onActive name="border" color="#222f" post="true" inset="1px" />
<onFocus name="colorBar" color="#800f" post="true" inset="1px" />
- <onHover name="changeMouseCursor" id="textFieldCursor" />
- <onHover name="border" color="#822f" post="true" />
<onEnabled name="renderQuad" startColor="#2228" endColor="#2220" post="true" length="150" />
<onDisabled name="renderQuad" startColor="#2220" endColor="#2228" post="true" length="150" />
</effect>
@@ -158,6 +158,25 @@ public boolean keyEvent(final NiftyInputEvent inputEvent) {
return false;
}
+ /**
+ * Find a ConsoleCommand with the given commandText. This will find commands that
+ * begin with the given commandText as well.
+ *
+ * @param commandText the command to return
+ * @return the ConsoleCommand or null if command does not exist
+ */
+ public ConsoleCommand findCommand(final String commandText) {
+ ConsoleCommand command = commands.get(commandText);
+ if (command != null) {
+ return command;
+ }
+ List<String> commandMatches = findMatches(commandText);
+ if (commandMatches.size() == 1) {
+ return commands.get(commandMatches.get(0));
+ }
+ return null;
+ }
+
private void changeText(final String newText) {
textfield.setText(newText);
textfield.setCursorPosition(textfield.getText().length());
@@ -1,25 +1,49 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package de.lessvoid.nifty.controls;
-
-/**
- *
- * @author ractoc
- */
-public interface Tab extends NiftyControl {
-
- /**
- * Set the caption for the tab.
- * @param caption The caption for the tab.
- */
- public void setCaption(String caption);
-
- /**
- * Get the caption for the tab.
- * @return The caption for the tab.
- */
- public String getCaption();
-
-}
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package de.lessvoid.nifty.controls;
+
+/**
+ * This interface allows to take control over a single tab. This tab is supposed to be the part of a {@link TabGroup}.
+ * For the most aspects it behaves like a simple panel.
+ *
+ * @author ractoc
+ * @author Martin Karing &lt;nitram@illarion.org&gt;
+ */
+public interface Tab extends NiftyControl {
+ /**
+ * Get the caption that is currently set for this tab.
+ *
+ * @return the current caption of this tab
+ */
+ String getCaption();
+
+ /**
+ * Get the parent group of tabs this tab is a member of.
+ *
+ * @return the tab group this tab belongs to or {@code null} in case this tab is not yet assigned to a tab group
+ */
+ TabGroup getParentGroup();
+
+ /**
+ * Check if this tab was added to a parent tab group.
+ *
+ * @return {@code true} if this tab is part of a group
+ */
+ boolean hasParent();
+
+ /**
+ * Check if this tab is the one that is currently visible in a tab group.
+ *
+ * @return {@code true} if this tab is the one currently displayed
+ */
+ boolean isVisible();
+
+ /**
+ * Set the caption of the tab. This is the text that will be displayed in the button that turns this tab visible.
+ *
+ * @param caption the text to display
+ */
+ void setCaption(String caption);
+}
Oops, something went wrong.

0 comments on commit 7e17a38

Please sign in to comment.