Initial
parent
c09e42acd2
commit
d0c72c023a
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
|
||||
<!-- for some information on what you could do (e.g. targets to override). -->
|
||||
<!-- If you delete this file and reopen the project it will be recreated. -->
|
||||
<project name="org.idp.laf" default="netbeans" basedir=".">
|
||||
<description>Builds, tests, and runs the project org.idp.laf.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
</project>
|
||||
@ -0,0 +1,7 @@
|
||||
Manifest-Version: 1.0
|
||||
AutoUpdate-Show-In-Client: true
|
||||
OpenIDE-Module: org.idp.laf
|
||||
OpenIDE-Module-Localizing-Bundle: org/idp/laf/Bundle.properties
|
||||
OpenIDE-Module-Specification-Version: 1.0
|
||||
OpenIDE-Module-Install: org/idp/laf/Installer.class
|
||||
OpenIDE-Module-Requires: org.openide.windows.WindowManager
|
||||
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
*** GENERATED FROM project.xml - DO NOT EDIT ***
|
||||
*** EDIT ../build.xml INSTEAD ***
|
||||
-->
|
||||
<project name="org.idp.laf-impl" basedir="..">
|
||||
<fail message="Please build using Ant 1.7.1 or higher.">
|
||||
<condition>
|
||||
<not>
|
||||
<antversion atleast="1.7.1"/>
|
||||
</not>
|
||||
</condition>
|
||||
</fail>
|
||||
<property file="nbproject/private/platform-private.properties"/>
|
||||
<property file="nbproject/platform.properties"/>
|
||||
<macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
|
||||
<attribute name="name"/>
|
||||
<attribute name="value"/>
|
||||
<sequential>
|
||||
<property name="@{name}" value="${@{value}}"/>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
<macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
|
||||
<attribute name="property"/>
|
||||
<attribute name="value"/>
|
||||
<sequential>
|
||||
<property name="@{property}" value="@{value}"/>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
<property file="${user.properties.file}"/>
|
||||
<nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
|
||||
<nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
|
||||
<nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
|
||||
<fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
|
||||
<condition>
|
||||
<not>
|
||||
<contains string="${cluster.path.evaluated}" substring="platform"/>
|
||||
</not>
|
||||
</condition>
|
||||
</fail>
|
||||
<import file="${harness.dir}/build.xml"/>
|
||||
</project>
|
||||
@ -0,0 +1,8 @@
|
||||
build.xml.data.CRC32=41e2275d
|
||||
build.xml.script.CRC32=1097797e
|
||||
build.xml.stylesheet.CRC32=a56c6a5b@2.67.1
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=41e2275d
|
||||
nbproject/build-impl.xml.script.CRC32=e0c60086
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.67.1
|
||||
@ -0,0 +1,15 @@
|
||||
cluster.path=\
|
||||
${nbplatform.active.dir}/java:\
|
||||
${nbplatform.active.dir}/apisupport:\
|
||||
${nbplatform.active.dir}/harness:\
|
||||
${nbplatform.active.dir}/cnd:\
|
||||
${nbplatform.active.dir}/ide:\
|
||||
${nbplatform.active.dir}/profiler:\
|
||||
${nbplatform.active.dir}/javafx:\
|
||||
${nbplatform.active.dir}/platform:\
|
||||
${nbplatform.active.dir}/dlight:\
|
||||
${nbplatform.active.dir}/extide:\
|
||||
${nbplatform.active.dir}/politenetbeans:\
|
||||
${nbplatform.active.dir}/websvccommon:\
|
||||
${nbplatform.active.dir}/nb
|
||||
nbplatform.active=default
|
||||
@ -0,0 +1,3 @@
|
||||
javac.source=1.6
|
||||
javac.compilerargs=-Xlint -Xlint:-serial
|
||||
nbm.needs.restart=true
|
||||
@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.apisupport.project</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
|
||||
<code-name-base>org.idp.laf</code-name-base>
|
||||
<standalone/>
|
||||
<module-dependencies>
|
||||
<dependency>
|
||||
<code-name-base>org.netbeans.modules.settings</code-name-base>
|
||||
<build-prerequisite/>
|
||||
<compile-dependency/>
|
||||
<run-dependency>
|
||||
<release-version>1</release-version>
|
||||
<specification-version>1.45.1</specification-version>
|
||||
</run-dependency>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<code-name-base>org.netbeans.swing.plaf</code-name-base>
|
||||
<build-prerequisite/>
|
||||
<compile-dependency/>
|
||||
<run-dependency>
|
||||
<specification-version>1.37.1</specification-version>
|
||||
</run-dependency>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<code-name-base>org.netbeans.swing.tabcontrol</code-name-base>
|
||||
<build-prerequisite/>
|
||||
<compile-dependency/>
|
||||
<run-dependency>
|
||||
<specification-version>1.51.1</specification-version>
|
||||
</run-dependency>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<code-name-base>org.openide.modules</code-name-base>
|
||||
<build-prerequisite/>
|
||||
<compile-dependency/>
|
||||
<run-dependency>
|
||||
<specification-version>7.43.1</specification-version>
|
||||
</run-dependency>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<code-name-base>org.openide.util</code-name-base>
|
||||
<build-prerequisite/>
|
||||
<compile-dependency/>
|
||||
<run-dependency>
|
||||
<specification-version>8.39.1</specification-version>
|
||||
</run-dependency>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<code-name-base>org.openide.util.lookup</code-name-base>
|
||||
<build-prerequisite/>
|
||||
<compile-dependency/>
|
||||
<run-dependency>
|
||||
<specification-version>8.25.1</specification-version>
|
||||
</run-dependency>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<code-name-base>org.openide.windows</code-name-base>
|
||||
<build-prerequisite/>
|
||||
<compile-dependency/>
|
||||
<run-dependency>
|
||||
<specification-version>6.71.1</specification-version>
|
||||
</run-dependency>
|
||||
</dependency>
|
||||
</module-dependencies>
|
||||
<public-packages>
|
||||
<package>org.idp.laf</package>
|
||||
</public-packages>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
||||
@ -0,0 +1 @@
|
||||
OpenIDE-Module-Name=[idP!] Crew LAF
|
||||
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.idp.laf;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
import org.openide.modules.ModuleInstall;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Edward M. Kagan <root@paganware.com>
|
||||
*/
|
||||
public class Installer extends ModuleInstall
|
||||
{
|
||||
|
||||
@Override
|
||||
public void restored() {
|
||||
SwingUtilities.invokeLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
LAF_killer.load_ui();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,315 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.idp.laf;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.UnsupportedLookAndFeelException;
|
||||
import javax.swing.plaf.metal.DefaultMetalTheme;
|
||||
import javax.swing.plaf.metal.MetalLookAndFeel;
|
||||
import javax.swing.plaf.metal.MetalTheme;
|
||||
import org.idp.laf.settings.Color;
|
||||
import static org.idp.laf.settings.Color.ColorClass.AT;
|
||||
import static org.idp.laf.settings.Color.ColorClass.SS;
|
||||
import static org.idp.laf.settings.Color.ColorClass.SF;
|
||||
import org.idp.laf.settings.Font;
|
||||
import static org.idp.laf.settings.Font.FontClass.FA;
|
||||
import static org.idp.laf.settings.Font.FontClass.FS;
|
||||
import org.idp.laf.settings.Gradient;
|
||||
import org.openide.util.Exceptions;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Edward M. Kagan <root@paganware.com>
|
||||
*/
|
||||
public class LAF_killer {
|
||||
|
||||
public static void load_ui(){
|
||||
|
||||
try {
|
||||
// if (UIManager.getLookAndFeel().getName().equals("Metal"))
|
||||
// {
|
||||
// System.out.println(">>> Hmmm... You smart enought to use Metal theme - OK.");
|
||||
// MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
|
||||
// System.out.println(">>>> l&f NAME = " + UIManager.getLookAndFeel().getName() + " / " + javax.swing.plaf.metal.MetalLookAndFeel.getCurrentTheme().getName());
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
|
||||
System.out.println(">>>> TRYING TO CHANGE L&F");
|
||||
MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
|
||||
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
|
||||
System.out.println(">>>> l&f NAME = " + UIManager.getLookAndFeel().getName() + " / " + javax.swing.plaf.metal.MetalLookAndFeel.getCurrentTheme().getName());
|
||||
//}
|
||||
|
||||
Object [] keys = new Object[UIManager.getLookAndFeelDefaults().keySet().size()];
|
||||
|
||||
String settings = "";
|
||||
|
||||
UIManager.getLookAndFeelDefaults().keySet().toArray(keys);
|
||||
|
||||
//dump (keys);
|
||||
load ();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} catch (ClassNotFoundException ex) {
|
||||
Logger.getLogger(LAF_killer.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (InstantiationException ex) {
|
||||
Logger.getLogger(LAF_killer.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (IllegalAccessException ex) {
|
||||
Logger.getLogger(LAF_killer.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (UnsupportedLookAndFeelException ex) {
|
||||
Logger.getLogger(LAF_killer.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static void dump(Object [] keys)
|
||||
{
|
||||
|
||||
ArrayList<Color> color_map = new ArrayList<Color>();
|
||||
ArrayList<Font> font_map = new ArrayList<Font>();
|
||||
ArrayList<Gradient> gradient_map = new ArrayList<Gradient>();
|
||||
|
||||
for (int i = 0; i < keys.length; i ++)
|
||||
{
|
||||
|
||||
if (UIManager.getDefaults().get(keys[i]) != null){
|
||||
//This check is needed to overcome null_pointer on first run for this shitty icons
|
||||
// 269 >> Menu.checkIcon : null
|
||||
// 272 >> MenuItem.checkIcon : null
|
||||
|
||||
|
||||
// <editor-fold desc="Extracting colors">
|
||||
if (UIManager.getDefaults().get(keys[i]).getClass().equals(javax.swing.plaf.ColorUIResource.class))
|
||||
{
|
||||
javax.swing.plaf.ColorUIResource color = (javax.swing.plaf.ColorUIResource) UIManager.getDefaults().get(keys[i]);
|
||||
Color c = new Color (keys[i].toString(), SF, color.getRed(),color.getGreen(),color.getBlue(),color.getAlpha());
|
||||
color_map.add(c);
|
||||
}
|
||||
else if (UIManager.getDefaults().get(keys[i]).getClass().equals(sun.swing.PrintColorUIResource.class))
|
||||
{
|
||||
sun.swing.PrintColorUIResource color = (sun.swing.PrintColorUIResource) UIManager.getDefaults().get(keys[i]);
|
||||
Color c = new Color (keys[i].toString(), SS, color.getRed(),color.getGreen(),color.getBlue(),color.getAlpha());
|
||||
color_map.add(c);
|
||||
}
|
||||
else if (UIManager.getDefaults().get(keys[i]).getClass().equals(java.awt.Color.class))
|
||||
{
|
||||
java.awt.Color color = (java.awt.Color) UIManager.getDefaults().get(keys[i]);
|
||||
Color c = new Color (keys[i].toString(), AT, color.getRed(),color.getGreen(),color.getBlue(),color.getAlpha());
|
||||
color_map.add(c);
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
// <editor-fold desc="Extracting fonts">
|
||||
|
||||
else if (UIManager.getDefaults().get(keys[i]).getClass().equals(javax.swing.plaf.FontUIResource.class))
|
||||
{
|
||||
javax.swing.plaf.FontUIResource fnt = (javax.swing.plaf.FontUIResource) UIManager.getDefaults().get(keys[i]);
|
||||
Font f = new Font (keys[i].toString(), FS, fnt.getFamily(), fnt.getName(), fnt.getStyle(), fnt.getSize());
|
||||
font_map.add(f);
|
||||
|
||||
// System.out.println(i + " FX>> " + keys[i] + " : " + UIManager.getDefaults().get(keys[i]));
|
||||
}
|
||||
else if (UIManager.getDefaults().get(keys[i]).getClass().equals(java.awt.Font.class))
|
||||
{
|
||||
java.awt.Font fnt = (java.awt.Font) UIManager.getDefaults().get(keys[i]);
|
||||
Font f = new Font (keys[i].toString(), FA, fnt.getFamily(), fnt.getName(), fnt.getStyle(), fnt.getSize());
|
||||
font_map.add(f);
|
||||
//System.out.println(i + " FY>> " + keys[i] + " : " + UIManager.getDefaults().get(keys[i]));
|
||||
}
|
||||
|
||||
// </editor-fold>
|
||||
|
||||
// <editor-fold desc="Extracting gradients">
|
||||
//
|
||||
else if (keys[i].equals("MenuBar.gradient") ||
|
||||
keys[i].equals("ScrollBar.gradient") ||
|
||||
keys[i].equals("ToggleButton.gradient") ||
|
||||
keys[i].equals("CheckBoxMenuItem.gradient") ||
|
||||
keys[i].equals("Slider.gradient") ||
|
||||
keys[i].equals("Button.gradient") ||
|
||||
keys[i].equals("CheckBox.gradient") ||
|
||||
keys[i].equals("RadioButtonMenuItem.gradient") ||
|
||||
keys[i].equals("Slider.focusGradient") ||
|
||||
keys[i].equals("RadioButton.gradient") ||
|
||||
keys[i].equals("InternalFrame.activeTitleGradient")
|
||||
)
|
||||
{
|
||||
//ArrayList always
|
||||
//System.out.println(i + " GY>> " + UIManager.getDefaults().get(keys[i]));
|
||||
List grad = (List) UIManager.getDefaults().get(keys[i]);
|
||||
// for (int j = 0; j < grad.size(); j ++)
|
||||
// {
|
||||
// System.out.println(i + " >> " + grad.get(j).getClass());
|
||||
// }
|
||||
|
||||
Gradient g = new Gradient(keys[i].toString(), ((Float)grad.get(0)), ((Float)grad.get(1)),
|
||||
new Color ((javax.swing.plaf.ColorUIResource) grad.get(2)),
|
||||
new Color ((javax.swing.plaf.ColorUIResource) grad.get(3)),
|
||||
new Color ((javax.swing.plaf.ColorUIResource) grad.get(4)));
|
||||
gradient_map.add(g);
|
||||
}
|
||||
|
||||
// </editor-fold>
|
||||
|
||||
}
|
||||
else // Shitty test for unknown values - dont bother at all
|
||||
{
|
||||
System.out.println(i + " >> " + keys[i] + " : " + UIManager.getDefaults().get(keys[i]));
|
||||
}
|
||||
|
||||
}
|
||||
// Looks scientific? Yeah, it's a formal test :)
|
||||
//
|
||||
// System.out.println("=============== <COLOR MAP> ===============");
|
||||
// for (int i = 0; i < color_map.size(); i ++)
|
||||
// {
|
||||
// System.out.println(i + " : " + color_map.get(i));
|
||||
// }
|
||||
// System.out.println("=============== <FONT MAP> ===============");
|
||||
// for (int i = 0; i < font_map.size(); i ++)
|
||||
// {
|
||||
// System.out.println(i + " : " + font_map.get(i));
|
||||
// }
|
||||
// System.out.println("=============== <GRADIENT MAP> ===============");
|
||||
// for (int i = 0; i < gradient_map.size(); i ++)
|
||||
// {
|
||||
// System.out.println(i + " : " + gradient_map.get(i));
|
||||
// }
|
||||
|
||||
if (!new File (System.getProperty("user.home") + File.separator + ".idp_scheme").exists())
|
||||
{
|
||||
new File (System.getProperty("user.home") + File.separator + ".idp_scheme").mkdir();
|
||||
}
|
||||
|
||||
// File fileC = new File ();
|
||||
// File fileF = new File (System.getProperty("user.home") + File.separator + ".idp_scheme/.ui_fonts");
|
||||
// File fileG = new File (System.getProperty("user.home") + File.separator + ".idp_scheme/.ui_gradients");
|
||||
|
||||
|
||||
try {
|
||||
PrintWriter writer = new PrintWriter(System.getProperty("user.home") + File.separator + ".idp_scheme/.ui_colors", "UTF-8");
|
||||
for (int i = 0; i < color_map.size(); i ++)
|
||||
{
|
||||
writer.println(color_map.get(i));
|
||||
}
|
||||
writer.close();
|
||||
|
||||
writer = new PrintWriter(System.getProperty("user.home") + File.separator + ".idp_scheme/.ui_fonts", "UTF-8");
|
||||
for (int i = 0; i < font_map.size(); i ++)
|
||||
{
|
||||
writer.println(font_map.get(i));
|
||||
}
|
||||
writer.close();
|
||||
|
||||
writer = new PrintWriter(System.getProperty("user.home") + File.separator + ".idp_scheme/.ui_gradients", "UTF-8");
|
||||
for (int i = 0; i < gradient_map.size(); i ++)
|
||||
{
|
||||
System.out.println(gradient_map.get(i));
|
||||
writer.println(gradient_map.get(i));
|
||||
}
|
||||
writer.close();
|
||||
|
||||
} catch (FileNotFoundException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (IOException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static void load()
|
||||
{
|
||||
|
||||
ArrayList<Color> color_map = new ArrayList<Color>();
|
||||
ArrayList<Font> font_map = new ArrayList<Font>();
|
||||
ArrayList<Gradient> gradient_map = new ArrayList<Gradient>();
|
||||
|
||||
try {
|
||||
if (!new File (System.getProperty("user.home") + File.separator + ".idp_scheme").exists())
|
||||
{
|
||||
System.err.println("FUCK OFF!");
|
||||
}
|
||||
else
|
||||
{
|
||||
List<String> C = Files.readAllLines(Paths.get(System.getProperty("user.home") + File.separator + ".idp_scheme/.ui_colors"), Charset.forName("UTF-8"));
|
||||
for (String s : C)
|
||||
{
|
||||
color_map.add(new Color (s));
|
||||
}
|
||||
|
||||
List<String> F = Files.readAllLines(Paths.get(System.getProperty("user.home") + File.separator + ".idp_scheme/.ui_fonts"), Charset.forName("UTF-8"));
|
||||
for (String s : F)
|
||||
{
|
||||
font_map.add(new Font (s));
|
||||
}
|
||||
|
||||
List<String> G = Files.readAllLines(Paths.get(System.getProperty("user.home") + File.separator + ".idp_scheme/.ui_gradients"), Charset.forName("UTF-8"));
|
||||
for (String s : G)
|
||||
{
|
||||
gradient_map.add(new Gradient (s));
|
||||
}
|
||||
|
||||
|
||||
System.out.println("=============== <COLOR MAP> ===============");
|
||||
for (int i = 0; i < color_map.size(); i ++)
|
||||
{
|
||||
System.out.println(i + " : " + color_map.get(i));
|
||||
UIManager.put(color_map.get(i).getName(), color_map.get(i).getObject());
|
||||
}
|
||||
System.out.println("=============== <FONT MAP> ===============");
|
||||
for (int i = 0; i < font_map.size(); i ++)
|
||||
{
|
||||
System.out.println(i + " : " + font_map.get(i));
|
||||
UIManager.put(font_map.get(i).getName(), font_map.get(i).getObject());
|
||||
}
|
||||
System.out.println("=============== <GRADIENT MAP> ===============");
|
||||
for (int i = 0; i < gradient_map.size(); i ++)
|
||||
{
|
||||
System.out.println(i + " : " + gradient_map.get(i));
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
} catch (IOException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,139 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.idp.laf.settings;
|
||||
|
||||
import java.io.Serializable;
|
||||
import javax.swing.plaf.ColorUIResource;
|
||||
import static org.idp.laf.settings.Color.ColorClass.AT;
|
||||
import static org.idp.laf.settings.Color.ColorClass.SF;
|
||||
import static org.idp.laf.settings.Color.ColorClass.SS;
|
||||
import sun.swing.PrintColorUIResource;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Edward M. Kagan <root@paganware.com>
|
||||
*/
|
||||
public class Color implements Serializable{
|
||||
|
||||
|
||||
|
||||
public enum ColorClass {
|
||||
SF (javax.swing.plaf.ColorUIResource.class),
|
||||
SS (sun.swing.PrintColorUIResource.class),
|
||||
AT (java.awt.Color.class);
|
||||
|
||||
private final Class cls;
|
||||
|
||||
ColorClass(Class cls) {
|
||||
this.cls = cls;
|
||||
}
|
||||
|
||||
public Class getClazz()
|
||||
{
|
||||
return this.cls;
|
||||
}
|
||||
}
|
||||
|
||||
int R;
|
||||
int G;
|
||||
int B;
|
||||
int A;
|
||||
String pname;
|
||||
ColorClass cls;
|
||||
|
||||
|
||||
public Color(javax.swing.plaf.ColorUIResource color) {
|
||||
this.A = color.getAlpha();
|
||||
this.B = color.getBlue();
|
||||
this.G = color.getGreen();
|
||||
this.R = color.getRed();
|
||||
this.pname = "_";
|
||||
this.cls = SF;
|
||||
}
|
||||
|
||||
public Color(String pname, ColorClass cls, int red, int green, int blue, int alpha) {
|
||||
this.A = alpha;
|
||||
this.B = blue;
|
||||
this.G = green;
|
||||
this.R = red;
|
||||
this.pname = pname;
|
||||
this.cls = cls;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "C[" + this.pname + ":" + this.cls + ":" + R + "," + G + "," + B + "," + A + "]";
|
||||
}
|
||||
|
||||
public String toStringC() {
|
||||
return "[" + this.pname + ":" + this.cls + ":" + R + "," + G + "," + B + "," + A + "]";
|
||||
}
|
||||
|
||||
public Color (String str)
|
||||
{
|
||||
if (str.startsWith("C"))
|
||||
{
|
||||
String real = str.substring(2, str.length() - 1);
|
||||
String [] vals = real.split(":");
|
||||
|
||||
this.pname = vals[0];
|
||||
if (vals[1].equals("SF"))
|
||||
{
|
||||
this.cls = SF;
|
||||
}
|
||||
else if (vals[1].equals("SS"))
|
||||
{
|
||||
this.cls = SS;
|
||||
}
|
||||
else if (vals[1].equals("AT"))
|
||||
{
|
||||
this.cls = AT;
|
||||
}
|
||||
|
||||
vals = vals[2].split(",");
|
||||
|
||||
|
||||
this.R = Integer.parseInt(vals[0]);
|
||||
this.G = Integer.parseInt(vals[1]);
|
||||
this.B = Integer.parseInt(vals[2]);
|
||||
this.A = Integer.parseInt(vals[3]);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
System.err.println("FUCK OFF - poor format");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Object getObject ()
|
||||
{
|
||||
java.awt.Color cc = new java.awt.Color(R, G, B, A);
|
||||
switch (this.cls)
|
||||
{
|
||||
|
||||
case SF : {
|
||||
|
||||
javax.swing.plaf.ColorUIResource res = new ColorUIResource(cc);
|
||||
return res;
|
||||
}
|
||||
case SS : {
|
||||
sun.swing.PrintColorUIResource res = new PrintColorUIResource(cc.getRGB(), cc);
|
||||
return res;
|
||||
}
|
||||
case AT : {
|
||||
return cc;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object getName() {
|
||||
return this.pname;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,116 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.idp.laf.settings;
|
||||
|
||||
import java.io.Serializable;
|
||||
import javax.swing.plaf.ColorUIResource;
|
||||
import javax.swing.plaf.FontUIResource;
|
||||
import static org.idp.laf.settings.Color.ColorClass.AT;
|
||||
import static org.idp.laf.settings.Color.ColorClass.SF;
|
||||
import static org.idp.laf.settings.Color.ColorClass.SS;
|
||||
import static org.idp.laf.settings.Font.FontClass.FA;
|
||||
import static org.idp.laf.settings.Font.FontClass.FS;
|
||||
import sun.swing.PrintColorUIResource;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Edward M. Kagan <root@paganware.com>
|
||||
*/
|
||||
public class Font implements Serializable{
|
||||
|
||||
public enum FontClass {
|
||||
FS (javax.swing.plaf.FontUIResource.class),
|
||||
FA (java.awt.Font.class);
|
||||
|
||||
private final Class cls;
|
||||
|
||||
FontClass(Class cls) {
|
||||
this.cls = cls;
|
||||
}
|
||||
|
||||
public Class getClazz()
|
||||
{
|
||||
return this.cls;
|
||||
}
|
||||
}
|
||||
|
||||
String family;
|
||||
String name;
|
||||
int style;
|
||||
int size;
|
||||
String pname;
|
||||
FontClass cls;
|
||||
|
||||
|
||||
public Font(String pname, FontClass cls, String family, String name, int style, int size) {
|
||||
this.family = family;
|
||||
this.name = name;
|
||||
this.size = size;
|
||||
this.style = style;
|
||||
this.pname = pname;
|
||||
this.cls = cls;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "F[" + this.pname + ":" + this.cls + ":" + family + "," + name + "," + size + "," + style + "]";
|
||||
}
|
||||
|
||||
public Font (String str)
|
||||
{
|
||||
if (str.startsWith("F"))
|
||||
{
|
||||
String real = str.substring(2, str.length() - 1);
|
||||
String [] vals = real.split(":");
|
||||
|
||||
this.pname = vals[0];
|
||||
if (vals[1].equals("FS"))
|
||||
{
|
||||
this.cls = FS;
|
||||
}
|
||||
else if (vals[1].equals("FA"))
|
||||
{
|
||||
this.cls = FA;
|
||||
}
|
||||
|
||||
vals = vals[2].split(",");
|
||||
|
||||
|
||||
this.family = vals[0];
|
||||
this.name = vals[1];
|
||||
this.size = Integer.parseInt(vals[2]);
|
||||
this.style = Integer.parseInt(vals[3]);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
System.err.println("FUCK OFF - poor format");
|
||||
}
|
||||
}
|
||||
|
||||
public Object getObject ()
|
||||
{
|
||||
java.awt.Font ff = new java.awt.Font(name, style, size);
|
||||
|
||||
switch (this.cls)
|
||||
{
|
||||
case FS : {
|
||||
javax.swing.plaf.FontUIResource res = new FontUIResource(ff);
|
||||
return res;
|
||||
}
|
||||
case FA : {
|
||||
return ff;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object getName() {
|
||||
return this.pname;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.idp.laf.settings;
|
||||
|
||||
import java.io.Serializable;
|
||||
import static org.idp.laf.settings.Font.FontClass.FA;
|
||||
import static org.idp.laf.settings.Font.FontClass.FS;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Edward M. Kagan <root@paganware.com>
|
||||
*/
|
||||
public class Gradient implements Serializable{
|
||||
|
||||
String pname;
|
||||
float I;
|
||||
float J;
|
||||
Color A;
|
||||
Color B;
|
||||
Color C;
|
||||
|
||||
public Gradient(String pname, float I, float J, Color A, Color B, Color C) {
|
||||
this.pname = pname;
|
||||
this.I = I;
|
||||
this.J = J;
|
||||
this.A = A;
|
||||
this.B = B;
|
||||
this.C = C;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "G[" + this.pname + ";" + I + ";" + J + ";" + A.toString() + ";" + B.toString() + ";" + C.toString() + "]";
|
||||
}
|
||||
|
||||
public Gradient (String str)
|
||||
{
|
||||
if (str.startsWith("G"))
|
||||
{
|
||||
String real = str.substring(2, str.length() - 1);
|
||||
String [] vals = real.split(";");
|
||||
|
||||
this.pname = vals[0];
|
||||
System.out.println(">>" + vals[1]);
|
||||
this.I = Float.parseFloat(vals[1]);
|
||||
this.J = Float.parseFloat(vals[2]);
|
||||
this.A = new Color(vals[3]);
|
||||
this.B = new Color(vals[4]);
|
||||
this.C = new Color(vals[5]);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.err.println("FUCK OFF - poor format");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue