001package org.vishia.guiInspc;
002
003import java.io.File;
004import java.io.IOException;
005import java.util.LinkedList;
006import java.util.List;
007import java.util.Map;
008import java.util.TreeMap;
009
010import org.vishia.byteData.VariableAccess_ifc;
011import org.vishia.communication.InterProcessCommFactorySocket;
012import org.vishia.fileRemote.FileCluster;
013import org.vishia.fileRemote.FileRemote;
014import org.vishia.gral.area9.GuiCallingArgs;
015import org.vishia.gral.area9.GuiCfg;
016import org.vishia.gral.area9.GralArea9MainCmd;
017import org.vishia.gral.base.GralButton;
018import org.vishia.gral.base.GralMenu;
019import org.vishia.gral.base.GralMng;
020import org.vishia.gral.base.GralPanelActivated_ifc;
021import org.vishia.gral.base.GralPanelContent;
022import org.vishia.gral.base.GralPos;
023import org.vishia.gral.base.GralShowMethods;
024import org.vishia.gral.base.GralWidget;
025import org.vishia.gral.ifc.GralColor;
026import org.vishia.gral.ifc.GralPlugUser2Gral_ifc;
027import org.vishia.gral.ifc.GralPlugUser_ifc;
028import org.vishia.gral.ifc.GralUserAction;
029import org.vishia.gral.ifc.GralWidget_ifc;
030import org.vishia.gral.widget.GralColorSelector;
031import org.vishia.inspcPC.InspcAccess_ifc;
032import org.vishia.inspcPC.InspcPlugUser_ifc;
033import org.vishia.inspcPC.InspcTargetAccessData;
034import org.vishia.inspcPC.UserInspcPlug_ifc;
035import org.vishia.inspcPC.accTarget.InspcTargetAccessor;
036import org.vishia.inspcPC.mng.InspcMng;
037import org.vishia.inspectorTarget.Inspector;
038import org.vishia.msgDispatch.LogMessage;
039import org.vishia.msgDispatch.LogMessageFile;
040import org.vishia.util.Assert;
041import org.vishia.util.CompleteConstructionAndStart;
042import org.vishia.util.FileSystem;
043import org.vishia.util.KeyCode;
044
045public class InspcGui implements CompleteConstructionAndStart //extends GuiCfg
046{
047
048  /**Version, history and license
049   * <ul>
050   * <li>2016-12-30 Hartmut chg: The buttons for log, retry, get by handle are not part of {@link InspcViewTargetComm} 
051   * <li>2016-01-24 Hartmut new: cmd line argument -cycle= for cycletime 
052   * <li>2015-01-27 Hartmut new: Test {@link #actionGetValueByHandleIntern}
053   * <li>2015-01-27 Hartmut new: Now initialized the {@link GralShowMethods} for usage on edit fields. An edit field
054   *   can use the {@link GralShowMethods#syncVariableOnFocus} if the text was changed. 
055   *   It invokes {@link VariableAccess_ifc#setString(String)} which changed the content of the variable on their target.
056   * <li>2012-08-10 Hartmut A default directory for curve config files given with argument "-dirCurves=".
057   * <li>2012-04-17 Hartmut new: Parameter {@link CallingArguments#bUseGetValueByIndex} for downward compatibility
058   * 
059   * <li>2011-04-20 Don't derive this class from {@link GuiCfg}, instead uses the inner class {@link InspcGuiCfg}.
060   *   It is a problem of order of instantiation.
061   * <li>2011-04-00 Hartmut creation.
062   * </ul>
063   * 
064   * <b>Copyright/Copyleft</b>:
065   * For this source the LGPL Lesser General Public License,
066   * published by the Free Software Foundation is valid.
067   * It means:
068   * <ol>
069   * <li> You can use this source without any restriction for any desired purpose.
070   * <li> You can redistribute copies of this source to everybody.
071   * <li> Every user of this source, also the user of redistribute copies
072   *    with or without payment, must accept this license for further using.
073   * <li> But the LPGL is not appropriate for a whole software product,
074   *    if this source is only a part of them. It means, the user
075   *    must publish this part of source,
076   *    but don't need to publish the whole source of the own product.
077   * <li> You can study and modify (improve) this source
078   *    for own using or for redistribution, but you have to license the
079   *    modified sources likewise under this LGPL Lesser General Public License.
080   *    You mustn't delete this Copyright/Copyleft inscription in this source file.
081   * </ol>
082   * If you are intent to use this sources without publishing its usage, you can get
083   * a second license subscribing a special contract with the author. 
084   * 
085   * @author Hartmut Schorrig = hartmut.schorrig@vishia.de
086   */
087  //@SuppressWarnings("hiding")
088  public final static String version = "2016-06-26";
089  
090  private final List<CompleteConstructionAndStart> composites = new LinkedList<CompleteConstructionAndStart>();
091  
092
093  /**Action for button log. It switches on or off the logging functionality to log the telegram traffic
094   * for debugging. */
095  GralUserAction actionSetRetryDisabledVariable = new GralUserAction("InspcGui - setRetryDisabledVariable"){
096    @Override public boolean userActionGui(int actionCode, GralWidget widgd, Object... params) { 
097      if(KeyCode.isControlFunctionMouseUpOrMenu(actionCode)){
098        GralButton widgButton = (GralButton)widgd;
099        inspcMng.setmodeRetryDisabledVariables(widgButton.isOn());
100      }
101      return true;
102    }
103  };
104  
105
106  /**Action for button log. It switches on or off the logging functionality to log the telegram traffic
107   * for debugging. */
108  GralUserAction actionUseGetValueByHandle = new GralUserAction("InspcGui - UseGetValueByIndex"){
109    @Override public boolean userActionGui(int actionCode, GralWidget widgd, Object... params) { 
110      if(KeyCode.isControlFunctionMouseUpOrMenu(actionCode)){
111        GralButton widgButton = (GralButton)widgd;
112        inspcMng.setmodeGetValueByIndex(widgButton.isOn());
113      }
114      return true;
115    }
116  };
117  
118
119  
120  
121  /**The communication manager. */
122  //final InspcGuiComm XXXinspcComm;
123  
124  private final CallingArguments cargs;
125  
126  GralPanelActivated_ifc panelActivated = new GralPanelActivated_ifc(){
127
128    public void panelActivatedGui(List widgets)
129    { panelActivated(widgets); 
130    }
131    /*
132    @Override public void panelActivatedGui(Queue<GralWidget> widgets)
133    { panelActivated(widgets); 
134    }
135    */
136  };
137
138  final GuiCfg guiCfg;
139  
140  final InspcMng inspcMng;
141  
142  final private Runnable callbackOnReceivedData = new Runnable(){ @Override public void run(){ callbackOnReceivedData(); } };
143  
144  
145  static final GralColor colorRefreshed = GralColor.getColor("wh");
146  static final GralColor colorOldValue = GralColor.getColor("lgr");
147  
148  InspcCurveView curveA, curveB, curveC;
149  
150  InspcFieldTable fieldsA, fieldsB;
151  
152  InspcViewTargetComm viewTargetComm;
153  
154  /**This plugged application for the inspector manager. */  
155  InspcPlugUser inspcMngUser;
156  
157  public GralColorSelector colorSelector;
158  
159  private final FileCluster fileCluster = FileRemote.clusterOfApplication;
160
161  InspcGui(CallingArguments cargs, GralArea9MainCmd cmdgui)
162  {
163    ButtonInspcCmd.registerUserAction();
164    viewTargetComm = new InspcViewTargetComm(this);
165    guiCfg = new InspcGuiCfg(cargs, cmdgui, userInspcPlug);
166    GralMng.get().registerUserAction("<name>", actionGetValueByHandleIntern);
167    for(Map.Entry<String, String> entry: cargs.indexTargetIpcAddr.entrySet()){
168      viewTargetComm.addTarget(entry.getKey(), entry.getValue(), 0.2f, 5);
169    }
170    
171
172    LogMessage log = cmdgui.getLogMessageOutputConsole();
173    this.cargs = cargs;  //args in the correct derived type.
174    /**
175    assert(user instanceof InspcPlugUser_ifc);
176    if(user !=null){
177      user.init(userInspcPlug, log);
178    }
179    */
180    GralPlugUser_ifc user = guiCfg.getPluggedUser(); 
181    assert(user == null || user instanceof InspcPlugUser_ifc);
182    inspcMngUser = new InspcPlugUser((InspcPlugUser_ifc)user);
183    if(cargs.sOwnIpcAddr ==null){
184      System.err.println("arg ownIpc missing");
185      System.exit(255);
186    }
187    InspcMng variableMng = new InspcMng(cargs.sOwnIpcAddr, cargs.indexTargetIpcAddr, cargs.cycletime, cargs.bUseGetValueByIndex, inspcMngUser);
188    composites.add(variableMng);
189    this.inspcMng = variableMng;
190    (new GralShowMethods(variableMng)).registerShowMethods(cmdgui.gralMng);
191    variableMng.setCallbackOnReceivedData(callbackOnReceivedData);
192    //variableMng.setCallbackShowingState(callbackShowTargetCommState);
193    
194    //this.XXXinspcComm = new InspcGuiComm(this, guiCfg.gralMng, cargs.indexTargetIpcAddr, (InspcPlugUser_ifc)user);
195    //composites.add(XXXinspcComm);
196    
197    if(cargs.sDefaultDirCfgForCurves !=null) {
198      CharSequence sDefaultDirCfgForCurves = FileSystem.normalizePath(new File(cargs.sDefaultDirCfgForCurves).getAbsolutePath());
199      FileRemote defaultDirCfg = fileCluster.getFile(sDefaultDirCfgForCurves, null);
200      FileRemote defaultDirSave;
201      if(cargs.sDefaultDirSaveForCurves !=null) {
202        CharSequence sDefaultDirSaveForCurves = FileSystem.normalizePath(new File(cargs.sDefaultDirSaveForCurves).getAbsolutePath());
203        defaultDirSave = fileCluster.getFile(sDefaultDirSaveForCurves, null);
204      } else {
205        defaultDirSave = null;
206      }
207      curveA = new InspcCurveView("curve_A", variableMng, cmdgui.gralMng, defaultDirCfg, defaultDirSave, cargs.curveExporterClasses);
208      curveB = new InspcCurveView("curve_B", variableMng, cmdgui.gralMng, defaultDirCfg, defaultDirSave, cargs.curveExporterClasses);
209      curveC = new InspcCurveView("curve_C", variableMng, cmdgui.gralMng, defaultDirCfg, defaultDirSave, cargs.curveExporterClasses);
210    }
211    fieldsA = new InspcFieldTable(variableMng);
212    fieldsB = new InspcFieldTable(variableMng);
213    
214  }
215  
216  @Override public void completeConstruction(){
217    this.inspcMng.complete_ReplaceAlias_ifc(guiCfg._gralMng.getReplacerAlias());
218
219    for(CompleteConstructionAndStart composite: composites){
220      composite.completeConstruction();
221    }
222  }
223  
224  @Override public void startupThreads(){
225    for(CompleteConstructionAndStart composite: composites){
226      composite.startupThreads();
227    }
228  }
229
230  
231  
232  void panelActivated(List<GralWidget> widgets){
233    for(GralWidget widget: widgets){
234      
235    }
236  }
237  
238  
239
240  
241  /**This method is invoked by callback if a receive cycle is finished.
242   * Shows values.
243   */
244  private void callbackOnReceivedData(){
245    long time = System.currentTimeMillis();
246    GralMng gralMng = GralMng.get();
247    GralPanelContent primaryWindow = gralMng.getPrimaryWindow(); 
248    long timeAtleast = System.currentTimeMillis() - 5000;
249    checkWidgetsToRefresh(primaryWindow, time, timeAtleast, 0);
250    
251    //ConcurrentLinkedQueue<GralVisibleWidgets_ifc> listPanels = guiCfg._gralMng.getVisiblePanels();
252    //GralWidget widgdRemove = null;
253    try{
254      /*
255      for(GralVisibleWidgets_ifc panel: listPanels){
256        List<GralWidget> widgetsVisible = panel.getWidgetsVisible();
257        if(widgetsVisible !=null) for(GralWidget widget: widgetsVisible){
258          try{
259            String sShowMethod;
260            if((sShowMethod = widget.getShowMethod()) ==null || !sShowMethod.equals("stc_cmd")){
261              widget.refreshFromVariable(inspcMng, timeAtleast, colorRefreshed, colorOldValue);
262              widget.requestNewValueForVariable(time);
263            }
264          }catch(Exception exc){
265            System.err.println("InspcGui-receivedData-widget; " + exc.getMessage());   
266            exc.printStackTrace(System.err);
267          }
268        }
269      }
270      */
271      //referesh the curve view any time if it is enabled:
272      curveA.refreshCurve();
273      curveB.refreshCurve();
274      curveC.refreshCurve();
275    } catch(Exception exc){ 
276      System.err.println("InspcGui-receivedData; " + exc.getMessage()); 
277      exc.printStackTrace(System.out);
278    }
279    
280  }
281  
282  
283  
284  void checkWidgetsToRefresh(GralPanelContent panel, long time, long timeAtleast, int recursiveCnt)
285  { if(recursiveCnt > 10) { System.err.println("InspcGui: to many recursions"); assert(false); return; }
286    for(GralWidget widget: panel.getWidgetList()){
287      if(widget.isVisible()){
288        if(widget instanceof GralPanelContent) {
289          checkWidgetsToRefresh((GralPanelContent) widget, time, timeAtleast, recursiveCnt +1);
290        } else {
291          try{
292            if(widget.getDataPath() !=null) {
293              String sShowMethod;
294              if((sShowMethod = widget.getShowMethod()) ==null || !sShowMethod.equals("stc_cmd")){
295                widget.refreshFromVariable(inspcMng, timeAtleast, colorRefreshed, colorOldValue);
296                widget.requestNewValueForVariable(time);
297              }
298            }
299          }catch(Exception exc){
300            System.err.println("InspcGui-receivedData-widget; " + exc.getMessage());   
301            exc.printStackTrace(System.err);
302          }
303        }
304      }
305    }
306  
307  }
308  
309  
310  
311  
312  
313  static class CallingArguments extends GuiCallingArgs
314  {
315    /**The target ipc-address for Interprocess-Communication with the target.
316     * It is a string, which determines the kind of communication.
317     * For example "UDP:0.0.0.0:60099" to create a socket port for UDP-communication.
318     */
319    Map<String, String> indexTargetIpcAddr = new TreeMap<String, String>();
320
321    /**Cohesion between file extension and exporter java class path for curve output.*/
322    Map<String, String> curveExporterClasses = new TreeMap<String, String>();
323
324    /**File with the values from the S7 to show. */
325    //protected String sFileOamValues;
326
327    boolean bUseGetValueByIndex;
328    
329    public int cycletime = 100;
330    
331    String sDefaultDirCfgForCurves = "C:/";
332
333    String sDefaultDirSaveForCurves = "C:/";
334
335  }
336  
337  /**Organisation class for the GUI.
338   */
339  private static class CmdLineAndGui extends GralArea9MainCmd
340  {
341
342    /**Aggregation to given instance for the command-line-argument. The instance can be arranged anywhere else.
343     * It is given as ctor-parameter.
344     */
345    final protected CallingArguments cargs;
346    
347    
348    public CmdLineAndGui(CallingArguments cargs, String[] args)
349    {
350      super(cargs, args);
351      this.cargs = cargs;
352      super.addAboutInfo("Inspc-GUI-cfg");
353      super.addAboutInfo("made by HSchorrig, 2011-05-18, 2012-01-17");
354    }
355
356    @Override protected boolean testArgument(String arg, int nArg)
357    {
358      boolean bOk = true;  //set to false if the argc is not passed
359      try{
360        if(arg.startsWith("-targetIpc=")) 
361        { String sArg = getArgument(11);
362          int posSep = sArg.indexOf('@');
363          if(posSep < 0){
364            writeError("argument -targetIpc=KEY@ADDR: The '@' is missed.");
365            bOk = false;
366          } else {
367            String sKey = sArg.substring(0, posSep);
368            String sValue = sArg.substring(posSep+1);
369            cargs.indexTargetIpcAddr.put(sKey, sValue);
370          }
371        }
372        else if(arg.startsWith("-pluginCfg=")) 
373        { cargs.sPluginCfg = getArgument(11);
374        }
375        else if(arg.startsWith("-curve-export=")) 
376        { String sArg = getArgument(14);
377          int posSep = sArg.indexOf('=');
378          if(posSep < 0){
379            writeError("argument -curve-export=EXT=java.class.path");
380            bOk = false;
381          } else {
382            String sKey = sArg.substring(0, posSep);
383            String sValue = sArg.substring(posSep+1);
384            cargs.curveExporterClasses.put(sKey, sValue);
385          }
386        }
387        else if(arg.startsWith("-cycle=")) 
388        { String sTime = getArgument(7);
389          try{ cargs.cycletime = Integer.parseInt(sTime); }
390          catch(NumberFormatException exc){ bOk = false; writeError("argument \"-cycle=\" should be an integer, read: " + sTime); }
391        }
392        else if(arg.startsWith("-targetbyIndex")) 
393        { cargs.bUseGetValueByIndex = true;   //an example for default output
394        }
395        else if(arg.startsWith("-ownIpc=")) 
396        { cargs.sOwnIpcAddr = getArgument(8);   //an example for default output
397        }
398        else if(arg.startsWith("-dirCurves=")) 
399        { cargs.sDefaultDirCfgForCurves = getArgument(11);   //an example for default output
400        }
401        else if(arg.startsWith("-dirCurveCfg=")) 
402        { cargs.sDefaultDirCfgForCurves = getArgument(13);   //an example for default output
403        }
404        else if(arg.startsWith("-dirCurveSave=")) 
405        { cargs.sDefaultDirSaveForCurves = getArgument(14);   //an example for default output
406        }
407        else { bOk = super.testArgument(arg, nArg); }
408      } catch(Exception exc){ bOk = false; }
409      return bOk;
410    }
411
412  
413  } //class CmdLineAndGui 
414  
415
416/**Overrides the GuiCfg with special initialization and methods.
417 * @author Hartmut Schorrig
418 *
419 */
420private class InspcGuiCfg extends GuiCfg
421{
422  
423  InspcGuiCfg(CallingArguments cargs, GralArea9MainCmd cmdgui, GralPlugUser2Gral_ifc plugUser2Gui)
424  { super(cargs, cmdgui, null, plugUser2Gui, null); 
425  }
426  
427  
428  /**Initializes the areas for the panels and configure the panels.
429   * This routine overrides {@link GuiCfg#initGuiAreas()} and calls its super.
430   * Additional some user initialization is done.
431   */
432  @Override protected void initGuiAreas(String sAreaMainPanel)
433  {
434    super.initGuiAreas("A1C2");
435    super._gralMng.selectPanel("test");
436    super._gralMng.setPosition(5, GralPos.size -3, 0, GralPos.size +18 , 0, 'd',1);
437    //btnSwitchOnLog = super._gralMng.addSwitchButton("log", "log telg ?", "log telg", GralColor.getColor("wh"), GralColor.getColor("am") );
438    //btnSwitchOnLog.setActionChange(actionEnableLog);
439    colorSelector = new GralColorSelector("colorSelector", super._gralMng);
440    curveA.buildGraphic(gui.mainWindow(), colorSelector, null);
441    curveB.buildGraphic(gui.mainWindow(), colorSelector, curveA.widgCurve.getCommonData());
442    curveC.buildGraphic(gui.mainWindow(), colorSelector, curveA.widgCurve.getCommonData());
443    //
444    _gralMng.selectPanel("primaryWindow");
445    _gralMng.setPosition(14, 84, 4, 64, 0, '.');
446    fieldsA.setToPanel(_gralMng);
447    _gralMng.selectPanel("primaryWindow");
448    _gralMng.setPosition(24, 94, 14, 74, 0, '.');
449    fieldsB.setToPanel(_gralMng);
450    _gralMng.selectPanel("primaryWindow");
451    _gralMng.setPosition(10, 30, 50, 74, 0, '.');
452    viewTargetComm.setToPanel();
453    GralMenu menu = super.guiW.getMenuBar();
454    menu.addMenuItem("menuBarFieldsA", "&Window/open Fields &A", fieldsA.actionOpenWindow);
455    menu.addMenuItem("menuBarFieldsB", "&Window/open Fields &B", fieldsB.actionOpenWindow);
456    menu.addMenuItem("menuBarViewTargetComm", "&Window/view &TargetComm", viewTargetComm.setVisible);
457    //
458    if(user !=null){
459      user.initGui(_gralMng);
460      user.addGuiMenu(gui.mainWindow());
461    }
462    menu.addMenuItem("menuHelp", "&Help/&Help", gui.getActionHelp());
463    menu.addMenuItem("menuAbout", "&Help/&About", gui.getActionAbout());
464    gui.addMenuBarArea9ItemGThread("menuAbout", "&Help/e&Xit", gui.getActionAbout());
465
466  }
467
468  
469  
470  @Override protected void initMain()
471  {
472    //inspcComm.openComm(cargs.sOwnIpcAddr);
473    //msgReceiver.start();
474    //oamRcvUdpValue.start();
475    super.initMain();  //starts initializing of graphic. Do it after reading some configurations.
476
477  }
478  
479  @Override protected void stepMain()
480  {
481    try{
482      synchronized(this){ wait(100); }
483      curveA.stepSaveCurve();
484      curveB.stepSaveCurve();
485      curveC.stepSaveCurve();
486      //inspcComm.procComm();  
487      //oamRcvUdpValue.sendRequest();
488    } catch(Exception exc){
489      System.out.println(Assert.exceptionInfo("InspcGui - unexpected Exception; ", exc, 0, 7));
490      exc.printStackTrace();
491    }
492
493  }
494  
495  @Override protected void finishMain()
496  {
497    super.finishMain();
498    try{ inspcMng.close(); } catch(IOException exc){}
499  }
500  
501} //class InspcGuiCfg
502  
503
504  private final UserInspcPlug userInspcPlug = new UserInspcPlug();
505  
506  
507  
508  /**The command-line-invocation (primary command-line-call. 
509   * @param args Some calling arguments are taken. This is the GUI-configuration especially.   
510   */
511  public static void main(String[] args)
512  { boolean bOk = true;
513    //
514    //String ipcFactory = "org.vishia.communication.InterProcessComm_Socket";
515    //try{ ClassLoader.getSystemClassLoader().loadClass(ipcFactory, true);
516    //}catch(ClassNotFoundException exc){
517    //  System.out.println("class not found: " + "org.vishia.communication.InterProcessComm_Socket");
518    //}
519    //Loads the named class, and its base class InterProcessCommFactory. 
520    //In that kind the calling of factory methods are regarded to socket.
521    new InterProcessCommFactorySocket();
522    //
523    CallingArguments cargs = new CallingArguments();
524    //Initializes the GUI till a output window to show informations:
525    CmdLineAndGui cmdgui = new CmdLineAndGui(cargs, args);  //implements MainCmd, parses calling arguments
526    bOk = cmdgui.parseArgumentsAndInitGraphic(null, "3A3C");
527    System.err.println("InspcGui - Test; test");
528    LogMessage log = cmdgui.getLogMessageOutputConsole();
529    
530    
531    InspcGui main = new InspcGui(cargs, cmdgui);
532    
533    main.completeConstruction();
534    main.startupThreads();
535
536    main.guiCfg.execute();
537    
538    cmdgui.exit();
539  }
540
541
542  
543
544  private class UserInspcPlug implements UserInspcPlug_ifc, GralPlugUser2Gral_ifc 
545  {
546    
547    UserInspcPlug(){}
548    
549    
550    @Override public InspcTargetAccessData getTargetFromPath(String sDataPath){
551      return InspcGui.this.inspcMng.getTargetAccessFromPath(sDataPath, true);
552    }
553
554    
555    
556  } //class UserInspcPlug
557
558
559  
560  
561  private class InspcPlugUser implements InspcPlugUser_ifc
562  {
563
564    /**Cascaded user. */
565    final InspcPlugUser_ifc user1;
566    
567    InspcPlugUser(InspcPlugUser_ifc user){
568      user1 = user;
569    }
570    
571    @Override public void showStateInfo(String key, TargetState state, int count, int accLevels, float[] cycle_timeout){
572      InspcGui.this.viewTargetComm.setStateInfo(key,state, count, accLevels, cycle_timeout);
573    }  
574
575    
576    @Override public void setInspcComm(InspcAccess_ifc inspcMng)
577    { if(user1 !=null) { user1.setInspcComm(inspcMng); }
578    }
579
580    @Override public void requData(int ident)
581    { if(user1 !=null) { user1.requData(ident); }
582    }
583
584    @Override public void isSent(int seqnr)
585    { if(user1 !=null) { user1.isSent(seqnr); }
586    }
587
588    @Override
589    public void registerTarget(String name, String sAddr, InspcTargetAccessor targetAcc)
590    {
591      viewTargetComm.registerTarget(name, sAddr, targetAcc);
592      
593    }
594    
595  }
596  
597  
598  
599  GralUserAction actionGetValueByHandleIntern = new GralUserAction("getValueByHandleIntern"){
600    int handle = 0;
601    public boolean exec(int actionCode, GralWidget_ifc widgd, Object... params){
602      System.out.println("hello");
603      Inspector inspector = Inspector.get();
604      if(handle == 0){
605        handle = inspector.classContent.registerHandle("this$0.inspcMng.threadEvent.timeSleep", null);
606      }
607      if(handle !=-1){
608        int value = inspector.classContent.getIntValueByHandle(handle);
609        System.out.println("value =" + value);
610      }
611      return true;
612    }
613  };
614  
615  
616}