Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,556 changes: 1,546 additions & 10 deletions docs/GUIGuideComponents.md

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions src/main/java/com/googlecode/lanterna/graphics/AbstractTheme.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,20 @@ public boolean isCursorVisible() {
return cursorVisible;
}

@Override
public int getIntegerProperty(String name, int defaultValue) {
String propertyValue = node.propertyMap.get(name);
if(propertyValue == null) {
if(node == rootNode) {
return defaultValue;
}
else {
return new DefinitionImpl(node.parent).getIntegerProperty(name, defaultValue);
}
}
return Integer.parseInt(propertyValue);
}

@Override
public boolean getBooleanProperty(String name, boolean defaultValue) {
String propertyValue = node.propertyMap.get(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ public ThemeStyle getCustom(String name, ThemeStyle defaultValue) {
return themeDefinition.getCustom(name, defaultValue);
}

@Override
public int getIntegerProperty(String name, int defaultValue) {
return themeDefinition.getIntegerProperty(name, defaultValue);
}

@Override
public boolean getBooleanProperty(String name, boolean defaultValue) {
return themeDefinition.getBooleanProperty(name, defaultValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,15 @@ public synchronized Definition setCustom(String name, TextColor foreground, Text
return this;
}

public synchronized int getIntegerProperty(String name, int defaultValue) {
return Integer.parseInt(properties.getProperty(name, Integer.toString(defaultValue)));
}

public synchronized Definition setIntegerProperty(String name, int value) {
properties.setProperty(name, Integer.toString(value));
return this;
}

@Override
public synchronized boolean getBooleanProperty(String name, boolean defaultValue) {
return Boolean.parseBoolean(properties.getProperty(name, Boolean.toString(defaultValue)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ public interface ThemeDefinition {
*/
boolean getBooleanProperty(String name, boolean defaultValue);

/**
* Retrieves a custom integer property, if one is available by this name. Will return a supplied default value if
* no such property could be found within this {@link ThemeDefinition}.
* @param name Name of the integer property to look up
* @param defaultValue What to return if the there is no property with this name
* @return The property value stored in this theme definition, parsed as a integer
*/
int getIntegerProperty(String name, int defaultValue);

/**
* Asks the theme definition for this component if the theme thinks that the text cursor should be visible or not.
* Note that certain components might have a visible state depending on the context and the current data set, in
Expand Down
Loading