Class AbstractProblemsPart

java.lang.Object
com.amalgamasimulation.desktop.appelements.parts.AbstractProblemsPart

public abstract class AbstractProblemsPart extends Object
Base part for the list of problems that a check of the scenario finds. The part shows a tree. The top nodes are errors and warnings, each with the number of problems. Under them, the problems are in groups by the type of the tree element. If a problem has no type, it is directly under the node of errors or warnings. A group shows not more than 100 problems, and the label of the group then shows "N of M". The part shows the result from the VALIDATION_FINISHED message. A subclass implements validate, which starts the check.
Author:
Ionov Ivan
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.eclipse.e4.core.services.events.IEventBroker
     
    protected com.amalgamasimulation.desktop.utils.MessageManager
     
    protected org.eclipse.swt.widgets.ToolBar
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    createContents(org.eclipse.swt.widgets.Composite parent)
    Creates the tree of problems and subscribes to the VALIDATION_FINISHED and NEW_SCENARIO messages.
    protected void
    createToolbar(org.eclipse.swt.widgets.Composite parent)
    Creates the toolbar with the refresh button.
    Returns the type of the tree element that the problem's object belongs to.
    protected boolean
    Returns true if the tree needs a column that shows the problem's object.
    protected String
    Returns the text of the object column: the id of the problem's object.
    protected void
    Opens the problem's object.
    protected void
    The part calls this method on the NEW_SCENARIO message.
    void
    postConstruct(org.eclipse.swt.widgets.Composite parent)
    Creates the toolbar and the contents of the part in the parent.
    protected void
    Replaces the contents of the tree with the result of the check and expands all nodes.
    protected abstract void
    Starts the check of the current scenario.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • eventBroker

      @Inject protected org.eclipse.e4.core.services.events.IEventBroker eventBroker
    • messageManager

      @Inject protected com.amalgamasimulation.desktop.utils.MessageManager messageManager
    • toolbar

      protected org.eclipse.swt.widgets.ToolBar toolbar
  • Constructor Details

    • AbstractProblemsPart

      public AbstractProblemsPart()
  • Method Details

    • validate

      protected abstract void validate()
      Starts the check of the current scenario. The part calls this method from the refresh button on the toolbar and on a new scenario. The result comes to the part in the VALIDATION_FINISHED message.
    • onNewScenario

      protected void onNewScenario()
      The part calls this method on the NEW_SCENARIO message. By default, calls validate.
    • postConstruct

      @PostConstruct public void postConstruct(org.eclipse.swt.widgets.Composite parent)
      Creates the toolbar and the contents of the part in the parent.
    • createToolbar

      protected void createToolbar(org.eclipse.swt.widgets.Composite parent)
      Creates the toolbar with the refresh button. The button calls validate.
    • createContents

      protected void createContents(org.eclipse.swt.widgets.Composite parent)
      Creates the tree of problems and subscribes to the VALIDATION_FINISHED and NEW_SCENARIO messages. If the part opens after a check, it shows the last result of the check at once. When the tree is disposed, the part unsubscribes from the messages.
    • hasObjectColumn

      protected boolean hasObjectColumn()
      Returns true if the tree needs a column that shows the problem's object. By default, returns false.
    • objectLabel

      protected String objectLabel(Problem problem)
      Returns the text of the object column: the id of the problem's object. If the object has no id, returns an empty string.
    • getTreeElementType

      protected AbstractTreeElementType getTreeElementType(Problem problem)
      Returns the type of the tree element that the problem's object belongs to. The part uses this type to put problems in groups and to open the object on a double-click. If the result is null, the problem is not in a group.
    • onDoubleClick

      protected void onDoubleClick(Problem problem)
      Opens the problem's object. The part selects the type of the element in the tree, shows the table of this type, selects the object in the table and shows its properties. If the problem has a tab, the part opens this tab in the properties. If the problem has no object, does nothing.
    • showResult

      protected void showResult(ValidationResult result)
      Replaces the contents of the tree with the result of the check and expands all nodes.