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 sameSWTstyles 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 voidaddProjectName(String projectName)Adds name of project which elements on diagram belongs to.voiddeleted(Collection<IErdEntity> entities)Fires this event when delete group action happens.voiddispose()Disposes of the operating system resources associated with the receiver.IErdDiagramControllergetDiagramController()Returns tabs diagram controller.com._1c.g5.v8.dt.diagram.framework.ui.IDiagramgetDiagramGui()Returns tabs diagram gui.DiagramGuiBuildergetDiagramGuiBuilder()Returns diagram gui builder.intgetDiagramHeight()Returns diagram height.intgetDiagramWidth()Returns diagram width.ErdEditorgetEditor()Returns editor.org.eclipse.draw2d.FigureCanvasgetFigureCanvas()Returns tabs figure canvas.Map<ErdEntityGroup,IErdDiagramController>getGroupToDiagramMap()Returns group to diagram map.IErdDiagramControllergetMainDiagramController()Returns main diagram of this tab.IErdDiagramControllergetPreviousDiagram()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.CTabItemgetTabItem()Returns tab item.StringgetTabMainName()Returns tab's name without group names.StringgetTabName()Returns tabs name.voidgoBack()Opens upper group.voidgoForward()Opens most resently closed group.voidgrouped(Collection<IErdEntity> entities)Fires this event when group action happens.booleanisEmpty()Returnstrueif tab does not contain builded diagram.booleanisLinesOrthogonal()Returnstrueif tab has orthogonal lines style.voidopenGroup(ErdEntityGroup group, String separator)Opens group.voidopenGroupSync(ErdEntityGroup group, org.eclipse.core.runtime.IProgressMonitor progressMonitor)Opens group.voidrelayoutEntities(Collection<IErdEntity> entities, Collection<com._1c.g5.v8.dt.diagram.framework.IRelation> relations, org.eclipse.core.runtime.IProgressMonitor progressMonitor)Relayouts given entities and relations.voidrerouteEdges(Collection<IErdEntity> entities, Collection<com._1c.g5.v8.dt.diagram.framework.IRelation> relations, org.eclipse.core.runtime.IProgressMonitor progressMonitor)Reroutes given relations.voidresetDiagramBounds()Resets diagram bounds.voidresetTab()Resets this tab.voidresetViewLocation()Sets view location to top lefter figure.voidsetContents(org.eclipse.draw2d.Viewport contents)Sets contents.voidsetDiagramHeight(int diagramHeight)Sets diagram height.voidsetDiagramWidth(int diagramWidth)Sets diagram width.voidsetLinesStyle(boolean isLinesOrthogonal)Sets lines style.voidsetSelected()Sets this tab as selected.voidsetTabName(String tabName)Sets tab name.voidungrouped(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()
Returnstrueif tab does not contain builded diagram.- Returns:
trueif 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. Returnsnullif 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()
Returnstrueif tab has orthogonal lines style.- Returns:
trueif tab has orthogonal lines style.
-
setLinesStyle
public void setLinesStyle(boolean isLinesOrthogonal)
Sets lines style.- Parameters:
isLinesOrthogonal- -trueif tab lines style should be orthogonal.
-
grouped
public void grouped(Collection<IErdEntity> entities)
Description copied from interface:IGroupsListenerFires this event when group action happens.- Specified by:
groupedin interfaceIGroupsListener- Parameters:
entities- - grouped entities. Can't benull.
-
ungrouped
public void ungrouped(Collection<IErdEntity> entities)
Description copied from interface:IGroupsListenerFires this event when ungroup action happens.- Specified by:
ungroupedin interfaceIGroupsListener- Parameters:
entities- - ungrouped entities. Can't benull.
-
deleted
public void deleted(Collection<IErdEntity> entities)
Description copied from interface:IGroupsListenerFires this event when delete group action happens. Given items may contain not only groups.- Specified by:
deletedin interfaceIGroupsListener- Parameters:
entities- - deleted entities. Can't benull.
-
-