Package com._1c.g5.v8.dt.erd.ui.widgets
Class DiagramTabItem
- java.lang.Object
-
- com._1c.g5.v8.dt.erd.ui.widgets.DiagramTabItem
-
- All Implemented Interfaces:
IGroupsListener
public class DiagramTabItem extends Object implements IGroupsListener
Instance of this class represents diagram tab item in tabs folder. Each tab item contains own diagram.
Supports sameSWT
styles asCTabItem
.
-
-
Constructor Summary
Constructors Constructor Description DiagramTabItem(ErdEditor editor, org.eclipse.swt.custom.CTabFolder parent, int style, String tabName, Collection<String> projectNames, int index)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addProjectName(String projectName)
Adds name of project which elements on diagram belongs to.void
deleted(Collection<IErdEntity> entities)
Fires this event when delete group action happens.void
dispose()
Disposes of the operating system resources associated with the receiver.IErdDiagramController
getDiagramController()
Returns tabs diagram controller.com._1c.g5.v8.dt.diagram.framework.ui.IDiagram
getDiagramGui()
Returns tabs diagram gui.DiagramGuiBuilder
getDiagramGuiBuilder()
Returns diagram gui builder.int
getDiagramHeight()
Returns diagram height.int
getDiagramWidth()
Returns diagram width.ErdEditor
getEditor()
Returns editor.org.eclipse.draw2d.FigureCanvas
getFigureCanvas()
Returns tabs figure canvas.Map<ErdEntityGroup,IErdDiagramController>
getGroupToDiagramMap()
Returns group to diagram map.IErdDiagramController
getMainDiagramController()
Returns main diagram of this tab.IErdDiagramController
getPreviousDiagram()
Returns parent of currently opened diagram.Deque<IErdDiagramController>
getPreviousDiagrams()
Returns all previously opened diagrams.Collection<String>
getProjectNames()
Returns name of projects which elements on diagram belongs to.org.eclipse.swt.custom.CTabItem
getTabItem()
Returns tab item.String
getTabMainName()
Returns tab's name without group names.String
getTabName()
Returns tabs name.void
goBack()
Opens upper group.void
goForward()
Opens most resently closed group.void
grouped(Collection<IErdEntity> entities)
Fires this event when group action happens.boolean
isEmpty()
Returnstrue
if tab does not contain builded diagram.boolean
isLinesOrthogonal()
Returnstrue
if tab has orthogonal lines style.void
openGroup(ErdEntityGroup group, String separator)
Opens group.void
openGroupSync(ErdEntityGroup group, org.eclipse.core.runtime.IProgressMonitor progressMonitor)
Opens group.void
relayoutEntities(Collection<IErdEntity> entities, Collection<com._1c.g5.v8.dt.diagram.framework.IRelation> relations, org.eclipse.core.runtime.IProgressMonitor progressMonitor)
Relayouts given entities and relations.void
rerouteEdges(Collection<IErdEntity> entities, Collection<com._1c.g5.v8.dt.diagram.framework.IRelation> relations, org.eclipse.core.runtime.IProgressMonitor progressMonitor)
Reroutes given relations.void
resetDiagramBounds()
Resets diagram bounds.void
resetTab()
Resets this tab.void
resetViewLocation()
Sets view location to top lefter figure.void
setContents(org.eclipse.draw2d.Viewport contents)
Sets contents.void
setDiagramHeight(int diagramHeight)
Sets diagram height.void
setDiagramWidth(int diagramWidth)
Sets diagram width.void
setLinesStyle(boolean isLinesOrthogonal)
Sets lines style.void
setSelected()
Sets this tab as selected.void
setTabName(String tabName)
Sets tab name.void
ungrouped(Collection<IErdEntity> entities)
Fires this event when ungroup action happens.
-
-
-
Constructor Detail
-
DiagramTabItem
public DiagramTabItem(ErdEditor editor, org.eclipse.swt.custom.CTabFolder parent, int style, String tabName, Collection<String> projectNames, int index)
Constructor.- Parameters:
editor
- - erd editor to create tab for. Can't benull
.parent
- - parent CTabFolder of the created tab . Can't benull
.style
- - the style of control to construct. Styles can be taken fromSWT
.tabName
- - tab's name. if given value isnull
, tab's name will be default tab name. Can benull
.projectNames
- - project names of this tab. Can benull
.index
- - the zero-relative index of created tab. The item will be added to the end of the items if given index is negative
-
-
Method Detail
-
openGroup
public void openGroup(ErdEntityGroup group, String separator)
Opens group.- Parameters:
group
- - group to open. Can't benull
.separator
- - separator which will be placed between tab name and group name to form new tab name. Can't benull
.
-
openGroupSync
public void openGroupSync(ErdEntityGroup group, org.eclipse.core.runtime.IProgressMonitor progressMonitor)
Opens group. Method returns when group is opened and rebuild. Does not change tab title.- Parameters:
group
- - group to open. Can't benull
.progressMonitor
- - progress monitor to report progress. Can benull
.
-
goBack
public void goBack()
Opens upper group.
-
goForward
public void goForward()
Opens most resently closed group.
-
dispose
public void dispose()
Disposes of the operating system resources associated with the receiver.
-
setSelected
public void setSelected()
Sets this tab as selected.
-
resetTab
public void resetTab()
Resets this tab.
-
isEmpty
public boolean isEmpty()
Returnstrue
if tab does not contain builded diagram.- Returns:
true
if tab does not contain builded diagram.
-
setContents
public void setContents(org.eclipse.draw2d.Viewport contents)
Sets contents.- Parameters:
contents
- - contents to set. Can't benull
.
-
addProjectName
public void addProjectName(String projectName)
Adds name of project which elements on diagram belongs to.- Parameters:
projectName
- - project name to set. Can't benull
.
-
setTabName
public void setTabName(String tabName)
Sets tab name.- Parameters:
tabName
- - tab name to set. Can't benull
.
-
setDiagramWidth
public void setDiagramWidth(int diagramWidth)
Sets diagram width.- Parameters:
diagramWidth
- - diagram width to set.
-
setDiagramHeight
public void setDiagramHeight(int diagramHeight)
Sets diagram height.- Parameters:
diagramHeight
- - diagram height to set.
-
getEditor
public ErdEditor getEditor()
Returns editor.- Returns:
- editor. Can't return
null
.
-
getDiagramWidth
public int getDiagramWidth()
Returns diagram width.- Returns:
- diagram width.
-
getDiagramHeight
public int getDiagramHeight()
Returns diagram height.- Returns:
- diagram height.
-
getTabName
public String getTabName()
Returns tabs name.- Returns:
- tabs name. Can't return
null
.
-
getTabMainName
public String getTabMainName()
Returns tab's name without group names.
Example:
Tab"Diagram"
with opened group"Group"
has name"Diagram->Group"
. Method will return only main part"Diagram"
.- Returns:
- tab's name without group names.
-
getTabItem
public org.eclipse.swt.custom.CTabItem getTabItem()
Returns tab item.- Returns:
- tab item. Can't return
null
.
-
getDiagramGuiBuilder
public DiagramGuiBuilder getDiagramGuiBuilder()
Returns diagram gui builder.- Returns:
- diagram gui builder. Can't return
null
.
-
getDiagramGui
public com._1c.g5.v8.dt.diagram.framework.ui.IDiagram getDiagramGui()
Returns tabs diagram gui.- Returns:
- tabs diagram gui. Can return
null
.
-
getDiagramController
public IErdDiagramController getDiagramController()
Returns tabs diagram controller.- Returns:
- tabs diagram controller. Can't return
null
.
-
getProjectNames
public Collection<String> getProjectNames()
Returns name of projects which elements on diagram belongs to.- Returns:
- the projectName. Can't return
null
.
-
getFigureCanvas
public org.eclipse.draw2d.FigureCanvas getFigureCanvas()
Returns tabs figure canvas.- Returns:
- tabs figure canvas. Can't return
null
.
-
getPreviousDiagram
public IErdDiagramController getPreviousDiagram()
Returns parent of currently opened diagram. Returnsnull
if no parent.- Returns:
- parent of currently opened diagram if one exists. Can return
null
.
-
getPreviousDiagrams
public Deque<IErdDiagramController> getPreviousDiagrams()
Returns all previously opened diagrams. (current open diagram predessors)- Returns:
- previously opened diagrams. Can't return
null
.
-
getMainDiagramController
public IErdDiagramController getMainDiagramController()
Returns main diagram of this tab.- Returns:
- main diagram of this tab. Can't return
null
.
-
getGroupToDiagramMap
public Map<ErdEntityGroup,IErdDiagramController> getGroupToDiagramMap()
Returns group to diagram map. This map do not contain main diagram.- Returns:
- group to diagram map. Can't return
null
.
-
resetDiagramBounds
public void resetDiagramBounds()
Resets diagram bounds.
-
relayoutEntities
public void relayoutEntities(Collection<IErdEntity> entities, Collection<com._1c.g5.v8.dt.diagram.framework.IRelation> relations, org.eclipse.core.runtime.IProgressMonitor progressMonitor)
Relayouts given entities and relations.- Parameters:
entities
- - entities to relayout. Can't benull
.relations
- - relations to reroute. Can't benull
.progressMonitor
- - monitor. Can benull
.
-
rerouteEdges
public void rerouteEdges(Collection<IErdEntity> entities, Collection<com._1c.g5.v8.dt.diagram.framework.IRelation> relations, org.eclipse.core.runtime.IProgressMonitor progressMonitor)
Reroutes given relations.- Parameters:
entities
- - entities connected to given relations. Can't benull
.relations
- - relations to reroute. Can't benull
.progressMonitor
- - progress monitor. Can benull
.
-
resetViewLocation
public void resetViewLocation()
Sets view location to top lefter figure. If there is no figures on tab does nothing.
-
isLinesOrthogonal
public boolean isLinesOrthogonal()
Returnstrue
if tab has orthogonal lines style.- Returns:
true
if tab has orthogonal lines style.
-
setLinesStyle
public void setLinesStyle(boolean isLinesOrthogonal)
Sets lines style.- Parameters:
isLinesOrthogonal
- -true
if tab lines style should be orthogonal.
-
grouped
public void grouped(Collection<IErdEntity> entities)
Description copied from interface:IGroupsListener
Fires this event when group action happens.- Specified by:
grouped
in interfaceIGroupsListener
- Parameters:
entities
- - grouped entities. Can't benull
.
-
ungrouped
public void ungrouped(Collection<IErdEntity> entities)
Description copied from interface:IGroupsListener
Fires this event when ungroup action happens.- Specified by:
ungrouped
in interfaceIGroupsListener
- Parameters:
entities
- - ungrouped entities. Can't benull
.
-
deleted
public void deleted(Collection<IErdEntity> entities)
Description copied from interface:IGroupsListener
Fires this event when delete group action happens. Given items may contain not only groups.- Specified by:
deleted
in interfaceIGroupsListener
- Parameters:
entities
- - deleted entities. Can't benull
.
-
-