Repository: zest-qi4j
Updated Branches:
  refs/heads/develop fe619882c -> cf53af164


Removing Entity Viewer. Old and dated.


Project: http://git-wip-us.apache.org/repos/asf/zest-qi4j/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-qi4j/commit/cf53af16
Tree: http://git-wip-us.apache.org/repos/asf/zest-qi4j/tree/cf53af16
Diff: http://git-wip-us.apache.org/repos/asf/zest-qi4j/diff/cf53af16

Branch: refs/heads/develop
Commit: cf53af164830739a27d6b9738f0ab4b2b0186f20
Parents: fe61988
Author: Niclas Hedhman <[email protected]>
Authored: Wed Jun 10 15:39:06 2015 +0800
Committer: Niclas Hedhman <[email protected]>
Committed: Wed Jun 10 15:39:06 2015 +0800

----------------------------------------------------------------------
 settings.gradle                                 |   1 -
 tools/entity-viewer/build.gradle                |  19 --
 tools/entity-viewer/dev-status.xml              |  20 --
 tools/entity-viewer/src/docs/entity-viewer.txt  |  27 --
 .../swing/entityviewer/EntityViewer.form        |  60 ----
 .../swing/entityviewer/EntityViewer.java        | 301 -------------------
 .../swing/entityviewer/PropertiesPanel.java     | 104 -------
 .../library/swing/entityviewer/TreePanel.java   | 120 --------
 .../library/swing/entityviewer/package.html     |   5 -
 .../entityviewer/sample/ApplicationSample.java  | 158 ----------
 10 files changed, 815 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cf53af16/settings.gradle
----------------------------------------------------------------------
diff --git a/settings.gradle b/settings.gradle
index 184d157..f7a72ac 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -80,7 +80,6 @@ include "core:functional",
         'samples:sql-support',
         'samples:struts2Hello',
         'samples:swing',
