added PropertyInjector

This commit is contained in:
bancika
2011-01-02 13:16:56 +00:00
parent 6e0bcaa878
commit d4e42566a7
8 changed files with 39 additions and 5 deletions
@@ -9,6 +9,7 @@ import javax.swing.UIManager;
import org.apache.log4j.PropertyConfigurator; import org.apache.log4j.PropertyConfigurator;
import com.diyfever.diylc.gui.MainFrame; import com.diyfever.diylc.gui.MainFrame;
import com.diyfever.gui.miscutils.PropertyInjector;
/** /**
* *
@@ -28,6 +29,16 @@ public class DIYLCStarter {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
url = DIYLCStarter.class.getResource("config.properties");
properties = new Properties();
try {
properties.load(url.openStream());
PropertyInjector.injectProperties(properties);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try { try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
@@ -5,6 +5,12 @@ import java.lang.reflect.Method;
import com.diyfever.diylc.model.IComponentInstance; import com.diyfever.diylc.model.IComponentInstance;
/**
* Entity class for editable properties extracted from component objects.
* Represents a single editable property together with it's current value.
*
* @author Branislav Stojkovic
*/
public class PropertyWrapper implements Cloneable { public class PropertyWrapper implements Cloneable {
private String name; private String name;
@@ -3,6 +3,12 @@ package com.diyfever.diylc.model.annotations;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
/**
* Annotates getter for the component name that will be shown in the BOM. Only
* one getter per class may be tagged with this annotation.
*
* @author Branislav Stojkovic
*/
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface BomName { public @interface BomName {
@@ -3,6 +3,12 @@ package com.diyfever.diylc.model.annotations;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
/**
* Annotates getter for the component value that will be shown in the BOM. Only
* one getter per class may be tagged with this annotation.
*
* @author Branislav Stojkovic
*/
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface BomValue { public @interface BomValue {
@@ -7,9 +7,9 @@ import java.lang.annotation.RetentionPolicy;
import com.diyfever.diylc.model.VisibilityPolicy; import com.diyfever.diylc.model.VisibilityPolicy;
/** /**
* Annotation for control points. This annotation may be added to a field XYZ of * Annotation for control points. This annotation may be added fields of type
* type {@link Point} only when both getters and setters for that property * {@link Point} only when both getters and setters exist. Annotation is added
* exist. Annotation is added always on the getter. * always on the getter.
* *
* @author Branislav Stojkovic * @author Branislav Stojkovic
*/ */
@@ -32,7 +32,10 @@ import java.util.Map;
/** /**
* {@link Graphics2D} wrapper that keeps track of all drawing actions and * {@link Graphics2D} wrapper that keeps track of all drawing actions and
* creates an {@link Area} that corresponds to drawn objects. * creates an {@link Area} that corresponds to drawn objects. Before each
* component is drawn, {@link #startedDrawingComponent()} should be called.
* After the component is drawn, area may be retrieved using
* {@link #finishedDrawingComponent()}.
* *
* @author Branislav Stojkovic * @author Branislav Stojkovic
*/ */
@@ -71,7 +74,8 @@ class G2DWrapper extends Graphics2D {
} }
/** /**
* Resets transformation to identity. * Resets transformation to identity. Should be called only once before any
* drawing is done.
*/ */
public void resetTx() { public void resetTx() {
currentTx = new AffineTransform(); currentTx = new AffineTransform();