Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Scout/Tutorial/3.8/SVG Field

< Scout‎ | Tutorial‎ | 3.8
Revision as of 17:41, 5 March 2012 by Matthias.zimmermann.bsiag.com (Talk | contribs) (Create a form containing a SVG field)

The Scout documentation has been moved to https://eclipsescout.github.io/.

Introduction

With the upcoming Scout Release 3.8 a SVG field will be introduced as an additional UI component. The new SVG field enhances Eclipse Scout with the ability to display interactive diagrams and graphics that work on desktop as well as on web environment.

This tutorial demonstrate the use of the SVG field for a view only field as well as an interactive field.

Getting started

The AbstractSvgField comes as part of Scout Runtime Release 3.8 that will be integrated into Eclipse Juno builds. The latest nightly build of Scout Runtime 3.8 can be downloaded from http://download.eclipse.org/scout/nightly/update/.

Installation of Scout Runtime 3.8 via Update Site


Create a Scout Application with SVG Fields

Create a new Application

As a first step create a new Scout application called "svgfieldtutorial" in the Scout perspective. More details can be found The Scout documentation has been moved to https://eclipsescout.github.io/..

[picture1]

Add SVG support to the application


Add SVG client plugin

To be able to use the SVG field the plugin "org.eclipse.scout.svg.client" has to be added as a required plugin to the client part of our sample application. Open the Java perspective and open the plugin.xml file in svgfieldtutorial.client.

[picture3]

Create a scalable vector graphics file

We create a graphic file that will be loaded into the SVG field later. The graphic file is named "SampleGraphic.svg". First we create a folder "svg" under svgfieldtutorial.client/resources, where the graphic file will be stored. The SVG graphic file contains a dark grey circle and a light grey polygon.

 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <svg width="400" height="400" viewBox="0 0 400 400" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="text/ecmascript" zoomAndPan="magnify" 
  contentStyleType="text/css" version="1.1" xml:space="preserve" preserveAspectRatio="xMidYMid meet">
  <a xlink:href="http://local/info-prev">
   <polygon id="poly" points="220,100 300,210 170,250 123,234" style="fill:#cccccc;stroke:#000000;stroke-width:1"/>
  </a>
  <circle id="circle" cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="grey" />
 </svg>

Create SampleSVGFieldNodePage

In the svgfieldltutorial sample application we will add a SampleSVGNodePage to the StandardOutline. This node page is able to hold a SampleSVGFieldForm that will be created next step.

Create SampleSVGFieldForm

We create a SampleSVGFieldForm and add a SVG field called "GraphicField" to the MainBox which subclasses AbstractSvgField. A close button that subclasses AbstractCloseButton is also added to the MainBox.

Back to the top