X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.spreadsheet.ui%2Fsrc%2Forg%2Fsimantics%2Fspreadsheet%2Fui%2FSpreadsheet.java;h=88fed2c6a991bfcd2dbbd6e3b8963870e74de0ad;hp=9b87ac0a47079b1d013b918874cebe0714bc1fa2;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.spreadsheet.ui/src/org/simantics/spreadsheet/ui/Spreadsheet.java b/bundles/org.simantics.spreadsheet.ui/src/org/simantics/spreadsheet/ui/Spreadsheet.java index 9b87ac0a4..88fed2c6a 100644 --- a/bundles/org.simantics.spreadsheet.ui/src/org/simantics/spreadsheet/ui/Spreadsheet.java +++ b/bundles/org.simantics.spreadsheet.ui/src/org/simantics/spreadsheet/ui/Spreadsheet.java @@ -1,110 +1,110 @@ -/******************************************************************************* - * 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.spreadsheet.ui; - -import javax.swing.JComponent; -import javax.swing.JTable; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.simantics.g2d.chassis.SWTChassis; -import org.simantics.spreadsheet.Adaptable; -import org.simantics.spreadsheet.ClientModel; -import org.simantics.utils.ui.jface.ActiveSelectionProvider; - -public class Spreadsheet extends Composite { - - public static boolean DEBUG = false; - - final private SpreadsheetModel sm; - - public SpreadsheetModel getModel() { - return sm; - } - - public Spreadsheet(Composite parent, int style, Adaptable serverInterface, ActiveSelectionProvider selectionProvider) { - - super(parent, style); - - sm = new SpreadsheetModel(serverInterface, selectionProvider); - - addDisposeListener(new DisposeListener() { - @Override - public void widgetDisposed(DisposeEvent e) { - } - }); - - } - - public ClientModel getClientModel() { - - return sm.getClientModel(); - - } - - public ClientModel getClientInterface() { - - return sm.getClientInterface(); - - } - - public void defaultInitializeUI() { - - try { - // Set System L&F - UIManager.setLookAndFeel( - UIManager.getSystemLookAndFeelClassName()); - } - catch (UnsupportedLookAndFeelException e) { - // handle exception - } - catch (ClassNotFoundException e) { - // handle exception - } - catch (InstantiationException e) { - // handle exception - } - catch (IllegalAccessException e) { - // handle exception - } - - setLayout(new FillLayout(SWT.NONE)); - - createTable(this); - - // Makes sure that the UI is up-to-date now that - // ClientTableModel is in play. - sm.getClientInterface().flush(); - - } - - public JTable createTable(Composite parent) { - - SWTChassis c = new SWTChassis(parent, 0){ - - @Override - protected JComponent createSwingComponent() { - return sm.createComponent(null); - } - }; - c.syncPopulate(); - - return null; - - } - -} +/******************************************************************************* + * 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.spreadsheet.ui; + +import javax.swing.JComponent; +import javax.swing.JTable; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.widgets.Composite; +import org.simantics.g2d.chassis.SWTChassis; +import org.simantics.spreadsheet.Adaptable; +import org.simantics.spreadsheet.ClientModel; +import org.simantics.utils.ui.jface.ActiveSelectionProvider; + +public class Spreadsheet extends Composite { + + public static boolean DEBUG = false; + + final private SpreadsheetModel sm; + + public SpreadsheetModel getModel() { + return sm; + } + + public Spreadsheet(Composite parent, int style, Adaptable serverInterface, ActiveSelectionProvider selectionProvider) { + + super(parent, style); + + sm = new SpreadsheetModel(serverInterface, selectionProvider); + + addDisposeListener(new DisposeListener() { + @Override + public void widgetDisposed(DisposeEvent e) { + } + }); + + } + + public ClientModel getClientModel() { + + return sm.getClientModel(); + + } + + public ClientModel getClientInterface() { + + return sm.getClientInterface(); + + } + + public void defaultInitializeUI() { + + try { + // Set System L&F + UIManager.setLookAndFeel( + UIManager.getSystemLookAndFeelClassName()); + } + catch (UnsupportedLookAndFeelException e) { + // handle exception + } + catch (ClassNotFoundException e) { + // handle exception + } + catch (InstantiationException e) { + // handle exception + } + catch (IllegalAccessException e) { + // handle exception + } + + setLayout(new FillLayout(SWT.NONE)); + + createTable(this); + + // Makes sure that the UI is up-to-date now that + // ClientTableModel is in play. + sm.getClientInterface().flush(); + + } + + public JTable createTable(Composite parent) { + + SWTChassis c = new SWTChassis(parent, 0){ + + @Override + protected JComponent createSwingComponent() { + return sm.createComponent(null); + } + }; + c.syncPopulate(); + + return null; + + } + +}