/**
  * Calculates the size of the unit bar.
  *
  * @param ratio The ratio to multiple the value by.
  * @return
  */
 private double getBarSize(double ratio) {
   double v = unitInRefUnits;
   double t = EditorUtil.transformSize(getPixelsSizeX()).getValue();
   if (t > 0) v = unitInRefUnits / t;
   v *= ratio;
   return v;
 }
 /**
  * Sets the value of the flag controlling if the unit bar is painted or not.
  *
  * @param unitBar Pass <code>true</code> to paint the unit bar, <code>false</code> otherwise.
  */
 void setUnitBar(boolean unitBar) {
   double v = EditorUtil.transformSize(parent.getPixelsSizeX()).getValue();
   if (v == 0 || v == 1) unitBar = false;
   this.unitBar = unitBar;
 }