1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.scenegraph.example;
\r
14 import javax.swing.RepaintManager;
\r
15 import javax.swing.UIManager;
\r
16 import javax.swing.UnsupportedLookAndFeelException;
\r
17 import javax.swing.UIManager.LookAndFeelInfo;
\r
19 import org.eclipse.swt.events.DisposeEvent;
\r
20 import org.eclipse.swt.events.DisposeListener;
\r
21 import org.eclipse.swt.widgets.Composite;
\r
22 import org.eclipse.ui.part.ViewPart;
\r
24 import org.simantics.scenegraph.g2d.nodes.TransformNode;
\r
25 import org.simantics.scenegraph.swing.SliderNode;
\r
27 public class G2DLocalView extends ViewPart {
\r
30 protected boolean rotate = true;
\r
31 protected TransformNode transform = null;
\r
32 protected TransformNode transform2 = null;
\r
33 protected SliderNode sn1 = null;
\r
34 protected SliderNode sn2 = null;
\r
35 protected SampleThread t = new SampleThread() {
\r
36 public void repaint() {
\r
38 RepaintManager rm = RepaintManager.currentManager(c.getCanvas());
\r
39 rm.markCompletelyDirty(c.getCanvas());
\r
45 public void createPartControl(Composite parent) {
\r
47 for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
\r
48 if ("Nimbus".equals(info.getName())) {
\r
49 UIManager.setLookAndFeel(info.getClassName());
\r
53 } catch (UnsupportedLookAndFeelException e) {
\r
55 } catch (ClassNotFoundException e) {
\r
57 } catch (InstantiationException e) {
\r
59 } catch (IllegalAccessException e) {
\r
63 c = new SGComponent(parent, 0);
\r
66 c.addDisposeListener(new DisposeListener(){
\r
68 public void widgetDisposed(DisposeEvent e) {
\r
72 c.getCanvas().setSceneGraph(t.sg);
\r
80 public void setFocus() {
\r