| /* |
| * |
| * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * |
| * 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: |
| * Florian Pirchner - Initial implementation |
| * Loetz GmbH&Co.KG |
| * |
| */ |
| package org.eclipse.osbp.vaadin.emf.views; |
| |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.osbp.runtime.web.vaadin.common.resource.IResourceProvider; |
| import org.eclipse.osbp.vaadin.emf.api.IModelingContext; |
| import org.eclipse.osbp.vaadin.emf.data.EmfModelTreeContainer; |
| |
| import com.vaadin.ui.CustomComponent; |
| import com.vaadin.ui.Panel; |
| import com.vaadin.ui.Tree; |
| import com.vaadin.ui.VerticalLayout; |
| |
| // TODO: Auto-generated Javadoc |
| /** |
| * Shows any emfmodel in a tree viewer style. |
| */ |
| @SuppressWarnings("serial") |
| public class PaletteViewer extends CustomComponent { |
| |
| /** The tree. */ |
| private Tree tree; |
| |
| /** The container. */ |
| private EmfModelTreeContainer container; |
| |
| /** |
| * Instantiates a new palette viewer. |
| * |
| * @param modelingContext |
| * the modeling context |
| * @param resourceProvider |
| * the resource provider |
| */ |
| public PaletteViewer(IModelingContext modelingContext, |
| IResourceProvider resourceProvider) { |
| Panel mainLayout = new Panel(); |
| mainLayout.setSizeFull(); |
| setCompositionRoot(mainLayout); |
| |
| VerticalLayout scrollArea = new VerticalLayout(); |
| mainLayout.setContent(scrollArea); |
| |
| } |
| |
| /** |
| * Sets the selected element. |
| * |
| * @param rootElement |
| * the new selected element |
| */ |
| public void setSelectedElement(EObject rootElement) { |
| container.setRootElement(rootElement); |
| } |
| |
| } |