java.lang.Object
com.inductiveautomation.factorypmi.application.components.util.FPMI_LC

public class FPMI_LC extends 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 bounds

Now, 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) and FPMILayout.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 Details

    • FPMI_LC

      public FPMI_LC()
      Creates a new, default constraints object
    • FPMI_LC

      public FPMI_LC(int flags)
    • FPMI_LC

      public FPMI_LC(Point2D preferredLocation, Integer flags, Boolean disableFontScale, Float ratioX, Float ratioY)
      Constructor that takes in all properties
  • Method Details

    • getPreferredLocation

      public Point2D getPreferredLocation()
    • setPreferredLocation

      public void setPreferredLocation(Point2D preferredLocation)
    • getFlags

      public Integer getFlags()
    • setFlags

      public void setFlags(Integer flags)
    • getDisableFontScale

      public Boolean getDisableFontScale()
    • setDisableFontScale

      public void setDisableFontScale(Boolean disableFontScale)
    • getFontRatioX

      public Float getFontRatioX()
    • setFontRatioX

      public void setFontRatioX(Float ratioX)
    • getFontRatioY

      public Float getFontRatioY()
    • setFontRatioY

      public void setFontRatioY(Float ratioY)