mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
v1 pot and label import bug
This commit is contained in:
@@ -49,6 +49,9 @@
|
|||||||
<copy todir="../diylc-swing/library" overwrite="true">
|
<copy todir="../diylc-swing/library" overwrite="true">
|
||||||
<fileset dir="${jar.dir}" includes="${ant.project.name}.jar" />
|
<fileset dir="${jar.dir}" includes="${ant.project.name}.jar" />
|
||||||
</copy>
|
</copy>
|
||||||
|
<copy todir="../diylc-core/library" overwrite="true">
|
||||||
|
<fileset dir="${jar.dir}" includes="${ant.project.name}.jar" />
|
||||||
|
</copy>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="javadoc">
|
<target name="javadoc">
|
||||||
|
|||||||
+14
-17
@@ -7,6 +7,8 @@ import java.awt.Graphics2D;
|
|||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
|
|
||||||
|
import org.diylc.common.HorizontalAlignment;
|
||||||
|
import org.diylc.common.VerticalAlignment;
|
||||||
import org.diylc.components.AbstractComponent;
|
import org.diylc.components.AbstractComponent;
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
@@ -30,8 +32,8 @@ public class Label extends AbstractComponent<Void> {
|
|||||||
private Color color = LABEL_COLOR;
|
private Color color = LABEL_COLOR;
|
||||||
@Deprecated
|
@Deprecated
|
||||||
private boolean center;
|
private boolean center;
|
||||||
private HorizontalAlignment horizontalAlignment = HorizontalAlignment.Center;
|
private HorizontalAlignment horizontalAlignment = HorizontalAlignment.CENTER;
|
||||||
private VerticalAlignment verticalAlignment = VerticalAlignment.Center;
|
private VerticalAlignment verticalAlignment = VerticalAlignment.CENTER;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Graphics2D g2d, ComponentState componentState,
|
public void draw(Graphics2D g2d, ComponentState componentState,
|
||||||
@@ -50,13 +52,13 @@ public class Label extends AbstractComponent<Void> {
|
|||||||
int x = point.x;
|
int x = point.x;
|
||||||
int y = point.y;
|
int y = point.y;
|
||||||
switch (verticalAlignment) {
|
switch (verticalAlignment) {
|
||||||
case Center:
|
case CENTER:
|
||||||
y = point.y - textHeight / 2 + fontMetrics.getAscent();
|
y = point.y - textHeight / 2 + fontMetrics.getAscent();
|
||||||
break;
|
break;
|
||||||
case Top:
|
case TOP:
|
||||||
y = point.y - textHeight + fontMetrics.getAscent();
|
y = point.y - textHeight + fontMetrics.getAscent();
|
||||||
break;
|
break;
|
||||||
case Bottom:
|
case BOTTOM:
|
||||||
y = point.y + fontMetrics.getAscent();
|
y = point.y + fontMetrics.getAscent();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -64,13 +66,13 @@ public class Label extends AbstractComponent<Void> {
|
|||||||
+ verticalAlignment);
|
+ verticalAlignment);
|
||||||
}
|
}
|
||||||
switch (horizontalAlignment) {
|
switch (horizontalAlignment) {
|
||||||
case Center:
|
case CENTER:
|
||||||
x = point.x - textWidth / 2;
|
x = point.x - textWidth / 2;
|
||||||
break;
|
break;
|
||||||
case Left:
|
case LEFT:
|
||||||
x = point.x;
|
x = point.x;
|
||||||
break;
|
break;
|
||||||
case Right:
|
case RIGHT:
|
||||||
x = point.x - textWidth;
|
x = point.x - textWidth;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -212,13 +214,16 @@ public class Label extends AbstractComponent<Void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setVerticalAlignment(VerticalAlignment verticalAlignment) {
|
public void setVerticalAlignment(VerticalAlignment verticalAlignment) {
|
||||||
|
if (verticalAlignment == null) {
|
||||||
|
verticalAlignment = VerticalAlignment.CENTER;
|
||||||
|
}
|
||||||
this.verticalAlignment = verticalAlignment;
|
this.verticalAlignment = verticalAlignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EditableProperty(name = "Horizontal alignment")
|
@EditableProperty(name = "Horizontal alignment")
|
||||||
public HorizontalAlignment getHorizontalAlignment() {
|
public HorizontalAlignment getHorizontalAlignment() {
|
||||||
if (horizontalAlignment == null) {
|
if (horizontalAlignment == null) {
|
||||||
horizontalAlignment = HorizontalAlignment.Center;
|
horizontalAlignment = HorizontalAlignment.CENTER;
|
||||||
}
|
}
|
||||||
return horizontalAlignment;
|
return horizontalAlignment;
|
||||||
}
|
}
|
||||||
@@ -240,12 +245,4 @@ public class Label extends AbstractComponent<Void> {
|
|||||||
@Override
|
@Override
|
||||||
public void setValue(Void value) {
|
public void setValue(Void value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum HorizontalAlignment {
|
|
||||||
Left, Center, Right;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum VerticalAlignment {
|
|
||||||
Top, Center, Bottom;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user