Coverage Report - org.openpermis.editor.policy.view.ViewContext
 
Classes in this File Line Coverage Branch Coverage Complexity
ViewContext
N/A
N/A
1
 
 1  
 /*
 2  
  * Copyright (c) 2009, Swiss Federal Department of Defence Civil Protection and Sport
 3  
  *                     (http://www.vbs.admin.ch)
 4  
  * Copyright (c) 2009, Ergon Informatik AG (http://www.ergon.ch)
 5  
  * All rights reserved.
 6  
  *
 7  
  * Licensed under the Open Permis License which accompanies this distribution,
 8  
  * and is available at http://www.openpermis.org/BSDlicenceKent.txt
 9  
  */
 10  
 package org.openpermis.editor.policy.view;
 11  
 
 12  
 import org.openpermis.editor.policy.gui.binding.ErrorReporter;
 13  
 import org.openpermis.policy.bean.PartBean;
 14  
 
 15  
 /**
 16  
  * Manager for tool and editor views.
 17  
  * <p>The view manager provides methods to:</p>
 18  
  * <ul>
 19  
  * <li>Open tool and editor views.</li>
 20  
  * <li>Close tool and editor views.</li>
 21  
  * <li>Search for opened views.</li>
 22  
  * </ul>
 23  
  * @since 0.1.0
 24  
  */
 25  
 public interface ViewContext
 26  
         extends ErrorReporter
 27  
 {
 28  
         
 29  
         //---- Methods
 30  
         
 31  
         /**
 32  
          * Adds a listener for view context events.
 33  
          * <p>The same {@code listener} object may be added more than once, and will be called as many 
 34  
          * times as it is added.</p>
 35  
          * <p>If the {@code listener} is {@code null}, no action is taken.</p>
 36  
          * @param listener the listener to add, may be {@code null}.
 37  
          * @since 0.1.0
 38  
          */
 39  
         public void addViewContextListener (ViewContextListener listener);
 40  
         
 41  
         /**
 42  
          * Removes a listener from this view context.
 43  
          * <p>If the same {@code listener} was added more than once, it will be notified one less
 44  
          * time after being removed.</p>
 45  
          * <p>If the {@code listener} is {@code null}, or was never added, no action is taken.</p>
 46  
          * @param listener the listener to be removed, may be {@code null}.
 47  
          */
 48  
         public void removeViewContextListener (ViewContextListener listener);
 49  
         
 50  
         /**
 51  
          * Opens an editor for the specified part.
 52  
          * <p>If there is already an editor open, the editor will be shown.</p>
 53  
          * @param part the part to edit.
 54  
          * @return the editor of this part, {@code null} if the part cannot be edited.
 55  
          * @since 0.1.0
 56  
          */
 57  
         public Editor editPart (PartBean part);
 58  
 
 59  
         /**
 60  
          * Tests if the part specified can be edited.
 61  
          * <p>There are part types for which there may be no editor type registered, in such a case
 62  
          * the part is not editable and calling {@link #editPart(PartBean)} will yield a {@code null}
 63  
          * editor. Use this method if you want to test prior to actually creating the editor.</p>
 64  
          * @param part the part to test.
 65  
          * @return {@code true} if the part can be edited, {@code false} otherwise.
 66  
          * @since 0.3.0
 67  
          */
 68  
         public boolean canEditPart (PartBean part);
 69  
 
 70  
         /**
 71  
          * Updates the title of the specified view.
 72  
          * @param view the view for which to update the title.
 73  
          * @since 0.1.0
 74  
          */
 75  
         public void updateViewTitle (View view);
 76  
         
 77  
         /**
 78  
          * Opens the specified view.
 79  
          * @param view the view to be opened.
 80  
          * @since 0.1.0
 81  
          */
 82  
         public void openView (View view);
 83  
 
 84  
         /**
 85  
          * Closes the specified view.
 86  
          * @param view the view to be closed.
 87  
          * @param force {@code true} to force closing of the view.
 88  
          * @return {@code true} if the view was closed, {@code false} if the view denied closing.
 89  
          * @since 0.1.0
 90  
          */
 91  
         public boolean closeView (View view, boolean force);
 92  
 
 93  
 }