Package com.google.gwt.user.client.ui

Examples of com.google.gwt.user.client.ui.TreeItem


    public boolean isSelected() {
        return navTreeWidget.getSelectedItem() != null;
    }

    protected void buildTree( final Categories categories ) {
        final TreeItem root = new TreeItem();
        root.setHTML( AbstractImagePrototype.create( ImageResources.INSTANCE.desc() ).getHTML() );
        navTreeWidget.addItem( root );

        for ( final CategoryItem category : categories ) {
            final TreeItem it = buildTreeItem( category );
            root.addItem( it );

            if ( category.hasChild() ) {
                loadChildren( it, category );
            }
View Full Code Here


    }

    protected void loadChildren( final TreeItem it,
                                 final CategoryItem category ) {
        for ( final CategoryItem child : category.getChildren() ) {
            final TreeItem ct = buildTreeItem( child );

            it.addItem( ct );

            if ( child.hasChild() ) {
                loadChildren( ct, child );
View Full Code Here

            }
        }
    }

    public TreeItem buildTreeItem( final CategoryItem category ) {
        final TreeItem it = new TreeItem();
        it.setHTML( AbstractImagePrototype.create( ImageResources.INSTANCE.categorySmall() ).getHTML() + h( category.getName() ) );
        it.setUserObject( category );

        return it;
    }
View Full Code Here

    public void addChildren( final CategoryItem parent,
                             final String name,
                             final String description ) {
        final CategoryItem child = parent.addChildren( name, description );

        final TreeItem parentTree;
        if ( getSelectedCategory() == null ) {
            parentTree = navTreeWidget.getItem( 0 );
        } else {
            parentTree = navTreeWidget.getSelectedItem();
        }

        final TreeItem ct = buildTreeItem( child );
        parentTree.addItem( ct );
        parentTree.setState( true );
    }
View Full Code Here

            tree.clear();
        }

        if ( dslSentences != null ) {
            for ( DSLSentence dslSentence : dslSentences ) {
                final TreeItem it = new TreeItem();
                it.setHTML( "<small>" + dslSentence.toString() + "</small>" );
                it.setUserObject( dslSentence );
                tree.addItem( it );
            }
        }
    }
View Full Code Here

        } );

        tree.addOpenHandler( new OpenHandler<TreeItem>() {
            @Override
            public void onOpen( final OpenEvent<TreeItem> event ) {
                final TreeItem item = event.getTarget();
                if ( needsLoading( item ) ) {
                    final Object userObject = event.getTarget().getUserObject();
                    presenter.loadClassFields( ( (ClassUserObject) userObject ).fullyQualifiedClassName,
                                               new Callback<List<String>>() {
                                                   @Override
                                                   public void callback( final List<String> fields ) {
                                                       item.getChild( 0 ).remove();
                                                       if ( fields != null ) {
                                                           for ( String field : fields ) {
                                                               final TreeItem fi = new TreeItem();
                                                               fi.setHTML( AbstractImagePrototype.create( DRLTextEditorResources.INSTANCE.images().fieldImage() ).getHTML()
                                                                                   + "<small>"
                                                                                   + field + "</small>" );
                                                               fi.setUserObject( field );
                                                               item.addItem( fi );
                                                           }
                                                       }
                                                   }
                                               } );
View Full Code Here

            tree.clear();
        }

        if ( fullyQualifiedClassNames != null ) {
            for ( String type : fullyQualifiedClassNames ) {
                final TreeItem it = new TreeItem();
                it.setHTML( AbstractImagePrototype.create( DRLTextEditorResources.INSTANCE.images().classImage() ).getHTML()
                                    + "<small>"
                                    + type + "</small>" );
                it.setUserObject( new ClassUserObject( type + "( )",
                                                       type ) );
                tree.addItem( it );
                it.addItem( Util.toSafeHtml( LAZY_LOAD ) );
            }
        }
    }
View Full Code Here

        } );

        tree.addOpenHandler( new OpenHandler<TreeItem>() {
            @Override
            public void onOpen( final OpenEvent<TreeItem> event ) {
                final TreeItem item = event.getTarget();
                if ( needsLoading( item ) ) {
                    final Object userObject = event.getTarget().getUserObject();
                    presenter.loadClassFields( ( (ClassUserObject) userObject ).fullyQualifiedClassName,
                                               new Callback<List<String>>() {
                                                   @Override
                                                   public void callback( final List<String> fields ) {
                                                       item.getChild( 0 ).remove();
                                                       if ( fields != null ) {
                                                           for ( String field : fields ) {
                                                               final TreeItem fi = new TreeItem();
                                                               fi.setHTML( AbstractImagePrototype.create( DRLTextEditorResources.INSTANCE.images().fieldImage() ).getHTML()
                                                                                   + "<small>"
                                                                                   + field + "</small>" );
                                                               fi.setUserObject( field );
                                                               item.addItem( fi );
                                                           }
                                                       }
                                                   }
                                               } );
View Full Code Here

            tree.clear();
        }

        if ( fullyQualifiedClassNames != null ) {
            for ( String type : fullyQualifiedClassNames ) {
                final TreeItem it = new TreeItem();
                it.setHTML( AbstractImagePrototype.create( DRLTextEditorResources.INSTANCE.images().classImage() ).getHTML()
                                    + "<small>"
                                    + type + "</small>" );
                it.setUserObject( new ClassUserObject( type + "( )",
                                                       type ) );
                tree.addItem( it );
                it.addItem( Util.toSafeHtml( LAZY_LOAD ) );
            }
        }
    }
View Full Code Here

//      hc.add(new Image("http://tueffel.net/images/icons/icon13.gif"));
//      hc.add(new Label("/"));
//      TreeItem root = new TreeItem(hc);
//      tree.addItem(root);
    tree.clear();
    TreeItem root = tree.addTextItem(result.getName());
    updateTreeNode(root, result.getChilds());
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.ui.TreeItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.