Browse Source

removed misc.properties

fixed issue where the default icon would not be light if the theme uses the light icon set.
pull/15/head
weisj 5 years ago
parent
commit
a189cf7116
  1. 29
      src/main/java/com/weis/darklaf/theme/Theme.java
  2. 3
      src/main/java/com/weis/darklaf/util/PropertyLoader.java
  3. 2
      src/main/resources/com/weis/darklaf/properties/ui/borders.properties
  4. 25
      src/main/resources/com/weis/darklaf/properties/ui/misc.properties

29
src/main/java/com/weis/darklaf/theme/Theme.java

@ -25,34 +25,61 @@ public abstract class Theme {
private static final Logger LOGGER = Logger.getLogger(Theme.class.getName());
private static final String[] UI_PROPERTIES = new String[]{
"borders", "button", "checkBox", "colorChooser", "comboBox", "fileChooser", "tristate",
"internalFrame", "label", "list", "menu", "menuBar", "menuItem", "misc", "optionPane", "panel",
"internalFrame", "label", "list", "menu", "menuBar", "menuItem", "optionPane", "panel",
"popupMenu", "progressBar", "radioButton", "rootPane", "scrollBar", "scrollPane", "separator",
"slider", "spinner", "splitPane", "statusBar", "tabbedPane", "tabFrame", "table", "taskPane", "text",
"toggleButton", "toolBar", "toolTip", "tree",
};
/**
* Called in the constructor of the look and feel.
*/
public void beforeInstall() {
if (SystemInfo.isWindows || SystemInfo.isLinux) {
MetalLookAndFeel.setCurrentTheme(new DarkMetalTheme());
}
}
/**
* Load the theme defaults.
*
* @param properties the properties to load the values into.
* @param currentDefaults the current ui defaults.
*/
public void loadDefaults(@NotNull final Properties properties, final UIDefaults currentDefaults) {
var name = getResourcePath() + getName() + "_defaults.properties";
PropertyLoader.putProperties(load(name), properties, currentDefaults);
}
/**
* Load the global values.
*
* @param properties the properties to load the values into.
* @param currentDefaults the current ui defaults.
*/
public void loadGlobals(@NotNull final Properties properties, final UIDefaults currentDefaults) {
PropertyLoader.putProperties(PropertyLoader.loadProperties(DarkLaf.class, "globals", "properties/"),
properties, currentDefaults);
}
/**
* Load the platform defaults.
*
* @param properties the properties to load the values into.
* @param currentDefaults the current ui defaults.
*/
public void loadPlatformProperties(final Properties properties, final UIDefaults currentDefaults) {
final String osPrefix = SystemInfo.isMac ? "mac" : SystemInfo.isWindows ? "windows" : "linux";
PropertyLoader.putProperties(PropertyLoader.loadProperties(DarkLaf.class, osPrefix, "properties/platform/"),
properties, currentDefaults);
}
/**
* Load the ui defaults.
*
* @param properties the properties to load the values into.
* @param currentDefaults the current ui defaults.
*/
public void loadUIProperties(final Properties properties, final UIDefaults currentDefaults) {
for (var property : UI_PROPERTIES) {
PropertyLoader.putProperties(PropertyLoader.loadProperties(DarkLaf.class, property, "properties/ui/"),

3
src/main/java/com/weis/darklaf/util/PropertyLoader.java

@ -23,6 +23,7 @@
*/
package com.weis.darklaf.util;
import com.weis.darklaf.LafManager;
import com.weis.darklaf.icons.DarkUIAwareIcon;
import com.weis.darklaf.icons.EmptyIcon;
import com.weis.darklaf.icons.IconLoader;
@ -226,7 +227,7 @@ public final class PropertyLoader {
return ICON_LOADER.getIcon(iconPath, dim.width, dim.height, true);
} else {
DarkUIAwareIcon icon = ICON_LOADER.getUIAwareIcon(iconPath, dim.width, dim.height);
if (tag.equals(DUAL_KEY)) {
if (tag.equals(DUAL_KEY) && LafManager.getTheme().isDark()) {
return icon.getDual();
} else {
return icon;

2
src/main/resources/com/weis/darklaf/properties/ui/borders.properties

@ -22,3 +22,5 @@
#
# suppress inspection "UnusedProperty" for whole file
TitledBorder.titleColor = %textForeground
TitledBorder.border = com.weis.darklaf.ui.titledborder.DarkTitledBorder
TitledBorder.borderColor = %border

25
src/main/resources/com/weis/darklaf/properties/ui/misc.properties

@ -1,25 +0,0 @@
#
# MIT License
#
# Copyright (c) 2019 Jannis Weis
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
TitledBorder.border = com.weis.darklaf.ui.titledborder.DarkTitledBorder
TitledBorder.borderColor = %border
Loading…
Cancel
Save