ResourceManager

The ResourceManager interface is used to customize not only icons, colors and internationalization but also ui components creation, with relative customization, and transparency manager.
The default implementation is provided by the class org.noos.xing.mydoggy.plaf.ui.look.MyDoggyResourceManager
There are two ways to modify the ResourceManager reference used by mydoggy.
  • Changing the value of the property "ResourceManager.class" into the "mydoggyplaf.properties" file that you can found into mydoggy-res module. Note that this file is loaded by MyDoggyToolWindowManager during the execution of the method initUI().
  • Using this code...
    MyDoggyToolWindowManager toolWindowManager = new MyDoggyToolWindowManager(...);
    toolWindowManager.setResourceManager(new ...);

MyDoggyResourceManager

The default implementation, for ResourceManager interface, is provided by the class org.noos.xing.mydoggy.plaf.ui.look.MyDoggyResourceManager
This class looks for a file called "resource.properties" in the classloader space. This file contains colors, icons and bundle declaration. But you can also change this declaration using specific methods like putIcon(...)
Here is an example of resource.properties file...
Icon.TOOL_SCROLL_BAR_LEFT = org/noos/xing/mydoggy/plaf/ui/icons/arrowLeft.png
Icon.TOOL_SCROLL_BAR_RIGHT = org/noos/xing/mydoggy/plaf/ui/icons/arrowRight.png

Color.RAB_MOUSE_IN_BORDER = black
Color.TWTB_ID_BACKGROUND_FLASHING_0 = 183,200,232

ResourceBundle = org/noos/xing/mydoggy/plaf/ui/messages/messages

Using ResourceManager

Here are some examples that show how to customize mydoggy. Remember to obtain an instance of ResourceManager you can use the following:

MyDoggyToolWindowManager toolWindowManager = new MyDoggyToolWindowManager(...);
ResourceManager resourceManager = toolWindowManager.getResourceManager();

Look at this page to understand at what i'm referring when i write TitleBar, ToolWindowTab, etc..

Supported properties

You can use the following code to set a property value:

resourceManager.putProperty("drag.icon.transparency.enabled", "false");

Here is a list of supported properties.

Name Type Description
drag.icon.transparency.enabled boolean Used to enable or disable the transparency of the drag icon.
drag.icon.useDefault boolean Used to enable or disable the use of a simple icon instead of a more complex one during the a drag phase.
ContentManagerUI.ContentManagerUiListener.import boolean Used to enable or disable the import of all listeners from an unmounting ContentManageUI to the new mmounted ContentManagerUI.
drag.toolwindow.asTab boolean Used to enable or disable dragging of toolwindows as tabs.

TransparencyManager

ToolWindow Transparency

Using the org.noos.xing.mydoggy.plaf.ui.transparency.TransparencyManager interface MyDoggy can manage the transparency of any detached window.
Specifically, when a toolwindow (with FLOATING of FLOATING_FREE type) or a detached content losts the focus, it becomes transparent in a few milliseconds.

Use JNA

JNA provides Java programs easy access to native shared libraries (e.g. DLLs on Windows) without writing anything but Java code, no JNI or native code is required. This functionality is comparable to Windows' Platform/Invoke and Python's ctypes. Access is dynamic at runtime without code generation.
You can found it at https://jna.dev.java.net/
To use JNA for transparency purpose you can use the following class...

import com.sun.jna.examples.WindowUtils;

import java.awt.*;
import java.util.Map;
import java.util.WeakHashMap;

public class JNAWindowTransparencyManager implements TransparencyManager<Window> {

    private boolean available;
    private Map<Window, Float> windowTransparencies;

    public JNAWindowTransparencyManager() {
        initTransparencyManager();
    }

    public boolean isServiceAvailable() {
        return available;
    }

    public void setAlphaModeRatio(Window component, float transparency) {
        if (available) {
            windowTransparencies.put(component, transparency);
            WindowUtils.setWindowAlpha(component, transparency);
        }
    }

    public boolean isAlphaModeEnabled(Window component) {
        if (available) {
            Float transparency = windowTransparencies.get(component);
            return transparency != null && transparency >= 0.0;
        }
        return false;
    }

    protected void initTransparencyManager() {
        available = false;
        try {
            Class.forName("com.sun.jna.examples.WindowUtils");
            available = WindowUtils.isWindowAlphaSupported();
            if (available)
                this.windowTransparencies = new WeakHashMap<Window, Float>();
        } catch (ClassNotFoundException e) {}
    }

}

To integrate the above manager in MyDoggy use the following.

MyDoggyToolWindowManager myDoggyToolWindowManager = new MyDoggyToolWindowManager(...);
myDoggyToolWindowManager.getResourceManager().setTransparencyManager(
        new JNAWindowTransparencyManager()
);