Hello,
I’m currently trying to implement a CustomLayout via Widgets in Vaadin.
Therefore i created the following classes:
MyCustomLayout(Server-Class)
MyCustomLayoutWidget(Client-Class)
MyCustomLayoutConnector
MyCustomLayoutState
In this Layout I’m storing the added Component with its Constraints in a Map in the MyCustomLayoutState.
But if i try to access the Map from the State my Constraints are always null.(They aren’t when they get added into the Map on the Serverside).
This is my Map in the SharedState
public Map<Connector, Constraint> childData = new HashMap<Connector, Constraint>();
And this are my Constraint and Anchor classes.
/**
* The Constraint stores the top, left, bottom and right Anchor for layouting a component.
*/
public static class Constraint implements Cloneable, Serializable
{
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class members
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** The top anchor. */
private Anchor topAnchor;
/** The left anchor. */
private Anchor leftAnchor;
/** The bottom anchor. */
private Anchor bottomAnchor;
/** The right anchor. */
private Anchor rightAnchor;
Initialization, getter setters
}
/**
* The Anchor gives the possible horizontal and vertical positions.
*/
public static class Anchor implements Serializable
{
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class members
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** Constant for horizontal anchors. */
public static final int HORIZONTAL = 0;
/** Constant for vertical anchors. */
public static final int VERTICAL = 1;
/** The orientation of this anchor. */
private int orientation;
/** The related anchor to this anchor. */
private Anchor relatedAnchor;
/** The second related anchor to this anchor. */
private Anchor secondRelatedAnchor;
/** The second related anchor to this anchor. */
private float relativePosition;
/** true, if this anchor should be auto sized. */
private boolean autoSize;
/** The position of this anchor. */
private int position;
/** True, if the anchor is not calculated by components preferred size. **/
private boolean relative;
/** True, if the relative anchor is not calculated. **/
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Initialization, getter setters
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}
Any hints why this isnt working?