! Tests the PANEL /JSETUP switch to use a Swing Panel, e.g.
! one that is created by a GUI builder.
!
! @bug      2652 - PANEL: /JSETUP= should support JPanel-based GUI
! @author:  Linnet Nguyen
!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE

  call setDatDir

  ! Start Interactive test section
  if interAct then
    pipe on
      panel/id=panel/msgid=MAIN/controls=gc/jsetup=nxm.sys.test.test_panel_jsetup_jpanel

      gcontrol label macro "MACRO"
      gcontrol button "PASS"   "" "Pass"
      gcontrol button "FAIL"   "" "Fail"

      plot/id=plot1 ^{datDir}.apenny.prm

    pipe off
  endif

endmacro

!******************************************************************************!
! process messages for interactive tests
!******************************************************************************!
procedure processMessage m:msg
  if msg.name eqs "FAIL" or msg.name eqs "PASS" then
    assert/text="^reg.main.name: User Indicated Tests" msg.name eqss "PASS"
    pipe stop
  else
    say "^reg.main.name: Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
  endif
return

!******************************************************************************!
! Set the dat directory
!******************************************************************************!
procedure setDatDir
  invoke nxmMajor env.nmversion.subString(0,1)
  invoke major java.lang.Integer.valueOf(nxmMajor)
  if major GE 4 then
    invoke s:datDir           nxm.sys.test.DatLocator.getDatDirLocation()
    invoke s:datDirSlash      nxm.sys.test.DatLocator.getDatDirSlashLocation()
    invoke z:sysDatFull       nxm.sys.test.DatLocator.sysDatFull()
    invoke z:sysTestDatExists nxm.sys.test.DatLocator.sysTestDatExists()
  else
    set s:datDir           "nxm.sys.dat"
    set s:datDirSlash      "nxm/sys/dat"
    set z:sysDatFull       true
    set z:sysTestDatExists false
  endif
return
