Proposal for auto hide lines

Developers
karthik
2006-11-08
2013-05-15
  • karthik

    karthik - 2006-11-08

    I will create an ArrayList in SectionViewer class to store all the TraceLineViewer objects.Also SectionViewer class will observe the ZoomModel class.

    The TraceLineViewer class will have two new variables

    hidden – This Boolean variable will store the current state of the sample line( i.e. whether it is currently visible or not).

    traceCanvasHeight – it will store the trace canvas height.

    Also it will have these new methods

    update()  - which will perform the actual work as described in the later part.

    isLineHidden(). – it returns the value of “hidden” variable.

    getTraceCanvasHeight() – returns the trace canvas height

    The SectionTraceViewer class will have a new method.

    updateSectionHeight() which will update the variable “traceHeight” .This method will have 2 arguments. They are the amount by which the traceHeight  must be changed. If we are hiding a line then we need to subtract the canvas height. If we are enabling a previously hidden line then we need to add the canvas height. The height of the section can be changed by setting the height attribute of the FormData. The height of the canvas will be collected from getTraceCanvasHeight(). The second argument will be a Boolean value which directs us whether to add or subtract the canvas height. This value will be taken from the isLineHidden().

    The pseudo code for the updateSectionHeight(int canvasHeight, boolean  hidden) method is as follows:

    Get the current FormData object and Store it in a variable “data” which is of type FormData.

            If(hidden == true) {
            data.height -= canvasHeight
            traceHeight -= canvasHeight
            }
            Else     {
            data.height += canvasHeight
            traceHeight += canvasHeight
            }
            Relayout the parent of the section trace.

    The SectionLabelViewer class will also have a new method called updateSectionHeight() which will update the variable “contentHeight” located in SectionBar class. This method will  have 2 arguments. They are the amount by which the contentHeight  must be changed. If we are hiding the label then we need to subtract the label height. If we are enabling a previously hidden label then we need to add the label height. The height of the section can be changed by setting the height attribute of the FormData. The height of the label will be collected from getTraceCanvasHeight().The second argument will be a Boolean value which directs us whether to add or subtract the label height. This value will be taken from the isLineHidden().

    The pseudo code for the updateSectionHeight(int labelHeight, boolean  hidden) method is as follows:

    Get the current section height. i.e. currentHeight = getContentHeight()

    /* getContentHeight() is a method defined in SectionBar class which
    is the super class of SectionLabelViewer class.
    */
            If(hidden == true) {
            setContentHeight(currentHeight - labelHeight)
            }
            Else     {
            setContentHeight(currentHeight + labelHeight)
            }
    /* setContentHeight() is a method defined in SectionBar class which will update the variable “contentHeight”.
    */

    The pseudo code for the update(Observable arg0, Object arg1) of SectionViewer class is as follows :
    For all objects in TraceLineViewerArrayList do
    1.    Call update()
    2.    int height  =   getCanvasHeight()
    3.    boolean visible =   isLineHidden()
    4.    Call updateSectionHeight(height,visible) which is present in SectionTraceViewer class
    5.    Call updateSectionHeight(height,visible) which is present in SectionLabelViewer class

    The pseudo code for the update()

    Check whether the sample line must be hidden or not
            If( hidden == false AND sampleline needs to be hidden) {
            hide the line by setting the exclude property of GridData.
    set  traceCanvasHeight to the height of the present canvas
            hidden = true
            }
    Else If (hidden == true AND sampleline needs to be made visible)   {
    set  traceCanvasHeight to the height of the present canvas
            hidden = false
            }
            Else {
            set traceCanvasHeight to 0.
            }

     
    • Martijn Rutten

      Martijn Rutten - 2006-11-09

      I agree with the basic structure. Slightly worried about performance of doing two binary searches on each zoom action, but we will simply have to try it out.

      I would add a hasSamples(startTime, endTime) funtion to the SampleLine class which returns a boolean if the sample line contains any samples within the time interval.
      The time interval is the start and end time from the zoom model.
      Use this function in the update method.

      Later we may add functions hideLine(bool) and isHidden() to the SampleLine to also actively select if the line should be visible from a user action.

      Next, the TraceLineVierwer update method, I would rename into: hideLine(boolean)
      and rename getCanvasHeight into TraceLineViewer::getHeight()

      Success!

       
    • Martijn Rutten

      Martijn Rutten - 2006-11-21

      As you see I proposed a few changes on the patch with the implementation of the above. Please see the patch tracker for the comments.

       
    • Martijn Rutten

      Martijn Rutten - 2006-11-21

      Himm, if you have to show or hide a lot of items in one go (e.g. on zoom in/out), this is very slow. We should try to implement the code such that layout updates are done only AFTER all lines are shown/hidden (not re-layout after each line update).

       
    • Martijn Rutten

      Martijn Rutten - 2006-11-21

      Currently, we have a mix of requirements for trace lines in a section:
      - expand/collapse of a section
      - auto hide of the lines in a section
      - change section height (and thereby line height) by dragging the section bar below
      I expect additional requirements:
      - each line has its own height, e.g. for queues.
      - change the height of an individual line by dragging on the separator directly below the line
      - manually select lines to show/hide

      All these requirements together becomes a big jumble in the current implementation. Maybe we can think on a new implementation that resolves all these issues more coherently.
      For example:
      - each line stores its own height
      - the sashes below lines (or sections) are not based on a fixed screen position, but linked to the lines. By dragging the sash, the line height is explicitly updated.
      - expand/collapse is done via hide/unhide all lines in the section

      Any comments?

       
    • Martijn Rutten

      Martijn Rutten - 2006-12-05

      For your information, I am trying out a refactoring of the trace viewer in which I use GridLayout instead of composites and FormLayout.
      This means that (as far as I can see now):
      - SectionLabelViewer and SectionTraceViewer will be removed
      - All labels and section headers are drawn in the same composite, no more composites per section
      - All trace lines and section headers are drawn in the same composite, no more composites per section
      - Each trace line has its own height, allowing easy implementation of proportional queues etc.
      - Each trace line will have its own sash to change vertical height, sash move is done by changing the trace height
      - Expand/collapse is done by excluding all trace lines in the section
      - Trace lines can be moved accross section boundaries by drag & drop (so you can put a queue line next to a task line)

      I think this will dramatically reduce the complexity of the code, as we use only one mechanism for all: gridlayout with a set height per trace line,
      but so far I will have to tackle a whole lot of issues before I'm back at the "old" functionality.

      ---- Martijn

       

Log in to post a comment.