/******************************************************************************* * 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.browsing.ui.graph.impl; import java.util.ArrayList; import java.util.Collection; import org.simantics.browsing.ui.NodeContext; import org.simantics.browsing.ui.PrimitiveQueryUpdater; import org.simantics.browsing.ui.BuiltinKeys.ViewpointKey; import org.simantics.browsing.ui.common.NodeContextBuilder; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; import org.simantics.layer0.Layer0; /** * A very simple viewpoint that by default browses Consists Of relations and * accepts as objects any children that are of any of the specified accepted * types. * *
* The accepted types must be returned through {@link #getAcceptedTypes()} *
* ** The children production can be customized by overriding * {@link #getPotentialChildren(ReadGraph, Resource)}. Whatever is produced by this * method will be filtered through the list of accepted resource types. *
* ** IMPORTANT: it is vital to actually implement this class and override the * {@link #getAcceptedTypes(ReadGraph)} method in the process. Otherwise the * equality comparisons of the resource queries used within LazyViewpoint will * not work properly! *
* * @author Tuukka Lehtonen */ public abstract class LazyTypeAcceptViewpoint extends LazyViewpoint { public LazyTypeAcceptViewpoint(PrimitiveQueryUpdater updater, NodeContext context, ViewpointKey key) { super(updater, context, key); } protected abstract Resource[] getAcceptedTypes(ReadGraph g); protected Collection