Class FPMI_LC
- java.lang.Object
-
- com.inductiveautomation.factorypmi.application.components.util.FPMI_LC
-
public class FPMI_LC extends java.lang.Object
Vision Layout constraints object, used with FPMILayout to hold the "layout constraints" (LC) of a component. This is a bit of a mess because of backwards compatibility, here's the explanation:
Originally, Components stored a java.awt.Point as a client property under the key FPMILayout.PREF_LOCATION. They also stored their layout options under a LAYOUT_FLAGS client prop, as well as font scaling options.
Then we introduced the FPMI_LC class primarily because it allowed us a more compact serialization mechanism. The constructor
FPMI_LC(javax.swing.JComponent)
fills in its fields from the older style client properties. At this point, a component's preferred location was stored in the FPMI_LC, it's preferred size was stored in it's Dimension preferredSize, and it's actual location was stored in its Rectangle boundsNow, fast-forward to 7.3 with the introduction of vector shapes. These shapes are radically different, and can't use either of the Swing constructs preferredSize or bounds. So they have two Rectangle2Ds on them instead: originalBounds (a.k.a. preferred size+preferred location), and boundingRect
We realized how useful it is to store everything in floating precision, so we changed preferredLocation to a Point2D, and started storing what was the Dimension preferredSize as a Point2D client property under the key FPMILayout.PREF_SIZE_2D where x=width and y=height, and the actual bounds as a Rectangle2D under client property FPMILayout.BOUNDS_2D
Conveniently, the functions
FPMILayout.getPreferredBounds(javax.swing.JComponent)
andFPMILayout.getBounds(javax.swing.JComponent)
make neat work of this confusion. these methods (and their setters) should be the only way that bounds get accessed.
-
-
Constructor Summary
Constructors Constructor Description FPMI_LC()
Creates a new, default constraints objectFPMI_LC(int flags)
FPMI_LC(java.awt.geom.Point2D preferredLocation, java.lang.Integer flags, java.lang.Boolean disableFontScale, java.lang.Float ratioX, java.lang.Float ratioY)
Constructor that takes in all properties
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Boolean
getDisableFontScale()
java.lang.Integer
getFlags()
java.lang.Float
getFontRatioX()
java.lang.Float
getFontRatioY()
java.awt.geom.Point2D
getPreferredLocation()
void
setDisableFontScale(java.lang.Boolean disableFontScale)
void
setFlags(java.lang.Integer flags)
void
setFontRatioX(java.lang.Float ratioX)
void
setFontRatioY(java.lang.Float ratioY)
void
setPreferredLocation(java.awt.geom.Point2D preferredLocation)
-
-
-
Constructor Detail
-
FPMI_LC
public FPMI_LC()
Creates a new, default constraints object
-
FPMI_LC
public FPMI_LC(int flags)
-
FPMI_LC
public FPMI_LC(java.awt.geom.Point2D preferredLocation, java.lang.Integer flags, java.lang.Boolean disableFontScale, java.lang.Float ratioX, java.lang.Float ratioY)
Constructor that takes in all properties
-
-
Method Detail
-
getPreferredLocation
public java.awt.geom.Point2D getPreferredLocation()
-
setPreferredLocation
public void setPreferredLocation(java.awt.geom.Point2D preferredLocation)
-
getFlags
public java.lang.Integer getFlags()
-
setFlags
public void setFlags(java.lang.Integer flags)
-
getDisableFontScale
public java.lang.Boolean getDisableFontScale()
-
setDisableFontScale
public void setDisableFontScale(java.lang.Boolean disableFontScale)
-
getFontRatioX
public java.lang.Float getFontRatioX()
-
setFontRatioX
public void setFontRatioX(java.lang.Float ratioX)
-
getFontRatioY
public java.lang.Float getFontRatioY()
-
setFontRatioY
public void setFontRatioY(java.lang.Float ratioY)
-
-