/**
  * Returns the component's children wrapped in a <code>Styleable</code>.
  *
  * @param object the object whose children are being determined
  * @return the object's children
  */
 public Styleable[] getStyleableChildren(Object object) {
   if (jsgPanel != null && jsgPanel.isInstance(object)) {
     try {
       return new Styleable[] {TypeManager.getStyleable(getScene.invoke(object))};
     } catch (Exception e) {
       throw new RuntimeException(e);
     }
   } else if (object instanceof Container) {
     Container c = (Container) object;
     Styleable[] result = new Styleable[c.getComponentCount()];
     for (int i = 0; i < result.length; i++)
       result[i] = TypeManager.getStyleable(c.getComponent(i));
     return result;
   } else return new Styleable[0];
 }
Example #2
0
 @Override
 public void setProperty(Object object, Object value) throws StylesheetException {
   Font old = (Font) super.getProperty(object);
   if (old != null) {
     // have to be careful to preserve the float size -- if the value
     // changes, PropertyManager will conclude that the value has been
     // overridden by the developer. Unfortunately deriveFont(style)
     // unexpectedly rounds the font size to an int.
     float size = ((Size) value).getSize(TypeManager.getStyleable(object), Size.Unit.PT);
     super.setProperty(object, old.deriveFont(size));
   }
 }
 /**
  * Returns the component's parent wrapped in a <code>Styleable</code>.
  *
  * @param object the object whose parent is being determined
  * @return the object's parent
  */
 public Styleable getStyleableParent(Object object) {
   Container parent = ((Component) object).getParent();
   return parent != null ? TypeManager.getStyleable(parent) : null;
 }