Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kernel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
af3
kernel
Commits
71b79760
Commit
71b79760
authored
10 years ago
by
Dongyue Mou
Browse files
Options
Downloads
Patches
Plain Diff
added new editpart to show a diagram as a sub frame in another diagram
parent
91f4f294
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editpart/SubDiagramEditPartBase.java
+102
-0
102 additions, 0 deletions
...tiss/tooling/base/ui/editpart/SubDiagramEditPartBase.java
with
102 additions
and
0 deletions
org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editpart/SubDiagramEditPartBase.java
0 → 100644
+
102
−
0
View file @
71b79760
/*--------------------------------------------------------------------------+
$Id: ElementEditPartBase.java 8344 2013-08-05 08:11:09Z hoelzl $
| |
| Copyright 2011 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package
org.fortiss.tooling.base.ui.editpart
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.eclipse.draw2d.Label
;
import
org.eclipse.draw2d.PositionConstants
;
import
org.eclipse.draw2d.geometry.Rectangle
;
import
org.fortiss.tooling.base.layout.DefaultLayoutConstants
;
import
org.fortiss.tooling.base.model.layout.ILayoutedModelElement
;
import
org.fortiss.tooling.base.ui.utils.LayoutDataUtils
;
import
org.fortiss.tooling.kernel.model.INamedCommentedElement
;
/**
* The base class for graphical edit parts which encapsulate nodes (i.e. the
* main modeling elements). All of them have a name label and an activation
* mode.
*
* @param <T>
* the type of the model element wrapped.
*
* @author hoelzl
* @author $Author: hoelzl $
* @version $Rev: 8344 $
* @ConQAT.Rating GREEN Hash: 7E81A6A123F7421DD0D73BE0F9C7D72A
*/
public
abstract
class
SubDiagramEditPartBase
<
T
extends
ILayoutedModelElement
&
INamedCommentedElement
>
extends
ElementEditPartBase
<
T
>
{
/** Constructor. */
protected
SubDiagramEditPartBase
(
T
modelObject
)
{
super
(
modelObject
);
}
/**
* {@inheritDoc}
* <p>
* Returns the connectors as children.
*/
@Override
protected
List
<?>
getModelChildren
()
{
List
<
Object
>
result
=
new
ArrayList
<
Object
>();
result
.
addAll
(
modelElementHandler
.
getSubnodes
(
getModel
()));
result
.
addAll
(
modelElementHandler
.
getConnectors
(
getModel
()));
return
result
;
}
/** {@inheritDoc} */
@Override
protected
Rectangle
determineBaseFigureBounds
()
{
Rectangle
result
=
null
;
for
(
Object
o
:
getModelChildren
())
{
if
(
o
instanceof
ILayoutedModelElement
)
{
Rectangle
p
=
LayoutDataUtils
.
getNodeBounds
((
ILayoutedModelElement
)
o
);
result
=
p
.
getUnion
(
result
);
}
}
if
(
result
==
null
)
{
result
=
new
Rectangle
();
}
result
.
expand
(
DefaultLayoutConstants
.
DEFAULT_GRID_SIZE
,
DefaultLayoutConstants
.
DEFAULT_GRID_SIZE
);
return
result
;
}
/** {@inheritDoc} */
@Override
public
Label
createLabelFigure
()
{
Label
label
=
super
.
createLabelFigure
();
label
.
setIconAlignment
(
PositionConstants
.
TOP
|
PositionConstants
.
LEFT
);
return
label
;
}
/** {@inheritDoc} */
@Override
protected
Rectangle
determineLabelFigureBounds
()
{
Rectangle
textBounds
=
labelFigure
.
getTextBounds
();
Rectangle
labelBounds
=
determineBaseFigureBounds
();
labelBounds
.
y
+=
2
*
DefaultLayoutConstants
.
DEFAULT_SHAPE_INSETS
;
labelBounds
.
x
+=
2
*
DefaultLayoutConstants
.
DEFAULT_SHAPE_INSETS
;
labelBounds
.
width
-=
4
*
DefaultLayoutConstants
.
DEFAULT_SHAPE_INSETS
;
labelBounds
.
height
=
textBounds
.
height
*
2
;
return
labelBounds
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment