aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-01-16 00:52:24 +0100
committerSven Gothel <[email protected]>2020-01-16 00:52:24 +0100
commita0a2278721a1b0a8c5acc78d4d42b7cd7efeb47d (patch)
tree723e5640f24e8661cd62628d970179d4b34edb20 /src/newt/classes/com/jogamp
parentd671b2ab3badbcfdbe0ff57f55ff997ba7bcb060 (diff)
NEWT.Window: Refine string representation, renamed append(StringBuilder) -> toString(..), added toSimpleString(..)
This also revised commit f56adf14deadd4ee8f434ea1293e27bcafdf2a90 Window API addition of 'append(StringBuilder)', which has been renamed to 'toString(StringBuilder)' as aligned to out other classes.
Diffstat (limited to 'src/newt/classes/com/jogamp')
-rw-r--r--src/newt/classes/com/jogamp/newt/Window.java24
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java28
-rw-r--r--src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java22
3 files changed, 53 insertions, 21 deletions
diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java
index a5c0711df..607ed285c 100644
--- a/src/newt/classes/com/jogamp/newt/Window.java
+++ b/src/newt/classes/com/jogamp/newt/Window.java
@@ -1049,12 +1049,30 @@ 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
+ * Appends this class simple string one-line representation to the given {@link StringBuilder} instance
+ * @param sb given instance where this class simple string representation is added to
* @return the given {@link StringBuilder} for chaining
*/
- StringBuilder append(StringBuilder sb);
+ StringBuilder toSimpleString(StringBuilder sb);
+ /**
+ * Returns a simple string one-line representation of this instance using {@link #toSimpleString(StringBuilder)}.
+ */
+ String toSimpleString();
+
+ /**
+ * Appends this class full string multi-line representation to the given {@link StringBuilder} instance
+ * @param sb given instance where this class full string representation is added to
+ * @return the given {@link StringBuilder} for chaining
+ */
+ StringBuilder toString(StringBuilder sb);
+
+ /**
+ * Returns a full string multi-line representation of this instance using {@link #toString(StringBuilder)}.
+ * <p>
+ * {@inheritDoc}
+ * </p>
+ */
@Override
String toString();
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index b448b725d..1da287102 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -67,6 +67,7 @@ import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.GLRunnable;
import com.jogamp.opengl.GLSharedContextSetter;
+import jogamp.common.os.PlatformPropsImpl;
import jogamp.newt.WindowImpl;
import jogamp.opengl.GLAutoDrawableBase;
import jogamp.opengl.GLContextImpl;
@@ -535,18 +536,31 @@ 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("]");
+ public final StringBuilder toSimpleString(final StringBuilder sb) {
+ sb.append("GLWindow[");
+ window.toSimpleString(sb).append("]");
+ return sb;
+ }
+ @Override
+ public final String toSimpleString() {
+ return toSimpleString(new StringBuilder()).toString();
+ }
+ @Override
+ public final StringBuilder toString(final StringBuilder sb) {
+ sb.append("GLWindow").append("[")
+ .append(PlatformPropsImpl.NEWLINE).append("\t").append("Helper: ").append(helper)
+ .append(", ").append(PlatformPropsImpl.NEWLINE).append("\t").append("Drawable: ").append(drawable)
+ .append(", ").append(PlatformPropsImpl.NEWLINE).append("\t").append("Context: ").append(context)
+ .append(", ").append(PlatformPropsImpl.NEWLINE).append("\t").append("Window: ");
+ window.toString(sb)
+ // .append(", ").append(Platform.NEWLINE).append("\t").append("Factory: ").append(factory)
+ .append("]");
return sb;
}
@Override
public final String toString() {
- return append(new StringBuilder()).toString();
+ return toString(new StringBuilder()).toString();
}
@Override
diff --git a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
index 2615ebbb5..0e58b389d 100644
--- a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
+++ b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
@@ -206,7 +206,7 @@ public class NewtCanvasSWT extends Canvas implements NativeWindowHolder, WindowC
case SWT.Paint:
if( DEBUG ) {
System.err.println(shortName()+".Event.PAINT, "+event);
- System.err.println(shortName()+".Event.PAINT, "+newtChild.getDelegatedWindow());
+ System.err.println(shortName()+".Event.PAINT, "+newtChild.getDelegatedWindow().toSimpleString());
}
if( validateNative() && newtChildReady ) {
if( postSetSize ) {
@@ -223,13 +223,13 @@ public class NewtCanvasSWT extends Canvas implements NativeWindowHolder, WindowC
case SWT.Move:
if( DEBUG ) {
System.err.println(shortName()+".Event.MOVE, "+event);
- System.err.println(shortName()+".Event.MOVE, "+newtChild.getDelegatedWindow());
+ System.err.println(shortName()+".Event.MOVE, "+newtChild.getDelegatedWindow().toSimpleString());
}
break;
case SWT.Show:
if( DEBUG ) {
System.err.println(shortName()+".Event.SHOW, "+event);
- System.err.println(shortName()+".Event.SHOW, "+newtChild.getDelegatedWindow());
+ System.err.println(shortName()+".Event.SHOW, "+newtChild.getDelegatedWindow().toSimpleString());
}
if( newtChildReady ) {
newtChild.setVisible(true /* wait */, true /* visible */);
@@ -238,7 +238,7 @@ public class NewtCanvasSWT extends Canvas implements NativeWindowHolder, WindowC
case SWT.Hide:
if( DEBUG ) {
System.err.println(shortName()+".Event.HIDE, "+event);
- System.err.println(shortName()+".Event.HIDE, "+newtChild.getDelegatedWindow());
+ System.err.println(shortName()+".Event.HIDE, "+newtChild.getDelegatedWindow().toSimpleString());
}
if( newtChildReady ) {
newtChild.setVisible(true /* wait */, false /* visible */);
@@ -247,7 +247,7 @@ public class NewtCanvasSWT extends Canvas implements NativeWindowHolder, WindowC
case SWT.Resize:
if( DEBUG ) {
System.err.println(shortName()+".Event.RESIZE, "+event);
- System.err.println(shortName()+".Event.RESIZE, "+newtChild.getDelegatedWindow());
+ System.err.println(shortName()+".Event.RESIZE, "+newtChild.getDelegatedWindow().toSimpleString());
}
if( isNativeValid() ) {
// ensure this is being called if already valid
@@ -259,26 +259,26 @@ public class NewtCanvasSWT extends Canvas implements NativeWindowHolder, WindowC
case SWT.Dispose:
if( DEBUG ) {
System.err.println(shortName()+".Event.DISPOSE, "+event);
- System.err.println(shortName()+".Event.DISPOSE, "+newtChild.getDelegatedWindow());
+ System.err.println(shortName()+".Event.DISPOSE, "+newtChild.getDelegatedWindow().toSimpleString());
}
NewtCanvasSWT.this.dispose();
break;
case SWT.Activate: // receives focus ??
if( DEBUG ) {
System.err.println(shortName()+".Event.ACTIVATE, "+event);
- System.err.println(shortName()+".Event.ACTIVATE, "+newtChild.getDelegatedWindow());
+ System.err.println(shortName()+".Event.ACTIVATE, "+newtChild.getDelegatedWindow().toSimpleString());
}
break;
case SWT.Deactivate: // lost focus ??
if( DEBUG ) {
System.err.println(shortName()+".Event.DEACTIVATE, "+event);
- System.err.println(shortName()+".Event.DEACTIVATE, "+newtChild.getDelegatedWindow());
+ System.err.println(shortName()+".Event.DEACTIVATE, "+newtChild.getDelegatedWindow().toSimpleString());
}
break;
case SWT.FocusIn: // receives focus
if( DEBUG ) {
System.err.println(shortName()+".Event.FOCUS_IN, "+event);
- System.err.println(shortName()+".Event.FOCUS_IN, "+newtChild.getDelegatedWindow());
+ System.err.println(shortName()+".Event.FOCUS_IN, "+newtChild.getDelegatedWindow().toSimpleString());
}
if( newtChildReady ) {
newtChild.requestFocus(false /* wait */);
@@ -287,14 +287,14 @@ public class NewtCanvasSWT extends Canvas implements NativeWindowHolder, WindowC
case SWT.FocusOut: // lost focus
if( DEBUG ) {
System.err.println(shortName()+".Event.FOCUS_OUT, "+event);
- System.err.println(shortName()+".Event.FOCUS_OUT, "+newtChild.getDelegatedWindow());
+ System.err.println(shortName()+".Event.FOCUS_OUT, "+newtChild.getDelegatedWindow().toSimpleString());
}
// we lack newtChild.releaseFocus(..) as this should be handled by the WM
break;
default:
if( DEBUG ) {
System.err.println(shortName()+".Event.misc: "+event.type+", "+event);
- System.err.println(shortName()+".Event.misc: "+newtChild.getDelegatedWindow());
+ System.err.println(shortName()+".Event.misc: "+newtChild.getDelegatedWindow().toSimpleString());
}
}
}