Class AbstractViewerPanel

java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
com._1c.g5.v8.dt.ui.dialog.AbstractViewerPanel
All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable
Direct Known Subclasses:
AbstractSetFilterDialogPanel, AbstractSubsystemsPanel, ObjectsPanel, ObjectsPanel, ObjectsPanel, RightsPanel, RolesPanel

public abstract class AbstractViewerPanel extends org.eclipse.swt.widgets.Composite
Abstract viewer panel for dialogs and wizard.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final org.eclipse.swt.graphics.Image
    Check image.
    The search filter with history
    protected boolean
    The view "read only" flag
    protected org.eclipse.swt.widgets.ToolBar
    The toolbar
    protected org.eclipse.swt.widgets.ToolItem
    The tool item for "Deselect all" action
    protected org.eclipse.swt.widgets.ToolItem
    The tool item for "Select all" action
    The tree viewer

    Fields inherited from class org.eclipse.swt.widgets.Control

    handle
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractViewerPanel(org.eclipse.swt.widgets.Composite parent, boolean singleSelect, boolean hasSearch, String treeName, boolean editable)
    Creates a new AbstractViewerPanel with toolbar.
    AbstractViewerPanel(org.eclipse.swt.widgets.Composite parent, boolean singleSelect, boolean hasSearch, String treeName, boolean needToolbar, boolean useHelper, boolean editable)
    Constructor.
    AbstractViewerPanel(org.eclipse.swt.widgets.Composite parent, boolean singleSelect, boolean hasSearch, String treeName, boolean needToolbar, boolean useHelper, SearchFilterWithHistory searchFilterWithHistory, boolean editable)
    Constructor.
    AbstractViewerPanel(org.eclipse.swt.widgets.Composite parent, boolean singleSelect, boolean hasSearch, String treeName, SearchFilterWithHistory searchFilterWithHistory, boolean editable)
    Creates a new AbstractViewerPanel with toolbar.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds a listener for double-clicks in this viewer.
    void
    Adds filter to viewer.
    protected void
    Changes actions enable state.
    protected void
    Viewer check state handler.
    protected void
    checkAll(boolean state)
    Checks all elements.
    Creates checkbox tree viewer.
    protected void
    createSearch(org.eclipse.swt.widgets.Composite toolbarAndSearch)
    Creates search by string to panel.
    protected void
    Creates toolbar actions.
    protected void
    Does double click actions.
    Gets checked elements.
    protected List<Object>
    Gets all descendants for the given node.
    Gets grayed elements.
    <T> List<T>
    getItemsOfType(Object[] selection, Class<T> targetClass)
    Gets items from selection.
    Gets the checked elements (excluding grayed out elements).
    Gets viewer input.
    boolean
    Returns true if panel has checked elements (excluding grayed out elements).
    protected void
    Inits toolbar actions.
    protected abstract void
    Inits viewer properties.
    void
    Removes the given double-click listener from this viewer.
    void
    Removes viewer filter.
    void
    setChecked(Object element)
    Sets the given element as checked.
    void
    Sets the given elements as elements.
    void
    Sets the focus to the search line.
    void
    Sets the given elements as grayed.
    void
    setLabelText(String labelText)
    Sets text to panel label.
    protected void
    setState(Object node, boolean checked)
    Sets node check state and updates its subtree and parents.
    void
    Sets the given elements as unchecked.
    void
    Sets the viewer input.
    protected void
    updateTree(Object node, boolean checked)
    Sets the checked state for the given node and its children in this viewer and updates the parent state.

    Methods inherited from class org.eclipse.swt.widgets.Composite

    changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toString

    Methods inherited from class org.eclipse.swt.widgets.Scrollable

    computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar

    Methods inherited from class org.eclipse.swt.widgets.Control

    addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update

    Methods inherited from class org.eclipse.swt.widgets.Widget

    addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.eclipse.swt.graphics.Drawable

    isAutoScalable
  • Field Details

    • IMG_CHECKED

      protected static final org.eclipse.swt.graphics.Image IMG_CHECKED
      Check image.
    • viewer

      protected CheckboxTreeViewer viewer
      The tree viewer
    • singleSelect

      protected boolean singleSelect
      The view "read only" flag
    • searchFilterWithHistory

      protected SearchFilterWithHistory searchFilterWithHistory
      The search filter with history
    • toolBar

      protected org.eclipse.swt.widgets.ToolBar toolBar
      The toolbar
    • toolBarDeselectAllElement

      protected org.eclipse.swt.widgets.ToolItem toolBarDeselectAllElement
      The tool item for "Deselect all" action
    • toolBarSelectAllElement

      protected org.eclipse.swt.widgets.ToolItem toolBarSelectAllElement
      The tool item for "Select all" action
  • Constructor Details

    • AbstractViewerPanel

      public AbstractViewerPanel(org.eclipse.swt.widgets.Composite parent, boolean singleSelect, boolean hasSearch, String treeName, boolean editable)
      Creates a new AbstractViewerPanel with toolbar.
      Parameters:
      parent - the parent composite, can not be null
      singleSelect - whether the view is read only
      hasSearch - whether the view has searchbox
      treeName - the viewer tree name, can be null
      editable - whether the panel editable
    • AbstractViewerPanel

      public AbstractViewerPanel(org.eclipse.swt.widgets.Composite parent, boolean singleSelect, boolean hasSearch, String treeName, SearchFilterWithHistory searchFilterWithHistory, boolean editable)
      Creates a new AbstractViewerPanel with toolbar.
      Parameters:
      parent - the parent composite, can not be null
      singleSelect - whether the view is read only
      hasSearch - whether the view has searchbox
      treeName - the viewer tree name, can be null
      searchFilterWithHistory - the search filter with history, can not be null
      editable - whether the panel editable
    • AbstractViewerPanel

      public AbstractViewerPanel(org.eclipse.swt.widgets.Composite parent, boolean singleSelect, boolean hasSearch, String treeName, boolean needToolbar, boolean useHelper, boolean editable)
      Constructor.
      Parameters:
      parent - the parent composite, can not be null
      singleSelect - whether the view is read only
      hasSearch - whether the view has searchbox
      treeName - the viewer tree name, can be null
      needToolbar - whether the view needs toolbar
      useHelper - whether the view needs checked tree helper
      editable - whether the panel editable
    • AbstractViewerPanel

      public AbstractViewerPanel(org.eclipse.swt.widgets.Composite parent, boolean singleSelect, boolean hasSearch, String treeName, boolean needToolbar, boolean useHelper, SearchFilterWithHistory searchFilterWithHistory, boolean editable)
      Constructor.
      Parameters:
      parent - the parent composite, can not be null
      singleSelect - whether the view is read only
      hasSearch - whether the view has searchbox
      treeName - the viewer tree name, can be null
      needToolbar - whether the view needs toolbar
      useHelper - whether the view needs checked tree helper
      searchFilterWithHistory - the search filter with history, can not be null
      editable - whether the panel editable
  • Method Details

    • addViewerFilter

      public void addViewerFilter(ViewerFilter filter)
      Adds filter to viewer.
      Parameters:
      filter - the viewer filter, can not be null
    • addViewerDoubleClickListener

      public void addViewerDoubleClickListener(IDoubleClickListener listener)
      Adds a listener for double-clicks in this viewer. Has no effect if an identical listener is already registered.
      Parameters:
      listener - a double-click listener, cannot be null
    • removeViewerDoubleClickListener

      public void removeViewerDoubleClickListener(IDoubleClickListener listener)
      Removes the given double-click listener from this viewer. Has no effect if an identical listener is not registered.
      Parameters:
      listener - a double-click listener, cannot be null
    • getCheckedElements

      public List<Object> getCheckedElements()
      Gets checked elements.
      Returns:
      checked elements, never null
    • hasCheckedElements

      public boolean hasCheckedElements()
      Returns true if panel has checked elements (excluding grayed out elements).
      Returns:
      true if panel has checked elements (excluding grayed out elements).
    • getGrayedElements

      public List<Object> getGrayedElements()
      Gets grayed elements.
      Returns:
      grayed elements, never null
    • getItemsOfType

      public <T> List<T> getItemsOfType(Object[] selection, Class<T> targetClass)
      Gets items from selection.
      Parameters:
      selection - the selection, can not be null
      targetClass - the target class, can not be null
      Returns:
      the target class items, never null
    • getOnlyCheckedElements

      public List<Object> getOnlyCheckedElements()
      Gets the checked elements (excluding grayed out elements).
      Returns:
      the checked elements, never null
    • getViewerInput

      public Object[] getViewerInput()
      Gets viewer input.
      Returns:
      the viewer input, may be null
    • removeViewerFilter

      public void removeViewerFilter(ViewerFilter filter)
      Removes viewer filter.
      Parameters:
      filter - the filter, can not be null
    • setChecked

      public void setChecked(Object element)
      Sets the given element as checked. Does not update its subtree and parents.
      Parameters:
      element - the given element, can not be null
      See Also:
    • setCheckedElements

      public void setCheckedElements(Object... elements)
      Sets the given elements as elements.
      Parameters:
      elements - the given elements, can not be null
    • setGrayedElements

      public void setGrayedElements(Object... elements)
      Sets the given elements as grayed.
      Parameters:
      elements - the given elements, can not be null
    • setUncheckedElements

      public void setUncheckedElements(Object... elements)
      Sets the given elements as unchecked.
      Parameters:
      elements - the given elements, can not be null
    • setViewerInput

      public void setViewerInput(Object input)
      Sets the viewer input.
      Parameters:
      input - the input, may be null
    • setFocusToSearchLine

      public void setFocusToSearchLine()
      Sets the focus to the search line.
    • setLabelText

      public void setLabelText(String labelText)
      Sets text to panel label.
      Parameters:
      labelText - the text to set, cannot be null
    • changeActionEnable

      protected void changeActionEnable()
      Changes actions enable state.
    • changeViewerCheckState

      protected void changeViewerCheckState(CheckStateChangedEvent event)
      Viewer check state handler.
      Parameters:
      event - the check state change event, may be null
    • checkAll

      protected void checkAll(boolean state)
      Checks all elements.
      Parameters:
      state - the check state
    • createSearch

      protected void createSearch(org.eclipse.swt.widgets.Composite toolbarAndSearch)
      Creates search by string to panel.
      Parameters:
      toolbarAndSearch - toolbar and search composite, can not be null
    • createToolbarActions

      protected void createToolbarActions()
      Creates toolbar actions.
    • doDoubleClick

      protected void doDoubleClick()
      Does double click actions.
    • initToolbarActions

      protected void initToolbarActions()
      Inits toolbar actions.
    • initViewer

      protected abstract void initViewer(Object input)
      Inits viewer properties.
      Parameters:
      input - the viewer input, may be null
    • setState

      protected void setState(Object node, boolean checked)
      Sets node check state and updates its subtree and parents.
      Parameters:
      node - the target node, can not be null
      checked - the check value
    • updateTree

      protected void updateTree(Object node, boolean checked)
      Sets the checked state for the given node and its children in this viewer and updates the parent state.
      Parameters:
      node - the given node, can not be null
      checked - true if the node should be checked and false if it should be unchecked
    • getDescendants

      protected List<Object> getDescendants(Object node)
      Gets all descendants for the given node.
      Parameters:
      node - the tree node, can not be null
      Returns:
      the list of all descendants, never null
    • createCheckboxTreeViewer

      protected CheckboxTreeViewer createCheckboxTreeViewer()
      Creates checkbox tree viewer.
      Returns:
      the new checkbox tree viewer, cannot be null