-        'tools:entity-viewer',
         'tools:model-detail',
         'tools:envisage',
         'tools:shell',

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cf53af16/tools/entity-viewer/build.gradle
----------------------------------------------------------------------
diff --git a/tools/entity-viewer/build.gradle b/tools/entity-viewer/build.gradle
deleted file mode 100644
index d44b98f..0000000
--- a/tools/entity-viewer/build.gradle
+++ /dev/null
@@ -1,19 +0,0 @@
-description = "A viewer of entities in the Entity Stores."
-
-jar { manifest { name = "Qi4j Entity Viewer" }}
-
-dependencies {
-  compile(project(":org.qi4j.core:org.qi4j.core.bootstrap"))
-  compile(project(":org.qi4j.tools:org.qi4j.tool.model-detail"))
-
-  testCompile(project(":org.qi4j.core:org.qi4j.core.testsupport"))
-  testCompile(project(":org.qi4j.extensions:org.qi4j.extension.indexing-rdf"))
-
-  testRuntime(project(":org.qi4j.core:org.qi4j.core.runtime"))
-  testRuntime(libraries.logback)
-}
-
-task(runSample, dependsOn: 'testClasses', type: JavaExec) {
-    main = 'org.qi4j.swing.library.swing.entityviewer.sample.ApplicationSample'
-    classpath = sourceSets.test.runtimeClasspath
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cf53af16/tools/entity-viewer/dev-status.xml
----------------------------------------------------------------------
diff --git a/tools/entity-viewer/dev-status.xml 
b/tools/entity-viewer/dev-status.xml
deleted file mode 100644
index c847a9f..0000000
--- a/tools/entity-viewer/dev-status.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<module xmlns="http://www.qi4j.org/schemas/2008/dev-status/1";
-        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-        xsi:schemaLocation="http://www.qi4j.org/schemas/2008/dev-status/1
-        http://www.qi4j.org/schemas/2008/dev-status/1/dev-status.xsd";>
-  <status>
-    <!--none,early,beta,stable,mature-->
-    <codebase>stable</codebase>
-
-    <!-- none, brief, good, complete -->
-    <documentation>brief</documentation>
-
-    <!-- none, some, good, complete -->
-    <unittests>none</unittests>
-
-  </status>
-  <licenses>
-    <license>ALv2</license>
-  </licenses>
-</module>

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cf53af16/tools/entity-viewer/src/docs/entity-viewer.txt
----------------------------------------------------------------------
diff --git a/tools/entity-viewer/src/docs/entity-viewer.txt 
b/tools/entity-viewer/src/docs/entity-viewer.txt
deleted file mode 100644
index f809d65..0000000
--- a/tools/entity-viewer/src/docs/entity-viewer.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-[[tools-entity-viewer,EntityViewer Tool]]
-= Entity Viewer =
-
-EntityViewer is a Swing based Entities browser. It allows you to browse
-Entities persisted in EntityStores.
-
-== Usage ==
-
-EntityViewer can easily be used as follows:
-
-[snippet,java]
-----
-source=tools/entity-viewer/src/test/java/org/qi4j/swing/library/swing/entityviewer/sample/ApplicationSample.java
-tag=entity-viewer
-----
-
-A gradle task runSample is defined in this module as a shortcut to run the
-example. See <<build-system>>.
-
-== Screenshot ==
-
-image:tools-entity-viewer.png[width="800px"]
-
-== Embedd in your Application ==
-
-include::../../build/docs/buildinfo/artifact.txt[]
-

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cf53af16/tools/entity-viewer/src/main/java/org/qi4j/library/swing/entityviewer/EntityViewer.form
----------------------------------------------------------------------
diff --git 
a/tools/entity-viewer/src/main/java/org/qi4j/library/swing/entityviewer/EntityViewer.form
 
b/tools/entity-viewer/src/main/java/org/qi4j/library/swing/entityviewer/EntityViewer.form
deleted file mode 100644
index a36b697..0000000
--- 
a/tools/entity-viewer/src/main/java/org/qi4j/library/swing/entityviewer/EntityViewer.form
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<form xmlns="http://www.intellij.com/uidesigner/form/"; version="1" 
bind-to-class="org.qi4j.library.swing.entityviewer.EntityViewer">
-  <grid id="27dc6" binding="mainPane" layout-manager="BorderLayout" hgap="0" 
vgap="0">
-    <constraints>
-      <xy x="20" y="20" width="500" height="400"/>
-    </constraints>
-    <properties/>
-    <border type="none"/>
-    <children>
-      <splitpane id="bf22c" binding="splitPane">
-        <constraints border-constraint="Center"/>
-        <properties/>
-        <border type="none"/>
-        <children>
-          <grid id="821ca" binding="propertiesAreaPane" 
layout-manager="BorderLayout" hgap="0" vgap="0">
-            <constraints>
-              <splitpane position="right"/>
-            </constraints>
-            <properties/>
-            <border type="none"/>
-            <children>
-              <grid id="551a3" layout-manager="GridBagLayout">
-                <constraints border-constraint="North"/>
-                <properties/>
-                <border type="none"/>
-                <children>
-                  <component id="f399c" class="javax.swing.JComboBox" 
binding="entitiesCombo">
-                    <constraints>
-                      <grid row="0" column="2" row-span="1" col-span="3" 
vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" 
use-parent-layout="false"/>
-                      <gridbag weightx="0.3" weighty="0.0"/>
-                    </constraints>
-                    <properties/>
-                  </component>
-                  <component id="2218b" class="javax.swing.JLabel">
-                    <constraints>
-                      <grid row="0" column="0" row-span="1" col-span="1" 
vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" 
use-parent-layout="false"/>
-                      <gridbag weightx="0.0" weighty="0.0"/>
-                    </constraints>
-                    <properties>
-                      <text value="Entity"/>
-                    </properties>
-                  </component>
-                  <hspacer id="69a0b">
-                    <constraints>
-                      <grid row="0" column="1" row-span="1" col-span="1" 
vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" 
use-parent-layout="false"/>
-                      <gridbag weightx="0.0" weighty="0.0"/>
-                    </constraints>
-                  </hspacer>
-                </children>
-              </grid>
-            </children>
-          </grid>
-        </children>
-      </splitpane>
-    </children>
-  </grid>
-  <inspectionSuppressions>
-    <suppress inspection="NoLabelFor" id="f399c"/>
-  </inspectionSuppressions>
-</form>

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cf53af16/tools/entity-viewer/src/main/java/org/qi4j/library/swing/entityviewer/EntityViewer.java
----------------------------------------------------------------------
diff --git 
a/tools/entity-viewer/src/main/java/org/qi4j/library/swing/entityviewer/EntityViewer.java
 
b/tools/entity-viewer/src/main/java/org/qi4j/library/swing/entityviewer/EntityViewer.java
deleted file mode 100644
index 829f94b..0000000
--- 
a/tools/entity-viewer/src/main/java/org/qi4j/library/swing/entityviewer/EntityViewer.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Copyright (c) 2009, Tony Kohar. All Rights Reserved.
- *
- * Licensed  under the  Apache License,  Version 2.0  (the "License");
- * you may not use  this file  except in  compliance with the License.
- * You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed  under the  License is distributed on an "AS IS" BASIS,
- * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
- * implied.
- *
- * See the License for the specific language governing permissions and
- * limitations under the License. 
- */
-package org.qi4j.library.swing.entityviewer;
-
-import java.awt.BorderLayout;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import javax.swing.ComboBoxModel;
-import javax.swing.DefaultComboBoxModel;
-import javax.swing.JComboBox;
-import javax.swing.JComponent;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JSplitPane;
-import javax.swing.event.TreeSelectionEvent;
-import javax.swing.event.TreeSelectionListener;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.TreePath;
-import org.qi4j.api.query.Query;
-import org.qi4j.api.query.QueryBuilder;
-import org.qi4j.api.structure.Application;
-import org.qi4j.api.structure.ApplicationDescriptor;
-import org.qi4j.api.structure.Module;
-import org.qi4j.api.unitofwork.UnitOfWork;
-import org.qi4j.spi.Qi4jSPI;
-import org.qi4j.tools.model.descriptor.ApplicationDetailDescriptor;
-import org.qi4j.tools.model.descriptor.ApplicationDetailDescriptorBuilder;
-import org.qi4j.tools.model.descriptor.EntityDetailDescriptor;
-import org.qi4j.tools.model.descriptor.LayerDetailDescriptor;
-import org.qi4j.tools.model.descriptor.ModuleDetailDescriptor;
-
-import static org.qi4j.functional.Iterables.first;
-
-/**
- * The Entity Viewer.
- */
-public class EntityViewer
-{
-    private JPanel mainPane;
-    private JComboBox entitiesCombo;
-    private JPanel propertiesAreaPane;
-    private JSplitPane splitPane;
-    private PropertiesPanel propertiesPanel;
-    private TreePanel treePanel;
-
-    private Qi4jSPI qi4jspi;
-    private ApplicationDescriptor model;
-    private Application application;
-
-    private JFrame frame;
-
-    public void show( Qi4jSPI qi4jspi, ApplicationDescriptor model, 
Application application )
-    {
-        this.qi4jspi = qi4jspi;
-        this.model = model;
-        this.application = application;
-
-        initUI();
-
-        frame = new JFrame();
-        frame.setContentPane( mainPane );
-        frame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
-        frame.setSize( 600, 600 );
-        //frame.pack();
-        frame.setVisible( true );
-    }
-
-    public void stop()
-    {
-        if( frame != null & frame.isDisplayable() )
-        {
-            frame.dispose();
-            frame = null;
-        }
-    }
-
-    private void initUI()
-    {
-        propertiesPanel = new PropertiesPanel();
-        propertiesPanel.initializeQi4J( qi4jspi );
-        propertiesAreaPane.add( propertiesPanel, BorderLayout.CENTER );
-
-        treePanel = new TreePanel();
-        treePanel.initializeQi4J( qi4jspi, model );
-        treePanel.reload();
-        splitPane.setLeftComponent( treePanel );
-
-        splitPane.setDividerLocation( 200 );
-
-        DefaultComboBoxModel entityComboModel = new DefaultComboBoxModel();
-        entitiesCombo.setModel( entityComboModel );
-
-        entitiesCombo.addItemListener( new ItemListener()
-        {
-            @Override
-            public void itemStateChanged( ItemEvent evt )
-            {
-                entitiesComboItemStateChanged( evt );
-            }
-        } );
-
-        treePanel.getTreeComponent().addTreeSelectionListener( new 
TreeSelectionListener()
-        {
-            @Override
-            public void valueChanged( TreeSelectionEvent evt )
-            {
-                treePanelValueChanged( evt );
-            }
-        } );
-
-        initEntityCombo( entityComboModel );
-    }
-
-    private void initEntityCombo( DefaultComboBoxModel entityComboModel )
-    {
-        // create the visitor to traverse the QI4J to find the module
-        ApplicationDetailDescriptor visitor = 
ApplicationDetailDescriptorBuilder.createApplicationDetailDescriptor( model );
-
-        // find all entities
-        Iterable<LayerDetailDescriptor> layerDescIter = visitor.layers();
-        for( LayerDetailDescriptor layerDesc : layerDescIter )
-        {
-            Iterable<ModuleDetailDescriptor> moduleDescIter = 
layerDesc.modules();
-            for( ModuleDetailDescriptor moduleDesc : moduleDescIter )
-            {
-                Iterable<EntityDetailDescriptor> entityDescIter = 
moduleDesc.entities();
-                for( EntityDetailDescriptor entity : entityDescIter )
-                {
-                    entityComboModel.addElement( entity );
-                }
-            }
-        }
-    }
-
-    /**
-     * Create simple query (display all properties) based on the supplied 
class.
-     *
-     * @param module the module to create the query
-     * @param clazz  the class to be queried
-     *
-     * @return query
-     */
-    protected Query createQuery( Module module, Class clazz )
-    {
-        UnitOfWork uow = module.newUnitOfWork();
-        QueryBuilder qb = module.newQueryBuilder( clazz );
-        return uow.newQuery( qb );
-    }
-
-    private Module findModule( EntityDetailDescriptor descriptor )
-    {
-        String lName = descriptor.module().layer().descriptor().name();
-        String mName = descriptor.module().descriptor().name();
-
-        return application.findModule( lName, mName );
-    }
-
-    /**
-     * Event Handler for EntitiesComboBox
-     *
-     * @param evt the Event
-     */
-    private void entitiesComboItemStateChanged( ItemEvent evt )
-    {
-        if( evt.getStateChange() == ItemEvent.DESELECTED )
-        {
-            return;
-        }
-
-        EntityDetailDescriptor entityDescriptor = (EntityDetailDescriptor) 
entitiesCombo.getSelectedItem();
-        Class clazz = first( entityDescriptor.descriptor().types() );
-
-        Module module = findModule( entityDescriptor );
-        Query query = createQuery( module, clazz );
-        propertiesPanel.reload( query );
-    }
-
-    /**
-     * Event Handler for TreePanel
-     *
-     * @param evt the Event
-     */
-    public void treePanelValueChanged( TreeSelectionEvent evt )
-    {
-        TreePath path = evt.getPath();
-        Object source = path.getLastPathComponent();
-        if( source == null )
-        {
-            return;
-        }
-
-        DefaultMutableTreeNode node = (DefaultMutableTreeNode) source;
-        Object obj = node.getUserObject();
-
-        if( obj == null )
-        {
-            return;
-        }
-
-        Class<?> clazz = obj.getClass();
-        if( EntityDetailDescriptor.class.isAssignableFrom( clazz ) )
-        {
-            EntityDetailDescriptor entityDesc = (EntityDetailDescriptor) obj;
-            Class entityType = first( entityDesc.descriptor().types() );
-
-            // Update the selected item on the combo box, which in turn update 
the properties table
-            ComboBoxModel comboModel = entitiesCombo.getModel();
-            int index = -1;
-            for( int i = 0; i < comboModel.getSize(); i++ )
-            {
-                EntityDetailDescriptor entityDesc1 = (EntityDetailDescriptor) 
comboModel.getElementAt( i );
-                Class entityType1 = first( entityDesc1.descriptor().types() );
-
-                if( entityType1.equals( entityType ) )
-                {
-                    index = i;
-                    break;
-                }
-            }
-
-            if( index >= 0 )
-            {
-                entitiesCombo.setSelectedIndex( index );
-            }
-        }
-    }
-
-    
-    {
-// GUI initializer generated by IntelliJ IDEA GUI Designer
-// >>> IMPORTANT!! <<<
-// DO NOT EDIT OR ADD ANY CODE HERE!
-        $$$setupUI$$$();
-    }
-
-    /**
-     * Method generated by IntelliJ IDEA GUI Designer
-     * >>> IMPORTANT!! <<<
-     * DO NOT edit this method OR call it in your code!
-     *
-     */
-    private void $$$setupUI$$$()
-    {
-        mainPane = new JPanel();
-        mainPane.setLayout( new BorderLayout( 0, 0 ) );
-        splitPane = new JSplitPane();
-        mainPane.add( splitPane, BorderLayout.CENTER );
-        propertiesAreaPane = new JPanel();
-        propertiesAreaPane.setLayout( new BorderLayout( 0, 0 ) );
-        splitPane.setRightComponent( propertiesAreaPane );
-        final JPanel panel1 = new JPanel();
-        panel1.setLayout( new GridBagLayout() );
-        propertiesAreaPane.add( panel1, BorderLayout.NORTH );
-        entitiesCombo = new JComboBox();
-        GridBagConstraints gbc;
-        gbc = new GridBagConstraints();
-        gbc.gridx = 2;
-        gbc.gridy = 0;
-        gbc.gridwidth = 3;
-        gbc.weightx = 0.3;
-        gbc.anchor = GridBagConstraints.WEST;
-        gbc.fill = GridBagConstraints.HORIZONTAL;
-        panel1.add( entitiesCombo, gbc );
-        final JLabel label1 = new JLabel();
-        label1.setText( "Entity" );
-        gbc = new GridBagConstraints();
-        gbc.gridx = 0;
-        gbc.gridy = 0;
-        gbc.anchor = GridBagConstraints.WEST;
-        panel1.add( label1, gbc );
-        final JPanel spacer1 = new JPanel();
-        gbc = new GridBagConstraints();
-        gbc.gridx = 1;
-        gbc.gridy = 0;
-        gbc.fill = GridBagConstraints.HORIZONTAL;
-        panel1.add( spacer1, gbc );
-    }
-
-    public JComponent $$$getRootComponent$$$()
-    {
-        return mainPane;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cf53af16/tools/entity-viewer/src/main/java/org/qi4j/library/swing/entityviewer/PropertiesPanel.java
----------------------------------------------------------------------
diff --git 
a/tools/entity-viewer/src/main/java/org/qi4j/library/swing/entityviewer/PropertiesPanel.java
 
b/tools/entity-viewer/src/main/java/org/qi4j/library/swing/entityviewer/PropertiesPanel.java
deleted file mode 100644
index 159ba1e..0000000
--- 
a/tools/entity-viewer/src/main/java/org/qi4j/library/swing/entityviewer/PropertiesPanel.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2009, Tony Kohar. All Rights Reserved.
- *
- * Licensed  under the  Apache License,  Version 2.0  (the "License");
- * you may not use  this file  except in  compliance with the License.
- * You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed  under the  License is distributed on an "AS IS" BASIS,
- * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
- * implied.
- *
- * See the License for the specific language governing permissions and
- * limitations under the License. 
- */
-package org.qi4j.library.swing.entityviewer;
-
-import java.awt.BorderLayout;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-import org.qi4j.api.association.AssociationStateHolder;
-import org.qi4j.api.entity.EntityComposite;
-import org.qi4j.api.entity.EntityDescriptor;
-import org.qi4j.api.property.PropertyDescriptor;
-import org.qi4j.api.query.Query;
-import org.qi4j.spi.Qi4jSPI;
-
-/**
- * Entity Properties Viewer as Swing Component.
- */
-public class PropertiesPanel
-    extends JPanel
-{
-    protected JTable propertiesTable;
-    protected Qi4jSPI qi4jspi;
-
-    public PropertiesPanel()
-    {
-        this.setLayout( new BorderLayout() );
-        JScrollPane scrollPane = new JScrollPane();
-        this.add( scrollPane, BorderLayout.CENTER );
-
-        propertiesTable = new JTable();
-        scrollPane.setViewportView( propertiesTable );
-    }
-
-    public void initializeQi4J( Qi4jSPI qi4j )
-    {
-        this.qi4jspi = qi4j;
-    }
-
-    /**
-     * Reload the table data with query based on the supplied query
-     *
-     * @param query the query to generate table data
-     */
-    public void reload( Query query )
-    {
-        TableModel tableModel = createData( query );
-        propertiesTable.setModel( tableModel );
-    }
-
-    /**
-     * Create table table or properties using the supplied query
-     *
-     * @param query the Query
-     *
-     * @return TableModel
-     */
-    protected TableModel createData( Query query )
-    {
-        DefaultTableModel model = new DefaultTableModel();
-
-        for( Object qObj : query )
-        {
-            AssociationStateHolder state = qi4jspi.stateOf( (EntityComposite) 
qObj );
-            EntityDescriptor descriptor = qi4jspi.entityDescriptorFor( 
(EntityComposite) qObj );
-            // genereate column, first time only
-            if( model.getColumnCount() < 1 )
-            {
-                for( PropertyDescriptor persistentPropertyDescriptor : 
descriptor.state()
-                    .properties() )
-                {
-                    model.addColumn( 
persistentPropertyDescriptor.qualifiedName().name() );
-                }
-            }
-
-            Object[] rowData = new Object[ model.getColumnCount() ];
-            int i = 0;
-            for( PropertyDescriptor persistentPropertyDescriptor : 
descriptor.state().properties() )
-            {
-                rowData[ i++] = state.propertyFor( 
persistentPropertyDescriptor.accessor() );
-            }
-            model.addRow( rowData );
-        }
-
-        return model;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cf53af16/tools/entity-viewer/src/main/java/org/qi4j/library/swing/entityviewer/TreePanel.java
----------------------------------------------------------------------
diff --git 
a/tools/entity-viewer/src/main/java/org/qi4j/library/swing/entityviewer/TreePanel.java
 
b/tools/entity-viewer/src/main/java/org/qi4j/library/swing/entityviewer/TreePanel.java
deleted file mode 100644
index d877ad4..0000000
--- 
a/tools/entity-viewer/src/main/java/org/qi4j/library/swing/entityviewer/TreePanel.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2009, Tony Kohar. All Rights Reserved.
- *
- * Licensed  under the  Apache License,  Version 2.0  (the "License");
- * you may not use  this file  except in  compliance with the License.
- * You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed  under the  License is distributed on an "AS IS" BASIS,
- * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
- * implied.
- *
- * See the License for the specific language governing permissions and
- * limitations under the License. 
- */
-package org.qi4j.library.swing.entityviewer;
-
-import java.awt.BorderLayout;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTree;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.MutableTreeNode;
-import javax.swing.tree.TreeSelectionModel;
-import org.qi4j.api.structure.ApplicationDescriptor;
-import org.qi4j.spi.Qi4jSPI;
-import org.qi4j.tools.model.descriptor.ApplicationDetailDescriptor;
-import org.qi4j.tools.model.descriptor.ApplicationDetailDescriptorBuilder;
-import org.qi4j.tools.model.descriptor.EntityDetailDescriptor;
-import org.qi4j.tools.model.descriptor.LayerDetailDescriptor;
-import org.qi4j.tools.model.descriptor.ModuleDetailDescriptor;
-
-/**
- * Qi4J Application Tree Viewer as Swing Component.
- */
-public class TreePanel
-    extends JPanel
-{
-    protected JTree applicationTree;
-    protected Qi4jSPI qi4j;
-    private ApplicationDescriptor model;
-
-    public TreePanel()
-    {
-        this.setLayout( new BorderLayout() );
-
-        this.applicationTree = new JTree();
-        this.applicationTree.getSelectionModel().setSelectionMode( 
TreeSelectionModel.SINGLE_TREE_SELECTION );
-
-        JScrollPane scrollPane = new JScrollPane();
-        this.add( scrollPane, BorderLayout.CENTER );
-        scrollPane.setViewportView( this.applicationTree );
-    }
-
-    public void initializeQi4J( Qi4jSPI qi4j, ApplicationDescriptor model )
-    {
-        this.qi4j = qi4j;
-        this.model = model;
-    }
-
-    public JTree getTreeComponent()
-    {
-        return applicationTree;
-    }
-
-    public void reload()
-    {
-        // build the visitor which allow traverse qi4j model
-        ApplicationDetailDescriptor visitor = 
ApplicationDetailDescriptorBuilder.createApplicationDetailDescriptor( model );
-        DefaultTreeModel treeModel = new DefaultTreeModel( new 
TreeModelBuilder().build( visitor ) );
-        applicationTree.setModel( treeModel );
-    }
-
-    /**
-     * Helper class to build tree model for up to 3 level depth, which 
focusing on the entity
-     */
-    class TreeModelBuilder
-    {
-
-        public MutableTreeNode build( ApplicationDetailDescriptor descriptor )
-        {
-            DefaultMutableTreeNode node = new DefaultMutableTreeNode( 
descriptor );
-            buildLayersNode( node, descriptor.layers() );
-            return node;
-        }
-
-        private void buildLayersNode( DefaultMutableTreeNode parent, 
Iterable<LayerDetailDescriptor> iter )
-        {
-            for( LayerDetailDescriptor descriptor : iter )
-            {
-                DefaultMutableTreeNode node = new DefaultMutableTreeNode( 
descriptor );
-                buildModulesNode( node, descriptor.modules() );
-                parent.add( node );
-            }
-        }
-
-        private void buildModulesNode( DefaultMutableTreeNode parent, 
Iterable<ModuleDetailDescriptor> iter )
-        {
-            for( ModuleDetailDescriptor descriptor : iter )
-            {
-                DefaultMutableTreeNode node = new DefaultMutableTreeNode( 
descriptor );
-                buildEntitiesNode( node, descriptor.entities() );
-                parent.add( node );
-            }
-        }
-
-        private void buildEntitiesNode( DefaultMutableTreeNode parent, 
Iterable<EntityDetailDescriptor> iter )
-        {
-            for( EntityDetailDescriptor descriptor : iter )
-            {
-                DefaultMutableTreeNode node = new DefaultMutableTreeNode( 
descriptor );
-                parent.add( node );
-            }
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cf53af16/tools/entity-viewer/src/main/java/org/qi4j/library/swing/entityviewer/package.html
----------------------------------------------------------------------
diff --git 
a/tools/entity-viewer/src/main/java/org/qi4j/library/swing/entityviewer/package.html
 
b/tools/entity-viewer/src/main/java/org/qi4j/library/swing/entityviewer/package.html
deleted file mode 100644
index 687f198..0000000
--- 
a/tools/entity-viewer/src/main/java/org/qi4j/library/swing/entityviewer/package.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
-    <body>
-        <h2>EntityViewer Tool.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cf53af16/tools/entity-viewer/src/test/java/org/qi4j/swing/library/swing/entityviewer/sample/ApplicationSample.java
----------------------------------------------------------------------
diff --git 
a/tools/entity-viewer/src/test/java/org/qi4j/swing/library/swing/entityviewer/sample/ApplicationSample.java
 
b/tools/entity-viewer/src/test/java/org/qi4j/swing/library/swing/entityviewer/sample/ApplicationSample.java
deleted file mode 100644
index df7aa67..0000000
--- 
a/tools/entity-viewer/src/test/java/org/qi4j/swing/library/swing/entityviewer/sample/ApplicationSample.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 2009, Tony Kohar. All Rights Reserved.
- *
- * Licensed  under the  Apache License,  Version 2.0  (the "License");
- * you may not use  this file  except in  compliance with the License.
- * You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed  under the  License is distributed on an "AS IS" BASIS,
- * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
- * implied.
- *
- * See the License for the specific language governing permissions and
- * limitations under the License. 
- */
-package org.qi4j.swing.library.swing.entityviewer.sample;
-
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.qi4j.api.entity.EntityBuilder;
-import org.qi4j.api.entity.EntityComposite;
-import org.qi4j.api.property.Property;
-import org.qi4j.api.query.Query;
-import org.qi4j.api.unitofwork.UnitOfWork;
-import org.qi4j.api.unitofwork.UnitOfWorkCompletionException;
-import org.qi4j.bootstrap.AssemblyException;
-import org.qi4j.bootstrap.ModuleAssembly;
-import org.qi4j.index.rdf.assembly.RdfMemoryStoreAssembler;
-import org.qi4j.library.swing.entityviewer.EntityViewer;
-import org.qi4j.test.AbstractQi4jTest;
-import org.qi4j.test.EntityTestAssembler;
-
-import static org.qi4j.test.util.Assume.assumeDisplayPresent;
-
-public class ApplicationSample
-    extends AbstractQi4jTest
-{
-
-    @BeforeClass
-    public static void assumeDisplay()
-    {
-        assumeDisplayPresent();
-    }
-
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        module.entities( CarEntity.class );
-        module.entities( AnimalEntity.class );
-        new RdfMemoryStoreAssembler().assemble( module );
-        new EntityTestAssembler().assemble( module );
-    }
-
-    public void createTestData()
-        throws UnitOfWorkCompletionException
-    {
-        UnitOfWork uow = module.newUnitOfWork();
-        createCar( "Volvo", "S80", 2007 );
-        createCar( "Volvo", "C70", 2006 );
-        createCar( "Ford", "Transit", 2007 );
-        createCar( "Ford", "Mustang", 2007 );
-        createCar( "Ford", "Mustang", 2006 );
-        createCar( "Ford", "Mustang", 2005 );
-
-        createAnimal( "Cat", "Miaow" );
-        createAnimal( "Duck", "Kwek-kwek" );
-        createAnimal( "Dog", "Guk" );
-        createAnimal( "Cow", "Moooo" );
-
-        uow.complete();
-    }
-
-    public void testQuery()
-    {
-        UnitOfWork uow = module.newUnitOfWork();
-        Query<Car> query = uow.newQuery( module.newQueryBuilder( Car.class ) );
-        for( Car car : query )
-        {
-            System.out.println( car.model() + " | " + car.manufacturer() + " | 
" + car.year() );
-        }
-    }
-
-    public static void main( String[] args )
-        throws Exception
-    {
-        ApplicationSample sample = new ApplicationSample();
-        sample.runSample();
-    }
-
-    @Test
-    public void runSample()
-        throws Exception
-    {
-        setUp();
-        createTestData();
-        //testQuery();
-        // START SNIPPET: entity-viewer
-        new EntityViewer().show( qi4j.spi(), applicationModel, application );
-        // END SNIPPET: entity-viewer
-    }
-
-    private String createCar( String manufacturer, String model, int year )
-    {
-        UnitOfWork uow = module.currentUnitOfWork();
-        EntityBuilder<Car> builder = uow.newEntityBuilder( Car.class );
-        Car prototype = builder.instanceFor( CarEntity.class );
-        prototype.manufacturer().set( manufacturer );
-        prototype.model().set( model );
-        prototype.year().set( year );
-        CarEntity entity = (CarEntity) builder.newInstance();
-        return entity.identity().get();
-    }
-
-    private String createAnimal( String name, String sound )
-    {
-        UnitOfWork uow = module.currentUnitOfWork();
-        EntityBuilder<Animal> builder = uow.newEntityBuilder( Animal.class );
-        Animal prototype = builder.instanceFor( AnimalEntity.class );
-        prototype.name().set( name );
-        prototype.sound().set( sound );
-        AnimalEntity entity = (AnimalEntity) builder.newInstance();
-        return entity.identity().get();
-    }
-
-    public interface Car
-    {
-
-        Property<String> manufacturer();
-
-        Property<String> model();
-
-        Property<Integer> year();
-
-    }
-
-    public interface CarEntity
-        extends Car, EntityComposite
-    {
-    }
-
-    public interface Animal
-    {
-
-        Property<String> name();
-
-        Property<String> sound();
-
-    }
-
-    public interface AnimalEntity
-        extends Animal, EntityComposite
-    {
-    }
-
-}

Reply via email to