Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
TULIP
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
14
Issues
14
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
NUI
TULIP
Commits
0a1f88a2
Commit
0a1f88a2
authored
Dec 14, 2017
by
Nico Mack
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor code cleanup
parent
a644e451
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
74 additions
and
84 deletions
+74
-84
TULIP/src/lu/list/itis/dkd/tui/bootstrapping/TangibleObjectBootstrapper.java
...tis/dkd/tui/bootstrapping/TangibleObjectBootstrapper.java
+24
-27
TULIP/src/lu/list/itis/dkd/tui/widget/corona/AnimatedShapeCorona.java
.../list/itis/dkd/tui/widget/corona/AnimatedShapeCorona.java
+4
-4
TULIP/src/lu/list/itis/dkd/tui/widget/corona/HtmlBox.java
TULIP/src/lu/list/itis/dkd/tui/widget/corona/HtmlBox.java
+32
-22
TULIP/src/lu/list/itis/dkd/tui/widget/corona/TextBox.java
TULIP/src/lu/list/itis/dkd/tui/widget/corona/TextBox.java
+0
-19
TULIP/src/lu/list/itis/dkd/tui/widget/tether/Line.java
TULIP/src/lu/list/itis/dkd/tui/widget/tether/Line.java
+0
-8
TULIP/src/lu/list/itis/dkd/tui/widget/touch/TouchManager.java
...P/src/lu/list/itis/dkd/tui/widget/touch/TouchManager.java
+14
-4
No files found.
TULIP/src/lu/list/itis/dkd/tui/bootstrapping/TangibleObjectBootstrapper.java
View file @
0a1f88a2
...
...
@@ -93,8 +93,8 @@ public class TangibleObjectBootstrapper extends TangibleObjectManager {
}
/**
* Method called to initialize bootstrapping from a previously provided XML file. The method
*
will
create all objects, cursors, and blobs.
* Method called to initialize bootstrapping from a previously provided XML file. The method
will
* create all objects, cursors, and blobs.
*
* @throws BuildException
* Thrown when one or more of the tangibles failed to build.
...
...
@@ -109,10 +109,10 @@ public class TangibleObjectBootstrapper extends TangibleObjectManager {
}
/**
* Method called to create a new instance of a cursor object. New cursor object will be created
*
from template specified in bootstrap file. In case multiple cursor templates are encountered,
*
only the first one will taken into account. This may change in future release, allowing to
*
assign
different cursor templates depending on the cursor ID.
* Method called to create a new instance of a cursor object. New cursor object will be created
from
*
template specified in bootstrap file. In case multiple cursor templates are encountered, only the
*
first one will taken into account. This may change in future release, allowing to assign
* different cursor templates depending on the cursor ID.
*
* @param cursorId
* specifies the ID of the cursor object to create.
...
...
@@ -154,15 +154,14 @@ public class TangibleObjectBootstrapper extends TangibleObjectManager {
Element
rootNode
=
bootstrap
.
getRootElement
();
List
<
Element
>
connectionsRootNodes
=
rootNode
.
getChildren
(
Externalization
.
CONNECTIONS_NODE
);
// $NON-NLS-1$
if
(
connectionsRootNodes
!=
null
)
{
for
(
Element
connectionsNode
:
connectionsRootNodes
)
for
(
Element
connectionsNode
:
connectionsRootNodes
)
{
if
(
connectionsNode
!=
null
)
{
for
(
Element
connectionNode
:
connectionsNode
.
getChildren
())
{
switch
(
connectionNode
.
getName
())
{
case
"tethers"
:
//$NON-NLS-1$
if
(
Externalization
.
TETHERS_NODE
.
equals
(
connectionNode
.
getName
()))
{
this
.
loadTethers
(
connectionNode
);
break
;
default
:
throw
new
BuildException
(
StringUtils
.
build
(
"Unrecognized connection type {} !"
,
connectionsNode
.
getName
()));
//$NON-NLS-1$ //$NON-NLS-2$
}
else
{
throw
new
BuildException
(
StringUtils
.
build
(
"Unrecognized connection type {} !"
,
connectionsNode
.
getName
()));
//$NON-NLS-1$
}
}
}
}
...
...
@@ -170,13 +169,12 @@ public class TangibleObjectBootstrapper extends TangibleObjectManager {
}
/**
* Note: When this method encounters an exception, it clears all previously loaded objects from
*
the
list.
* Note: When this method encounters an exception, it clears all previously loaded objects from
the
* list.
*
* @param objectRootNode
* The root node holding the <code>object</code> node(s).
* @throws BuildException
* TODO
*/
private
void
loadTethers
(
Element
tetherRootNode
)
throws
BuildException
{
List
<
Element
>
tetherNodes
=
tetherRootNode
.
getChildren
(
Externalization
.
TETHER_NODE
);
...
...
@@ -192,14 +190,14 @@ public class TangibleObjectBootstrapper extends TangibleObjectManager {
LOGGER
.
error
(
"One of the desired tethers could not be build!"
,
e
);
//$NON-NLS-1$
tetherMap
.
clear
();
throw
new
BuildException
(
"One of the desired tethers could not be build!
"
+
e
.
getMessage
()
,
e
);
//$NON-NLS-1$
throw
new
BuildException
(
"One of the desired tethers could not be build!
"
,
e
);
//$NON-NLS-1$
}
}
/**
* builds a cursor from the specified template node. A second parameter allows specifying the
* bootstrapping context, a map holding the names and the values of variables for interpolation
*
of
variable properties in template definition.
* bootstrapping context, a map holding the names and the values of variables for interpolation
of
* variable properties in template definition.
*
* @param templateNode
* specifies the template node to build the cursor from
...
...
@@ -231,8 +229,8 @@ public class TangibleObjectBootstrapper extends TangibleObjectManager {
/**
* builds a widget from the specified template node. A second parameter allows specifying the
* bootstrapping context, a map holding the names and the values of variables for interpolation
*
of
variable properties in template definition.
* bootstrapping context, a map holding the names and the values of variables for interpolation
of
* variable properties in template definition.
*
* @param templateNode
* specifies the template node to build the widget from
...
...
@@ -263,8 +261,8 @@ public class TangibleObjectBootstrapper extends TangibleObjectManager {
/**
* Note: When this method encounters an exception, it clears all previously loaded objects from
*
the
list.
* Note: When this method encounters an exception, it clears all previously loaded objects from
the
* list.
*
* @param objectRootNode
* The root node holding the <code>object</code> node(s).
...
...
@@ -290,12 +288,11 @@ public class TangibleObjectBootstrapper extends TangibleObjectManager {
}
/**
* Method used to determine the appropriate builder for a given object and then issue a build
* call.
* Method used to determine the appropriate builder for a given object and then issue a build call.
*
* @param objectNode
* The node from a larger document that contains, as children, all the necessary
*
information
to resolve the correct builder and build the final widget.
* The node from a larger document that contains, as children, all the necessary
information
* to resolve the correct builder and build the final widget.
* @param context
* @param callback
* @return The final widget as defined by the children of the element node.
...
...
TULIP/src/lu/list/itis/dkd/tui/widget/corona/AnimatedShapeCorona.java
View file @
0a1f88a2
...
...
@@ -56,8 +56,8 @@ public class AnimatedShapeCorona extends AnimatedCorona {
// * Constants *
// ***************************************************************************
private
static
final
String
OPACITY
=
"opacity"
;
//$NON-NLS-1$
private
static
final
String
SCALE
=
"scale"
;
//$NON-NLS-1$
private
static
final
String
PROPERTY_
OPACITY
=
"opacity"
;
//$NON-NLS-1$
private
static
final
String
PROPERTY_
SCALE
=
"scale"
;
//$NON-NLS-1$
// ---------------------------------------------------------------------------
// ***************************************************************************
...
...
@@ -117,9 +117,9 @@ public class AnimatedShapeCorona extends AnimatedCorona {
List
<
AnimationProperty
<?>>
properties
=
this
.
getAnimationProperties
();
for
(
AnimationProperty
<?>
property
:
properties
)
{
if
(
OPACITY
.
equals
(
property
.
getProperty
()))
{
if
(
PROPERTY_
OPACITY
.
equals
(
property
.
getProperty
()))
{
this
.
setOpacity
((
double
)
property
.
getStart
());
}
else
if
(
SCALE
.
equals
(
property
.
getProperty
()))
{
}
else
if
(
PROPERTY_
SCALE
.
equals
(
property
.
getProperty
()))
{
this
.
setScale
((
double
)
property
.
getStart
());
}
}
...
...
TULIP/src/lu/list/itis/dkd/tui/widget/corona/HtmlBox.java
View file @
0a1f88a2
...
...
@@ -33,6 +33,7 @@ import java.awt.Color;
import
java.awt.Dimension
;
import
java.awt.Graphics2D
;
import
java.awt.RenderingHints
;
import
java.awt.Shape
;
import
java.awt.Stroke
;
import
java.awt.geom.AffineTransform
;
import
java.awt.geom.Rectangle2D
;
...
...
@@ -159,6 +160,36 @@ public class HtmlBox extends SelectableCorona implements InformationReceiver<Str
this
.
setInformation
(
htmlContent
);
}
// ---------------------------------------------------------------------------
protected
BufferedImage
renderHtml
(
String
html
,
Shape
canvas
)
{
BufferedImage
renderedHtml
;
Rectangle2D
bounds
;
HTMLDocument
document
=
(
HTMLDocument
)
htmlEditor
.
createDefaultDocument
();
if
(
baseUrl
!=
null
)
{
document
.
setBase
(
baseUrl
);
}
bounds
=
canvas
.
getBounds2D
();
editor
.
setDocument
(
document
);
editor
.
setText
(
html
);
renderedHtml
=
new
BufferedImage
((
int
)
bounds
.
getWidth
()
-
(
2
*
insetBorder
),
(
int
)
bounds
.
getHeight
()
-
(
2
*
insetBorder
),
BufferedImage
.
TYPE_INT_ARGB
);
Graphics2D
offscreen
=
renderedHtml
.
createGraphics
();
offscreen
.
setRenderingHints
(
renderingHints
);
AffineTransform
translate
=
AffineTransform
.
getTranslateInstance
(-
bounds
.
getX
(),
-
bounds
.
getY
());
offscreen
.
setClip
(
translate
.
createTransformedShape
(
canvas
));
editor
.
paint
(
offscreen
);
offscreen
.
dispose
();
return
renderedHtml
;
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Class Body *
...
...
@@ -179,13 +210,9 @@ public class HtmlBox extends SelectableCorona implements InformationReceiver<Str
if
(
this
.
opacity
<
1.0f
)
localCanvas
.
setComposite
(
AlphaComposite
.
SrcOver
.
derive
(
this
.
opacity
));
AffineTransform
transform
=
this
.
getTransform
(
null
);
localCanvas
.
setTransform
(
transform
);
// Shape transformedShape = transform.createTransformedShape(shape);
localCanvas
.
setPaint
(
fillColour
);
localCanvas
.
fill
(
shape
);
...
...
@@ -210,26 +237,9 @@ public class HtmlBox extends SelectableCorona implements InformationReceiver<Str
/** {@inheritDoc} */
@Override
public
void
setInformation
(
String
information
)
{
HTMLDocument
html
=
(
HTMLDocument
)
htmlEditor
.
createDefaultDocument
();
if
(
baseUrl
!=
null
)
{
html
.
setBase
(
baseUrl
);
}
editor
.
setDocument
(
html
);
editor
.
setText
(
information
);
rendered
=
new
BufferedImage
((
int
)
shapeBounds
.
getWidth
()
-
(
2
*
insetBorder
),
(
int
)
shapeBounds
.
getHeight
()
-
(
2
*
insetBorder
),
BufferedImage
.
TYPE_INT_ARGB
);
Graphics2D
offscreen
=
rendered
.
createGraphics
();
offscreen
.
setRenderingHints
(
renderingHints
);
AffineTransform
translate
=
AffineTransform
.
getTranslateInstance
(-
shapeBounds
.
getX
(),
-
shapeBounds
.
getY
());
offscreen
.
setClip
(
translate
.
createTransformedShape
(
shape
));
editor
.
paint
(
offscreen
);
offscreen
.
dispose
();
rendered
=
this
.
renderHtml
(
information
,
shape
);
renderedCentre
=
new
Point
(((
float
)
rendered
.
getWidth
()
/
2
),
((
float
)
rendered
.
getHeight
()
/
2
),
0
f
,
ScreenCoordinates
.
class
);
}
// ---------------------------------------------------------------------------
...
...
TULIP/src/lu/list/itis/dkd/tui/widget/corona/TextBox.java
View file @
0a1f88a2
...
...
@@ -99,24 +99,6 @@ public class TextBox extends Corona implements ContextEventListener, Information
return
;
}
// centre.toScreenCoordinates();
// if (initialTranslation != null) {
// initialTranslation.toScreenCoordinates();
// }
//
// Point drawAt = centre.add(initialTranslation);
//
// AffineTransform rotation = new AffineTransform();
// rotation.rotate(rotateWithHandle ? drawAt.getAngle() : initialTranslation != null ?
// initialTranslation.getAngle() : 0, centre.getX(), centre.getY());
// rotation.transform(drawAt, drawAt);
//
// if (Double.compare(initialRotation, 0d) != 0) {
// AffineTransform transformation = new AffineTransform();
// transformation.rotate(initialRotation, drawAt.getX(), drawAt.getY());
// canvas.setTransform(transformation);
// }
AffineTransform
restore
=
canvas
.
getTransform
();
AffineTransform
transform
=
this
.
getTransform
(
null
);
canvas
.
setTransform
(
transform
);
...
...
@@ -127,7 +109,6 @@ public class TextBox extends Corona implements ContextEventListener, Information
TextHelper
.
configure
(
font
,
fontSize
,
colour
,
centred
);
TextHelper
.
drawText
(
canvas
,
new
Point
(
0
f
,
0
f
,
0
f
,
ScreenCoordinates
.
class
),
lineWidth
,
textToShow
);
canvas
.
setTransform
(
restore
);
}
...
...
TULIP/src/lu/list/itis/dkd/tui/widget/tether/Line.java
View file @
0a1f88a2
...
...
@@ -60,15 +60,7 @@ public class Line extends InformationFeed {
if
((
origin
==
null
)
||
(
ending
==
null
))
return
;
// Shape previousLine = null;
// if ((previousOrigin != null) && (previousEnding != null))
// {
// previousLine = new Line2D.Double(new Point2D.Double(previousOrigin.x, previousOrigin.y),
// new Point2D.Double(previousEnding.x, previousEnding.y));
// }
//
Stroke
pen
=
new
BasicStroke
(
strokeWidth
);
// canvas.clip(pen.createStrokedShape(previousLine));
Shape
line
=
new
Line2D
.
Double
(
new
Point2D
.
Double
(
origin
.
x
,
origin
.
y
),
new
Point2D
.
Double
(
ending
.
x
,
ending
.
y
));
canvas
.
setStroke
(
pen
);
...
...
TULIP/src/lu/list/itis/dkd/tui/widget/touch/TouchManager.java
View file @
0a1f88a2
...
...
@@ -21,6 +21,9 @@ import lu.list.itis.dkd.tui.utility.ScreenCoordinates;
import
lu.list.itis.dkd.tui.widget.corona.Corona
;
import
lu.list.itis.dkd.tui.widget.corona.ShapeFactory
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.awt.Color
;
import
java.awt.Graphics2D
;
import
java.awt.Shape
;
...
...
@@ -75,8 +78,7 @@ public class TouchManager {
/* LATCHED_STATE */
{
LATCHED_STATE
,
DRAGGED_STATE
,
RELEASED_STATE
}
};
// private static final Logger LOGGER =
// LoggerFactory.getLogger(TouchManager.class.getSimpleName());
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
TouchManager
.
class
.
getSimpleName
());
// ---------------------------------------------------------------------------
// ***************************************************************************
...
...
@@ -113,8 +115,9 @@ public class TouchManager {
newState
=
(
isLatching
)
?
LATCHING_TRANSITIONS
[
oldState
][
event
]
:
NON_LATCHING_TRANSITIONS
[
oldState
][
event
];
// LOGGER.info("State Change [{}] =[{}]=> [{}]", oldState, event, newState); //$NON-NLS-1$
if
(
LOGGER
.
isDebugEnabled
())
{
LOGGER
.
debug
(
"State Change [{}] =[{}]=> [{}]"
,
oldState
,
event
,
newState
);
//$NON-NLS-1$
}
return
newState
;
}
...
...
@@ -215,6 +218,9 @@ public class TouchManager {
this
.
touchStates
.
put
(
touchId
,
newState
);
if
(
touched
)
{
this
.
touchPositions
.
put
(
touchId
,
event
.
getPosition
());
if
(
LOGGER
.
isDebugEnabled
())
{
LOGGER
.
debug
(
"Cursor {} touched @ Position [{}]"
,
touchId
,
event
.
getPosition
());
//$NON-NLS-1$
}
}
return
touched
;
...
...
@@ -280,6 +286,10 @@ public class TouchManager {
if
(
released
)
{
this
.
touchStates
.
remove
(
touchId
);
this
.
touchPositions
.
remove
(
touchId
);
if
(
LOGGER
.
isDebugEnabled
())
{
LOGGER
.
debug
(
"Cursor {} released @ Position [{}]"
,
touchId
,
event
.
getPosition
());
//$NON-NLS-1$
}
}
else
{
this
.
touchStates
.
put
(
touchId
,
newState
);
this
.
touchPositions
.
put
(
touchId
,
event
.
getPosition
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment