All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.vectorpublish.desktop.vp.api.layer.Layer Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2016, Peter Rader. All rights reserved.
 *  ___ ___               __                 ______         __     __  __         __
 * |   |   |.-----..----.|  |_ .-----..----.|   __ \.--.--.|  |--.|  ||__|.-----.|  |--.
 * |   |   ||  -__||  __||   _||  _  ||   _||    __/|  |  ||  _  ||  ||  ||__ --||     |
 *  \_____/ |_____||____||____||_____||__|  |___|   |_____||_____||__||__||_____||__|__|
 *
 * http://www.gnu.org/licenses/gpl-3.0.html
 */
package net.vectorpublish.desktop.vp.api.layer;

import java.util.Set;

import javax.swing.JTree;
import javax.swing.tree.TreePath;

import net.vectorpublish.desktop.vp.api.InheritanceExclusion.CDIBean;
import net.vectorpublish.desktop.vp.api.vpd.DocumentNode;
import net.vectorpublish.desktop.vp.api.vpd.VectorPublishNode;

/**
 * The layers of a {@link DocumentNode}.
 * 

* This {@link CDIBean} is a tree having the elements in the back as roots. You can see * elements the best if they are leaves. */ @SuppressWarnings("serial") public abstract class Layer extends JTree { /** * Default Constructor without any nodes. */ public Layer() { super(new Object[0]); } /** * Returns the {@link DocumentNode} the layers works for. * * @return The DocumentNode or null if there is no Document * open. */ public abstract DocumentNode getDocument(); /** * The current selection of the Tree. * * @return The current Selection, immutable, eager and never * null. */ public abstract Set getSelection(); /** * Reloads the tree, select what before was selected and expand the * selection. */ public abstract void reload(); /** * Set the root to the tree. This also reloads the tree. * * @param doc * The {@link DocumentNode} */ public abstract void setRoot(DocumentNode doc); /** * @return The array of paths, never null. */ @Override public TreePath[] getSelectionPaths() { TreePath[] selectionPaths = super.getSelectionPaths(); if (selectionPaths == null) { return new TreePath[] {}; } return selectionPaths; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy