org.vishia.guiInspc

## Class InspcCurveView

- java.lang.Object
- - org.vishia.guiInspc.InspcCurveView

-     public final class InspcCurveView
      extends java.lang.Object

  A curve view window inside the inspector.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `GralUserAction` | `actionColorSelectorOpen`
    `GralColorSelector.SetColorIfc` | `actionColorSet`
    `(package private) GralUserAction` | `actionDeleteVariable`
    `(package private) GralUserAction` | `actionEnterFile` Action for Enter the file.
    `GralUserAction` | `actionFocusScaling`
    `(package private) GralUserAction` | `actionInsertVariable`
    `GralUserAction` | `actionKeyHandlingTable`
    `(package private) GralUserAction` | `actionOnOffTrack`
    `(package private) GralUserAction` | `actionOpenFileDialog`
    `(package private) GralUserAction` | `actionOpenWindow` Adds an info block to the request telegram to get values.
    `(package private) GralUserAction` | `actionReplaceVariable` This action will be called if the mouse is pressed on the drop field.
    `(package private) GralUserAction` | `actionScaleFromMarkedTrack`
    `(package private) GralUserAction` | `actionSelectFile` Action invoked for any selected file.
    `(package private) GralUserAction` | `actionSelectOrChgVarPath` called if The text field was entered with mouse or the focus lost on a changed variable path field.
    `(package private) GralUserAction` | `actionSelectVariableInTable` called if The text field was entered with mouse or the focus lost on a changed variable path field.
    `(package private) GralUserAction` | `actionSetScaleValues2Track`
    `(package private) GralUserAction` | `actionShareScale`
    `(package private) GralUserAction` | `actionShiftVariable`
    `GralUserAction` | `actionShowCursorValues`
    `(package private) GralUserAction` | `actionSwapVariable`
    `GralUserAction` | `actionTrackSelectedFromGralCurveViewCtrlMousePressed`
    `(package private) GralUserAction` | `actionUnshareScale`
    `(package private) GralColor` | `colorBlack`
    `(package private) GralColor` | `colorBtnFileActive`
    `(package private) GralColor` | `colorBtnFileInactive`
    `private static java.lang.String[]` | `colorCurveDefault`
    `(package private) GralColorSelector` | `colorSelector` Common ColorSelector for all curve views.
    `(package private) GralColor` | `colorTrackNotShown`
    `(package private) GralColor` | `colorTrackNotShownSelected`
    `(package private) GralColor` | `colorTrackOtherScale`
    `(package private) GralColor` | `colorTrackOtherScaleSelected`
    `(package private) GralColor` | `colorTrackSameScale`
    `(package private) GralColor` | `colorTrackSameScaleSelected`
    `private java.util.Map<java.lang.String,java.lang.String>` | `curveExporterClasses`
    `(package private) FileRemote` | `dirCurveSave`
    `(package private) FileRemote` | `fileCurveCfg` The currently loaded file for curve settings.
    `(package private) GralMng` | `gralMng`
    `(package private) int` | `ixTrackScale`
    `static java.lang.String` | `sBtnReadCfg`
    `static java.lang.String` | `sBtnReadValues`
    `static java.lang.String` | `sBtnSaveCfg`
    `static java.lang.String` | `sBtnSaveValues`
    `(package private) GralTextField` | `scalingWidg` The one of `widgScale0`, `widgScale0` or `widgline0` which was focused lastly.
    `(package private) StringFormatter` | `sFormatter` Temporary used formatter.
    `protected java.lang.String` | `sName`
    `static java.lang.String` | `sVersion` Version, history and license.
    `private java.lang.String` | `sWhatTodoWithFile`
    `(package private) GralCurveViewTrack_ifc` | `trackScale` The input field which is the current scaling field.
    `(package private) VariableContainer_ifc` | `variables`
    `(package private) GralButton` | `wdgButtonAutosave`
    `(package private) GralButton` | `widgBtnColor`
    `(package private) GralButton` | `widgBtnDn`
    `(package private) GralButton` | `widgBtnOff`
    `(package private) GralButton` | `widgBtnReadCfg`
    `(package private) GralButton` | `widgBtnReadValues`
    `(package private) GralButton` | `widgBtnSaveCfg`
    `(package private) GralButton` | `widgBtnSaveValues`
    `(package private) GralButton` | `widgBtnScale`
    `(package private) GralButton` | `widgBtnUp`
    `(package private) GralCurveView` | `widgCurve`
    `private GralTextField` | `widgFilename` Shows the name and input name for read/write config and data.
    `private GralFileSelector` | `widgFileSelector` Used for read/write config and for read/write data
    `(package private) GralTextField` | `widgline0`
    `(package private) GralTextField` | `widgScale`
    `(package private) GralTextField` | `widgScale0`
    `(package private) GralTable<GralCurveViewTrack_ifc>` | `widgTableVariables`
    `(package private) GralTextField` | `widgValCursorLeft`
    `(package private) GralTextField` | `widgValCursorRight`
    `(package private) GralWindow` | `windCurve` The window for curve view.
    `private WriteCurve_ifc` | `writerCurveCsv`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `InspcCurveView(java.lang.String sName, VariableContainer_ifc variables, GralMng gralMng, FileRemote defaultDirCfg, FileRemote defaultDirSave, java.util.Map<java.lang.String,java.lang.String> curveExporterClasses)` Creates the instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) boolean` | `actionReadCfg(int actionCode, GralWidget_ifc widgd, java.lang.Object... params)`
    `(package private) void` | `actionReadValues(int actionCode, GralWidget_ifc widgd, java.lang.Object... params)` Action invoked if the read file was selected in the `GralFileSelectWindow`
    `(package private) void` | `actionSaveCfg(int actionCode, GralWidget_ifc widgd, java.lang.Object... params)`
    `(package private) void` | `actionSaveValues(int actionCode, GralWidget_ifc widgd, java.lang.Object... params)` Action invoked if the write file was selected in the `GralFileSelectWindow`
    `void` | `buildGraphic(GralWindow_ifc wind, GralColorSelector colorSelector, GralCurveView.CommonCurve common)` Builds the graphic, it should be called only one time on startup in the graphic thread
    `(package private) void` | `buildGraphicInCurveWindow(GralCurveView.CommonCurve common)`
    `protected void` | `chgSelectedTrack(GralCurveViewTrack_ifc trackNew)`
    `protected boolean` | `deleteVariable(int actionCode, GralWidget widgd, boolean bInsert)`
    `protected boolean` | `dropVariable(int actionCode, GralWidget widgd, boolean bInsert)`
    `(package private) void` | `fillTableTracks()`
    `protected void` | `readCurve(java.io.File file)` Reads a curve ///
    `(package private) void` | `refreshCurve()`
    `protected void` | `saveCurve(GralCurveView_ifc.ModeWrite mode)` Saves a curve ///
    `(package private) void` | `setDatapath(GralTable.TableLineData line, java.lang.String sDatapath)`
    `void` | `stepSaveCurve()` Step routine to save a curve.

    - ### Methods inherited from class java.lang.Object

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

- - ### Field Detail

    - #### sVersion

          public static final java.lang.String sVersion

      Version, history and license.
      - 2018-01-08 Hartmut refactoring
        - private class TrackValues removed, it hasn't any specific content, replaced by `GralCurveViewTrack_ifc` which refers a `GralCurveView.Track`.
        - new `fillTableTracks()`, content from `actionReadCfg(int, GralWidget_ifc, Object...)` but also invoked in `actionReadValues(int, GralWidget_ifc, Object...)`. That may add tracks.
      - 2018-01-08 Hartmut new: If a datapath was written in a cell of variable paths which is not part of table, especially on an clean or small table, than the routine `GralTable.getCellTextFocus()` is called to get the datapath as text. This is a new line, it is added. Therewith now it is easy to add lines to an empty table via path in clibboard.
      - 2016-05-03 Hartmut chg: Selection of file in this window instead an own dialog window: Advantage: This window is always on top. A opened dialog window may be in background - fatal. It is well to use.
      - 2015-07-12 Hartmut new: switch on and off for curves.
      - 2015-07-12 Hartmut new: Better usability for scaling. [+] and [-] - Buttons works correctly. Enter in field for scaling values has an effect immediately. Support for more as one track with the same scaling.
      - 2013-05-19 Hartmut new: `#actionTrackSelected` with ctrl and left mouse pressed
      - 2013-05-15 Hartmut new: Presentation of value on cursor
      - 2013-05-14 Hartmut chg: 12 Tracks instead 10. A variableWindowSize cause problems (TODO)
      - 2013-05-14 Hartmut progress: `actionSwapVariable`, `actionShiftVariable`
      - 2013-05-13 Hartmut new: `actionSwapVariable`, `actionSelectOrChgVarPath`
      - 2013-03-28 Hartmut adapt new `GralFileSelectWindow`
      - 2013-03-27 Hartmut improved/bugfix: The `TrackValues#trackView` is the reference to the track in the `GralCurveView` instance. If a new config is loaded all tracks in `GralCurveView.getTrackInfo()` are created newly using `GralCurveView.addTrack(String, String, GralColor, int, int, float, float)`. Therefore the `TrackValues#trackView` should be updated.
      - 2012-10-09 Hartmut now ctrl-mouse down sets the scale settings for the selected channel. Faster user operation.
      - 2012-08-10 Hartmut now uses a default directory for config file given in constructor.
      - 2012-07-06 Hartmut now read and save of the file works.
      - 2012-06-29 Hartmut new open file dialog
      - 2012-06-08 Hartmut: new Buttons for read and save the configuration (setting). Yet only a simple file is used. TODO: File selection.
      - 2012-03-17 Hartmut creating using the `GralCurveView` in a special window with the communication in `InspcMng`.
      Copyright/Copyleft: For this source the LGPL Lesser General Public License, published by the Free Software Foundation is valid. It means:
      1. You can use this source without any restriction for any desired purpose.
      2. You can redistribute copies of this source to everybody.
      3. Every user of this source, also the user of redistribute copies with or without payment, must accept this license for further using.
      4. But the LPGL is not appropriate for a whole software product, if this source is only a part of them. It means, the user must publish this part of source, but don't need to publish the whole source of the own product.
      5. You can study and modify (improve) this source for own using or for redistribution, but you have to license the modified sources likewise under this LGPL Lesser General Public License. You mustn't delete this Copyright/Copyleft inscription in this source file.
      If you are intent to use this sources without publishing its usage, you can get a second license subscribing a special contract with the author.
      See Also:
        Constant Field Values

    - #### sBtnReadCfg

          public static java.lang.String sBtnReadCfg

    - #### sBtnSaveCfg

          public static java.lang.String sBtnSaveCfg

    - #### sBtnReadValues

          public static java.lang.String sBtnReadValues

    - #### sBtnSaveValues

          public static java.lang.String sBtnSaveValues

    - #### sName

          protected final java.lang.String sName

    - #### curveExporterClasses

          private final java.util.Map<java.lang.String,java.lang.String> curveExporterClasses

    - #### writerCurveCsv

          private final WriteCurve_ifc writerCurveCsv

    - #### windCurve

          GralWindow windCurve

      The window for curve view.

    - #### widgFileSelector

          private final GralFileSelector widgFileSelector

      Used for read/write config and for read/write data

    - #### sWhatTodoWithFile

          private java.lang.String sWhatTodoWithFile

    - #### widgFilename

          private final GralTextField widgFilename

      Shows the name and input name for read/write config and data.

    - #### gralMng

          final GralMng gralMng

    - #### variables

          final VariableContainer_ifc variables

    - #### colorCurveDefault

          private static final java.lang.String[] colorCurveDefault

    - #### trackScale

          GralCurveViewTrack_ifc trackScale

      The input field which is the current scaling field.

    - #### ixTrackScale

          int ixTrackScale

    - #### colorBlack

          final GralColor colorBlack

    - #### colorTrackSameScale

          GralColor colorTrackSameScale

    - #### colorTrackSameScaleSelected

          GralColor colorTrackSameScaleSelected

    - #### colorTrackOtherScaleSelected

          GralColor colorTrackOtherScaleSelected

    - #### colorTrackOtherScale

          GralColor colorTrackOtherScale

    - #### colorTrackNotShown

          GralColor colorTrackNotShown

    - #### colorTrackNotShownSelected

          GralColor colorTrackNotShownSelected

    - #### colorBtnFileActive

          GralColor colorBtnFileActive

    - #### colorBtnFileInactive

          GralColor colorBtnFileInactive

    - #### widgTableVariables

          GralTable<GralCurveViewTrack_ifc> widgTableVariables

    - #### widgScale

          GralTextField widgScale

    - #### widgScale0

          GralTextField widgScale0

    - #### widgline0

          GralTextField widgline0

    - #### scalingWidg

          GralTextField scalingWidg

      The one of `widgScale0`, `widgScale0` or `widgline0` which was focused lastly. To use for [+] and [-] button.

    - #### widgValCursorLeft

          GralTextField widgValCursorLeft

    - #### widgValCursorRight

          GralTextField widgValCursorRight

    - #### widgBtnUp

          GralButton widgBtnUp

    - #### widgBtnDn

          GralButton widgBtnDn

    - #### widgBtnScale

          GralButton widgBtnScale

    - #### widgBtnReadCfg

          GralButton widgBtnReadCfg

    - #### widgBtnSaveCfg

          GralButton widgBtnSaveCfg

    - #### widgBtnReadValues

          GralButton widgBtnReadValues

    - #### widgBtnSaveValues

          GralButton widgBtnSaveValues

    - #### wdgButtonAutosave

          GralButton wdgButtonAutosave

    - #### widgBtnColor

          GralButton widgBtnColor

    - #### widgBtnOff

          GralButton widgBtnOff

    - #### fileCurveCfg

          FileRemote fileCurveCfg

      The currently loaded file for curve settings.

    - #### dirCurveSave

          FileRemote dirCurveSave

    - #### sFormatter

          StringFormatter sFormatter

      Temporary used formatter.

    - #### colorSelector

          GralColorSelector colorSelector

      Common ColorSelector for all curve views.

    - #### widgCurve

          GralCurveView widgCurve

    - #### actionOpenWindow

          GralUserAction actionOpenWindow

      Adds an info block to the request telegram to get values. This routine is called when the tx telegram to get values from target is assembled. void addTxInfoBlock(){ if(widgBtnOff.getState() == GralButton.kOn){ GralCurveViewTrack_ifc inpLast = null; for(GralCurveViewTrack_ifc inp: tracks){ if(inp.widgetVariable !=null){ String sDataPath = inp.widgetVariable.getDataPath(); //inp.widgVarPath.getText().trim(); //if(sDataPath.length() >0){ inpLast = inp; inp.bLast = false; //all set to fast, but only the inpLast.bLast = true; comm.getValueByPath(sDataPath, inp.rxActionRxValueByPath); } } //for if(inpLast !=null){ //at least one variable given. inpLast.bLast = true; } } }

    - #### actionReplaceVariable

          GralUserAction actionReplaceVariable

      This action will be called if the mouse is pressed on the drop field. It is not drag and drop because drag'ndrop doesn't works on a field which content is not be able to select. That is on show fields. Therefore the `GralMng.getLastClickedWidget()` is used to detect which show field was clicked last.

    - #### actionDeleteVariable

          GralUserAction actionDeleteVariable

    - #### actionOnOffTrack

          GralUserAction actionOnOffTrack

    - #### actionInsertVariable

          GralUserAction actionInsertVariable

    - #### actionKeyHandlingTable

          public GralUserAction actionKeyHandlingTable

    - #### actionSwapVariable

          GralUserAction actionSwapVariable

    - #### actionShiftVariable

          GralUserAction actionShiftVariable

    - #### actionShareScale

          GralUserAction actionShareScale

    - #### actionUnshareScale

          GralUserAction actionUnshareScale

    - #### actionSetScaleValues2Track

          GralUserAction actionSetScaleValues2Track

    - #### actionScaleFromMarkedTrack

          GralUserAction actionScaleFromMarkedTrack

    - #### actionSelectVariableInTable

          GralUserAction actionSelectVariableInTable

      called if The text field was entered with mouse or the focus lost on a changed variable path field.

    - #### actionSelectOrChgVarPath

          GralUserAction actionSelectOrChgVarPath

      called if The text field was entered with mouse or the focus lost on a changed variable path field.

    - #### actionOpenFileDialog

          GralUserAction actionOpenFileDialog

    - #### actionSelectFile

          GralUserAction actionSelectFile

      Action invoked for any selected file.

    - #### actionEnterFile

          GralUserAction actionEnterFile

      Action for Enter the file.

    - #### actionFocusScaling

          public GralUserAction actionFocusScaling

    - #### actionColorSelectorOpen

          public GralUserAction actionColorSelectorOpen

    - #### actionColorSet

          public GralColorSelector.SetColorIfc actionColorSet

    - #### actionShowCursorValues

          public GralUserAction actionShowCursorValues

    - #### actionTrackSelectedFromGralCurveViewCtrlMousePressed

          public GralUserAction actionTrackSelectedFromGralCurveViewCtrlMousePressed

  - ### Constructor Detail

    - #### InspcCurveView

          InspcCurveView(java.lang.String sName,
                         VariableContainer_ifc variables,
                         GralMng gralMng,
                         FileRemote defaultDirCfg,
                         FileRemote defaultDirSave,
                         java.util.Map<java.lang.String,java.lang.String> curveExporterClasses)

      Creates the instance. The graphical appearance will not be created. Call `#buildGraphic(GralPrimaryWindow_ifc, GralColorSelector)` to do that.
      Parameters:
        `sName` - Name shown in title bar
        `variables` - Container to find variables
        `gralMng` - The Gral Graphic Manager
        `defaultDir` -
        `curveExporterClasses` - Class which is used to export curves.

  - ### Method Detail

    - #### buildGraphic

          public void buildGraphic(GralWindow_ifc wind,
                                   GralColorSelector colorSelector,
                                   GralCurveView.CommonCurve common)

      Builds the graphic, it should be called only one time on startup in the graphic thread
      Parameters:
        `wind` - The main window where the menu to open will be added
        `sName` - The name, used for menu entry too, sample "curve A"

    - #### buildGraphicInCurveWindow

          void buildGraphicInCurveWindow(GralCurveView.CommonCurve common)

    - #### fillTableTracks

          void fillTableTracks()

    - #### refreshCurve

          void refreshCurve()

    - #### dropVariable

          protected boolean dropVariable(int actionCode,
                                         GralWidget widgd,
                                         boolean bInsert)

    - #### deleteVariable

          protected boolean deleteVariable(int actionCode,
                                           GralWidget widgd,
                                           boolean bInsert)

    - #### setDatapath

          void setDatapath(GralTable.TableLineData line,
                           java.lang.String sDatapath)

    - #### stepSaveCurve

          public void stepSaveCurve()

      Step routine to save a curve. A curve will be saved only if the time has expired and the autoSave button is on.

    - #### readCurve

          protected void readCurve(java.io.File file)

      Reads a curve ///

    - #### saveCurve

          protected void saveCurve(GralCurveView_ifc.ModeWrite mode)

      Saves a curve ///

    - #### actionReadCfg

          boolean actionReadCfg(int actionCode,
                                GralWidget_ifc widgd,
                                java.lang.Object... params)

    - #### actionSaveCfg

          void actionSaveCfg(int actionCode,
                             GralWidget_ifc widgd,
                             java.lang.Object... params)

    - #### actionReadValues

          void actionReadValues(int actionCode,
                                GralWidget_ifc widgd,
                                java.lang.Object... params)

      Action invoked if the read file was selected in the `GralFileSelectWindow`

    - #### actionSaveValues

          void actionSaveValues(int actionCode,
                                GralWidget_ifc widgd,
                                java.lang.Object... params)

      Action invoked if the write file was selected in the `GralFileSelectWindow`

    - #### chgSelectedTrack

          protected void chgSelectedTrack(GralCurveViewTrack_ifc trackNew)