aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-01-15 03:26:27 +0100
committerSven Gothel <[email protected]>2020-01-15 03:26:27 +0100
commitf56adf14deadd4ee8f434ea1293e27bcafdf2a90 (patch)
tree1aac2b29acbd458d3e47ac130aeecbcabae3ab47
parent85b332e0954af4afc9225eb84d758bee834dc497 (diff)
NEWT.Window: Add 'StringBuilder append(StringBuilder sb)' supporting building custom efficient presentations
-rw-r--r--src/newt/classes/com/jogamp/newt/Window.java9
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java13
-rw-r--r--src/newt/classes/jogamp/newt/WindowImpl.java10
3 files changed, 26 insertions, 6 deletions
diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java
index 99089d3d7..a5c0711df 100644
--- a/src/newt/classes/com/jogamp/newt/Window.java
+++ b/src/newt/classes/com/jogamp/newt/Window.java
@@ -1048,6 +1048,15 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
void runOnEDTIfAvail(boolean wait, final Runnable task);
+ /**
+ * Appends this class string representation to the given {@link StringBuilder} instance
+ * @param sb given instance where this class string representation is added to
+ * @return the given {@link StringBuilder} for chaining
+ */
+ StringBuilder append(StringBuilder sb);
+
+ @Override
+ String toString();
//
// WindowListener
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index 569780311..b448b725d 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -535,9 +535,18 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
}
@Override
+ public final StringBuilder append(final StringBuilder sb) {
+ sb.append("NEWT-GLWindow[ \n\tHelper: " + helper + ", \n\tDrawable: " + drawable +
+ ", \n\tContext: " + context + ", \n\tWindow: ");
+ window.append(sb);
+ // sb.append(", \n\tFactory: "+factory);
+ sb.append("]");
+ return sb;
+ }
+
+ @Override
public final String toString() {
- return "NEWT-GLWindow[ \n\tHelper: " + helper + ", \n\tDrawable: " + drawable +
- ", \n\tContext: " + context + ", \n\tWindow: "+window+ /** ", \n\tFactory: "+factory+ */ "]";
+ return append(new StringBuilder()).toString();
}
@Override
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index fbf448480..78da0e0ad 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -2755,9 +2755,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
@Override
- public final String toString() {
- final StringBuilder sb = new StringBuilder();
-
+ public final StringBuilder append(final StringBuilder sb) {
sb.append(getClass().getName()+"[State "+getStateMaskString()+
",\n Reconfig "+getSupportedStateMaskString()+
",\n "+screen+
@@ -2791,7 +2789,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
sb.append(keyListeners.get(i)+", ");
}
sb.append("], windowLock "+windowLock+", surfaceLockCount "+surfaceLockCount+"]");
- return sb.toString();
+ return sb;
+ }
+ @Override
+ public final String toString() {
+ return append(new StringBuilder()).toString();
}
protected final void setWindowHandle(final long handle) {