Modifying the User Interface

Here are a set of step-by-step instructions (All file paths relative to projects/xnat/src):

  1. Copy initial edit and report templates, XDATScreen_*<schema><datatype>.vm, from base-templates/screens to templates/screens
  2. Optional: Add/modify *.js file(s) in directory: scripts
  3. Optional: Add/modify *.css files in directory: style
  4. Optional: To add to or modify the Context, copy XDATScreen_*<schema><datatype>.java from java/org/nrg/xdat/turbine/modules/screens to java/org/apache/turbine/app/xnat/modules/screens
  5. Optional: To add custom actions, create Java file in java/org/apache/turbine/app/xnat/modules/actions
    • No mandatory name pattern
    • Must explicitly set action in .vm file
  6. Run update process
    • If no Java updates, then run: bin/quick-deploy-templates.sh
    • If Java updates and compiling code with (IDE Eclipse or other), then run: bin/quick-deploy.sh -Dclass.dir=<compile path>
    • If Java updates and no IDE, then run (after Tomcat shutdown): bin/update.sh –Ddeploy=true

XNAT and Velocity Concepts

  • XNAT uses Velocity 1.3.1
  • XNAT uses Velocity to generate HTML from Velocity templates language (VTL) in .vm files
  • The context: container used by Velocity to pass data objects back and forth between Java and .vm files
  • #macro elements, Velocimacros, allow template designers to define a repeated segment of VTL

XNAT Context Objects

  • $om – object containing getters and setters for all named fields in datatype and parent datatypes
    • A corresponding Java class (automatically generated) - java/org/nrg/xdat/om/base/auto/Auto<schema><datatype>.java - can be customized to provide custom methods
  • $turbineUtils – object containing set of utilities for general use.
    • The most commonly used method - getTemplateName(String module, String dataType, String project) - allows project-specific templates

XNAT Velocimacros

  • XNAT includes many data input HTML/Velocity code fragments in TurbineMacros.vm
  • Simplify common HTML tasks in XNAT-Velocity environment

Learn more about predefined Velocity Macros in XNAT Reports documentation.

$label.name