Class 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 same SWT styles as CTabItem.
    • 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 be null.
        parent - - parent CTabFolder of the created tab . Can't be null.
        style - - the style of control to construct. Styles can be taken from SWT.
        tabName - - tab's name. if given value is null, tab's name will be default tab name. Can be null.
        projectNames - - project names of this tab. Can be null.
        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 be null.
        separator - - separator which will be placed between tab name and group name to form new tab name. Can't be null.
      • 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 be null.
        progressMonitor - - progress monitor to report progress. Can be null.
      • 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()
        Returns true 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 be null.
      • addProjectName

        public void addProjectName​(String projectName)
        Adds name of project which elements on diagram belongs to.
        Parameters:
        projectName - - project name to set. Can't be null.
      • setTabName

        public void setTabName​(String tabName)
        Sets tab name.
        Parameters:
        tabName - - tab name to set. Can't be null.
      • 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. Returns null 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 be null.
        relations - - relations to reroute. Can't be null.
        progressMonitor - - monitor. Can be null.
      • 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 be null.
        relations - - relations to reroute. Can't be null.
        progressMonitor - - progress monitor. Can be null.
      • resetViewLocation

        public void resetViewLocation()
        Sets view location to top lefter figure. If there is no figures on tab does nothing.
      • isLinesOrthogonal

        public boolean isLinesOrthogonal()
        Returns true 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.
      • 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 interface IGroupsListener
        Parameters:
        entities - - deleted entities. Can't be null.