Thursday, September 23, 2010

OMB*Plus extensibility - Tk GUI in OMB*Plus

One of the important feature of OWB10g R2 is integration into design client Tcl-based scripting language (OMB*Plus) enhaced with GUI componets - OWB Expert. OWB Expert allow execution of OMB script dirrectly from design client (it is possible to add new command to context menu called from project tree). GUI components play secondary role - the main purpose of these components is setting of paramters passed to OMB script, for example there is component for choosing table from specified module (so usually GUI component perform single task). In most cases for execution of simple task we needed to compose a sequence of sevaral components (choosing module -> choosing table, etc.) - it was quite inconvenient.Maybe the most interesting component is Custom Dialog (allow create dialog windows with several items like text field, label, radio button, etc.), but it has one drawback - this window is non-interactive (there is no way to specify reply for user action, like choosing new value in list, enabling/disabling check box, etc.).

Tcl interpreter allows to write GUI application with Tk extension. And as I explored there is GUI extension for Jacl Tcl-interpreter (OMB*Plus is based on Jacl/tcljava). Name of this extension is SWANK.
Link to swank

Last jar-file of swank compiled with lates Java compiler, so the best way to experiment - use last OWB release (OWB11g R2 which use Java 6 for execution).
Configuration steps:
  • copy swank.jar file to OWB_HOME\owb\lib\ext directory;
  • add to ombinit.tcl file (OWB_HOME\owb\bin/admin directory) at the end line
    source -url resource:/com/onemoonscientific/swank/library/init.tcl.
OMB*Plus example with Tk widgets:

namespace eval ::owbland {}


OMBCC '/'
set projList [OMBLIST PROJECTS]
set ::owbland::res "a"
jcombobox .combproj -variable ::owbland::res -command "procCSEL"
foreach proj $projList {
.combproj item append $proj
}
pack .combproj -side top


listbox .projlist -height 5
pack .projlist -side bottom


wm title . "Super;) Module Viewer"
wm geometry . 400x250


proc procCSEL {} {
  #puts "selected"
  OMBCC '/$::owbland::res'
  if {[catch {set modList [OMBLIST ORACLE_MODULES]} err]} {
    puts $err
  } else {
    #puts $modList
    set lstSz [.projlist size]
    .projlist delete 0 [expr {$lstSz-1}]
    foreach mod $modList {.projlist insert end $mod}
  }
}
















No comments:

Post a Comment