Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores
* CA 94065 USA or visit www.oracle.com if you need additional information or
* have any questions.
*/
package com.codename1.ui.tree;
import com.codename1.components.SpanButton;
import com.codename1.ui.Button;
import com.codename1.ui.Component;
import com.codename1.ui.ComponentSelector;
import com.codename1.ui.Container;
import com.codename1.ui.Display;
import com.codename1.ui.FontImage;
import com.codename1.ui.Image;
import com.codename1.ui.animations.CommonTransitions;
import com.codename1.ui.animations.Transition;
import com.codename1.ui.events.ActionEvent;
import com.codename1.ui.events.ActionListener;
import com.codename1.ui.geom.Dimension;
import com.codename1.ui.layouts.BorderLayout;
import com.codename1.ui.layouts.BoxLayout;
import com.codename1.ui.plaf.Style;
import com.codename1.ui.plaf.UIManager;
import com.codename1.ui.util.EventDispatcher;
import java.util.HashSet;
import java.util.Set;
import java.util.Vector;
/**
*
The {@code Tree} component allows constructing simple tree component hierarchies that can be expanded
* seamlessly with no limit. The tree is bound to a model that can provide data with free form depth such as file system
* or similarly structured data.
* To customize the look of the tree the component can be derived and component creation can be replaced.
*
*
*
*
*
* And heres a more "real world" example showing an XML hierarchy in a {@code Tree}:
*
*
*
*
*
* Another real world example showing the {@link com.codename1.io.FileSystemStorage} as a tree:
*
*
*
*
* @author Shai Almog
*/
public class Tree extends Container {
private static final String KEY_OBJECT = "TREE_OBJECT";
private static final String KEY_PARENT = "TREE_PARENT";
private static final String KEY_EXPANDED = "TREE_NODE_EXPANDED";
private static final String KEY_DEPTH = "TREE_DEPTH";
private EventDispatcher leafListener = new EventDispatcher();
private ActionListener expansionListener = new Handler();
private TreeModel model;
private static Image folder;
private static Image openFolder;
private static Image nodeImage;
private int depthIndent = 2;
private boolean multilineMode;
/**
* A marker interface used for Tree state returned from {@link #getTreeState() } and
* passed to {@link #setTreeState(com.codename1.ui.tree.Tree.TreeState) } for retaining
* state in a Tree when the model is changed.
*/
public static interface TreeState {
}
private static class State implements TreeState {
Set