X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scenegraph.swing%2Fsrc%2Forg%2Fsimantics%2Fscenegraph%2Fexample%2FG2DLocalView.java;h=143bd8fdd28b817867fdcd6853f0553c1f448d0c;hb=4881fb88d55e80473a6f3117b0d0b8265a3b66b2;hp=6be31d1950f7eb72f4a9d46878745cfa72e85b25;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scenegraph.swing/src/org/simantics/scenegraph/example/G2DLocalView.java b/bundles/org.simantics.scenegraph.swing/src/org/simantics/scenegraph/example/G2DLocalView.java index 6be31d195..143bd8fdd 100644 --- a/bundles/org.simantics.scenegraph.swing/src/org/simantics/scenegraph/example/G2DLocalView.java +++ b/bundles/org.simantics.scenegraph.swing/src/org/simantics/scenegraph/example/G2DLocalView.java @@ -1,84 +1,84 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.scenegraph.example; - -import javax.swing.RepaintManager; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.UIManager.LookAndFeelInfo; - -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.part.ViewPart; - -import org.simantics.scenegraph.g2d.nodes.TransformNode; -import org.simantics.scenegraph.swing.SliderNode; - -public class G2DLocalView extends ViewPart { - SGComponent c; - - protected boolean rotate = true; - protected TransformNode transform = null; - protected TransformNode transform2 = null; - protected SliderNode sn1 = null; - protected SliderNode sn2 = null; - protected SampleThread t = new SampleThread() { - public void repaint() { - if(c != null) { - RepaintManager rm = RepaintManager.currentManager(c.getCanvas()); - rm.markCompletelyDirty(c.getCanvas()); - } - } - }; - - @Override - public void createPartControl(Composite parent) { - try { - for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { - if ("Nimbus".equals(info.getName())) { - UIManager.setLookAndFeel(info.getClassName()); - break; - } - } - } catch (UnsupportedLookAndFeelException e) { - // handle exception - } catch (ClassNotFoundException e) { - // handle exception - } catch (InstantiationException e) { - // handle exception - } catch (IllegalAccessException e) { - // handle exception - } - - c = new SGComponent(parent, 0); - c.syncPopulate(); - - c.addDisposeListener(new DisposeListener(){ - @Override - public void widgetDisposed(DisposeEvent e) { - t.stop(); - }}); - - c.getCanvas().setSceneGraph(t.sg); - - c.initListeners(); - - t.start(); - } - - @Override - public void setFocus() { - c.setFocus(); - } - -} +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.scenegraph.example; + +import javax.swing.RepaintManager; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.UIManager.LookAndFeelInfo; + +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.part.ViewPart; + +import org.simantics.scenegraph.g2d.nodes.TransformNode; +import org.simantics.scenegraph.swing.SliderNode; + +public class G2DLocalView extends ViewPart { + SGComponent c; + + protected boolean rotate = true; + protected TransformNode transform = null; + protected TransformNode transform2 = null; + protected SliderNode sn1 = null; + protected SliderNode sn2 = null; + protected SampleThread t = new SampleThread() { + public void repaint() { + if(c != null) { + RepaintManager rm = RepaintManager.currentManager(c.getCanvas()); + rm.markCompletelyDirty(c.getCanvas()); + } + } + }; + + @Override + public void createPartControl(Composite parent) { + try { + for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (UnsupportedLookAndFeelException e) { + // handle exception + } catch (ClassNotFoundException e) { + // handle exception + } catch (InstantiationException e) { + // handle exception + } catch (IllegalAccessException e) { + // handle exception + } + + c = new SGComponent(parent, 0); + c.syncPopulate(); + + c.addDisposeListener(new DisposeListener(){ + @Override + public void widgetDisposed(DisposeEvent e) { + t.stop(); + }}); + + c.getCanvas().setSceneGraph(t.sg); + + c.initListeners(); + + t.start(); + } + + @Override + public void setFocus() { + c.setFocus(); + } + +}