}
@Override
- public void render(Graphics2D g2d) {
- Vec2d delta = getDelta(FACTOR);
- if(delta != null)
- setTransform(AffineTransform.getTranslateInstance(delta.x, delta.y-2.1*computeRows()*(up ? 1.0 : 0.0)));
- else
- setTransform(AffineTransform.getTranslateInstance(0, -2.1*computeRows()*(up ? 1.0 : 0.0)));
- super.render(g2d);
+ public void refresh() {
+ Vec2d delta = getDelta(FACTOR);
+ if(delta != null)
+ setTransform(AffineTransform.getTranslateInstance(delta.x, delta.y-2.1*computeRows()*(up ? 1.0 : 0.0)));
+ else
+ setTransform(AffineTransform.getTranslateInstance(0, -2.1*computeRows()*(up ? 1.0 : 0.0)));
+ super.refresh();
}
@Override
return true;
}
+ @Override
+ public void refresh() {
+ }
+
@Override
public void cleanup() {
retractMapping();
g2d.setTransform(ot);
}
+ @Override
+ public void refresh() {
+ for (IG2DNode node : getSortedNodes()) {
+ if (node.validate()) {
+ node.refresh();
+ }
+ }
+ }
+
@Override
public void accept(IG2DNodeVisitor visitor) {
visitor.enter(this);
public void synchronizeTransform(double[] data) {
this.setTransform(new AffineTransform(data));
}
+
}
return focusNode;
}
- @Override
+ @Override
public void render(Graphics2D g2d) {
- performCleanup();
+ refresh();
Component rootPane = getRootPane();
if (rootPane != null)
g2d.setRenderingHint(G2DRenderingHints.KEY_COMPONENT, rootPane);
}
}
+ @Override
+ public void refresh() {
+ performCleanup();
+ super.refresh();
+ }
+
/**
* Util method for executing updates to scenegraph tree
* NOTE: You should really consider performance issues when using this
public boolean validate();
/**
- * Perform the actual rendering. Node state changes should be avoided in
- * this method. This method should not change the transform of the g2d
+ * Perform the actual rendering. Node state changes must be avoided in
+ * this method. Implement node state changes to refresh method instead.
+ * This method should not change the transform of the g2d
* instance. You should call g2d.create or copy the original transform and
* put it back at the end of this method according to what is specified in
* {@link Graphics2D#setTransform(AffineTransform)}.
* @see #getTransform()
*/
public void render(Graphics2D g2d);
-
+
+ /**
+ * Refresh the node state.
+ */
+ public void refresh();
+
/**
* Visit the IG2DNode substructure of this node using the provided visitor.
*