mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-13 10:42:09 +10:00
renamed misspelled property and type
This commit is contained in:
+19
-11
@@ -79,7 +79,9 @@ public abstract class AbstractLeadedComponent<T> extends AbstractLabeledComponen
|
||||
protected Color leadColor = LEAD_COLOR;
|
||||
protected Display display = Display.NAME;
|
||||
private boolean flipStanding = false;
|
||||
private LabelOriantation labelOriantation = LabelOriantation.Directional;
|
||||
@Deprecated
|
||||
private LabelOrientation labelOriantation;
|
||||
private LabelOrientation labelOrientation = LabelOrientation.Directional;
|
||||
protected boolean moveLabel = false;
|
||||
|
||||
// parameters for adjusting the label control point
|
||||
@@ -361,13 +363,13 @@ public abstract class AbstractLeadedComponent<T> extends AbstractLabeledComponen
|
||||
if (getMoveLabel()) {
|
||||
g2d.setTransform(oldTransform);
|
||||
g2d.translate(getPoints()[2].getX(), getPoints()[2].getY());
|
||||
if (getLabelOriantation() != LabelOriantation.Horizontal) {
|
||||
if (getLabelOrientation() != LabelOrientation.Horizontal) {
|
||||
g2d.rotate(theta);
|
||||
}
|
||||
StringUtils.drawCenteredText(g2d, label, offset, 0, HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
g2d.setTransform(oldTransform);
|
||||
} else {
|
||||
if (isStanding() || getLabelOriantation() == LabelOriantation.Horizontal) {
|
||||
if (isStanding() || getLabelOrientation() == LabelOrientation.Horizontal) {
|
||||
g2d.setTransform(oldTransform);
|
||||
double x = (getPoints()[0].getX() + getPoints()[1].getX() - length) / 2.0;
|
||||
double y = (getPoints()[0].getY() + getPoints()[1].getY() - width) / 2.0;
|
||||
@@ -381,7 +383,7 @@ public abstract class AbstractLeadedComponent<T> extends AbstractLabeledComponen
|
||||
}
|
||||
drawingObserver.stopTracking();
|
||||
}
|
||||
// if (getLabelOriantation() == LabelOriantation.Horizontal) {
|
||||
// if (getLabelOrientation() == LabelOrientation.Horizontal) {
|
||||
//
|
||||
// drawCenteredText(g2d, label, getNewPoints()[2].getX(), getNewPoints()[2].getX(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
// g2d.drawString(label, (int) (x + (length - textRect.getWidth()) / 2 + offset),
|
||||
@@ -698,14 +700,20 @@ public abstract class AbstractLeadedComponent<T> extends AbstractLabeledComponen
|
||||
}
|
||||
|
||||
@EditableProperty(name = "Label Orientation")
|
||||
public LabelOriantation getLabelOriantation() {
|
||||
if (labelOriantation == null)
|
||||
labelOriantation = LabelOriantation.Directional;
|
||||
return labelOriantation;
|
||||
public LabelOrientation getLabelOrientation() {
|
||||
if (labelOrientation == null) {
|
||||
if (labelOriantation != null) {
|
||||
labelOrientation = labelOriantation;
|
||||
labelOriantation = null;
|
||||
} else {
|
||||
labelOrientation = LabelOrientation.Directional;
|
||||
}
|
||||
}
|
||||
return labelOrientation;
|
||||
}
|
||||
|
||||
public void setLabelOriantation(LabelOriantation labelOriantation) {
|
||||
this.labelOriantation = labelOriantation;
|
||||
public void setLabelOrientation(LabelOrientation labelOrientation) {
|
||||
this.labelOrientation = labelOrientation;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -785,7 +793,7 @@ public abstract class AbstractLeadedComponent<T> extends AbstractLabeledComponen
|
||||
this.hideShortLeads = hideShortLeads;
|
||||
}
|
||||
|
||||
public enum LabelOriantation {
|
||||
public enum LabelOrientation {
|
||||
Directional, Horizontal
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -187,9 +187,9 @@ public class CopperTrace extends AbstractLeadedComponent<Void> implements ILayer
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public LabelOriantation getLabelOriantation() {
|
||||
public LabelOrientation getLabelOrientation() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getLabelOriantation();
|
||||
return super.getLabelOrientation();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
||||
@@ -163,9 +163,9 @@ public class Jumper extends AbstractLeadedComponent<Void> implements IContinuity
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public LabelOriantation getLabelOriantation() {
|
||||
public LabelOrientation getLabelOrientation() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getLabelOriantation();
|
||||
return super.getLabelOrientation();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -291,7 +291,7 @@ public class Line extends AbstractLeadedComponent<Void> {
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public org.diylc.components.AbstractLeadedComponent.LabelOriantation getLabelOriantation() {
|
||||
return super.getLabelOriantation();
|
||||
public org.diylc.components.AbstractLeadedComponent.LabelOrientation getLabelOrientation() {
|
||||
return super.getLabelOrientation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ public class Resistor extends AbstractLeadedComponent<Resistance> implements IGe
|
||||
|
||||
@Override
|
||||
protected int getLabelOffset(int bodyLength, int bodyWidth, int labelLength) {
|
||||
if (value == null || getColorCode() == ResistorColorCode.NONE || getLabelOriantation() != AbstractLeadedComponent.LabelOriantation.Directional)
|
||||
if (value == null || getColorCode() == ResistorColorCode.NONE || getLabelOrientation() != AbstractLeadedComponent.LabelOrientation.Directional)
|
||||
return 0;
|
||||
Color[] bands = value.getColorCode(colorCode);
|
||||
|
||||
|
||||
+17
-9
@@ -37,7 +37,7 @@ import org.diylc.awt.StringUtils;
|
||||
import org.diylc.common.*;
|
||||
import org.diylc.components.AbstractLabeledComponent;
|
||||
import org.diylc.components.RoundedPolygon;
|
||||
import org.diylc.components.AbstractLeadedComponent.LabelOriantation;
|
||||
import org.diylc.components.AbstractLeadedComponent.LabelOrientation;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -107,7 +107,9 @@ public class BridgeRectifier extends AbstractLabeledComponent<String> implements
|
||||
private Voltage voltage;
|
||||
private Current current;
|
||||
transient private Area[] body;
|
||||
private LabelOriantation labelOriantation = LabelOriantation.Directional;
|
||||
@Deprecated
|
||||
private LabelOrientation labelOriantation;
|
||||
private LabelOrientation labelOrientation = LabelOrientation.Directional;
|
||||
|
||||
public BridgeRectifier() {
|
||||
super();
|
||||
@@ -457,7 +459,7 @@ public class BridgeRectifier extends AbstractLabeledComponent<String> implements
|
||||
|
||||
AffineTransform oldTransform = g2d.getTransform();
|
||||
|
||||
if (getLabelOriantation() == LabelOriantation.Directional
|
||||
if (getLabelOrientation() == LabelOrientation.Directional
|
||||
&& (getOrientation() == Orientation.DEFAULT || getOrientation() == Orientation._180)) {
|
||||
double centerX = bounds.getX() + bounds.width / 2;
|
||||
double centerY = bounds.getY() + bounds.height / 2;
|
||||
@@ -671,14 +673,20 @@ public class BridgeRectifier extends AbstractLabeledComponent<String> implements
|
||||
}
|
||||
|
||||
@EditableProperty(name = "Label Orientation")
|
||||
public LabelOriantation getLabelOriantation() {
|
||||
if (labelOriantation == null)
|
||||
labelOriantation = LabelOriantation.Directional;
|
||||
return labelOriantation;
|
||||
public LabelOrientation getLabelOrientation() {
|
||||
if (labelOrientation == null) {
|
||||
if (labelOriantation != null) {
|
||||
labelOrientation = labelOriantation;
|
||||
labelOriantation = null;
|
||||
} else {
|
||||
labelOrientation = LabelOrientation.Directional;
|
||||
}
|
||||
}
|
||||
return labelOrientation;
|
||||
}
|
||||
|
||||
public void setLabelOriantation(LabelOriantation labelOriantation) {
|
||||
this.labelOriantation = labelOriantation;
|
||||
public void setLabelOrientation(LabelOrientation labelOrientation) {
|
||||
this.labelOrientation = labelOrientation;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -344,8 +344,8 @@ public class TapeMeasure extends AbstractLeadedComponent<String> {
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public org.diylc.components.AbstractLeadedComponent.LabelOriantation getLabelOriantation() {
|
||||
return org.diylc.components.AbstractLeadedComponent.LabelOriantation.Directional;
|
||||
public org.diylc.components.AbstractLeadedComponent.LabelOrientation getLabelOrientation() {
|
||||
return org.diylc.components.AbstractLeadedComponent.LabelOrientation.Directional;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2025 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.serialization;
|
||||
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
|
||||
import org.diylc.components.AbstractLeadedComponent;
|
||||
|
||||
public class ComponentAliasProvider implements ISerializationAliasProvider {
|
||||
|
||||
@Override
|
||||
public void registerAliases(XStream xStream) {
|
||||
// the enum shipped misspelled and its class name is saved wherever the value is held as an
|
||||
// Object (variants, defaults in config.xml); configs from before the package alias carry the
|
||||
// full name. The alias registered last is also the one written, so files stay readable by
|
||||
// older builds
|
||||
xStream.alias("org.diylc.components.AbstractLeadedComponent$LabelOriantation",
|
||||
AbstractLeadedComponent.LabelOrientation.class);
|
||||
xStream.alias("diylc.AbstractLeadedComponent$LabelOriantation",
|
||||
AbstractLeadedComponent.LabelOrientation.class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user