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

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


    private final Tree tree;

    private boolean isDSLR;

    public FactTypeBrowserWidget( final ClickEvent ev ) {
        this.tree = new Tree();

        final VerticalPanel panel = new VerticalPanel();
        final HorizontalPanel hpFactsAndHide = new HorizontalPanel();
        final HorizontalPanel hpShow = new HorizontalPanel();
View Full Code Here


public class FactTypeBrowser extends Composite {

    public FactTypeBrowser(SuggestionCompletionEngine sce,
            final ClickEvent ev) {
        final Tree tree = new Tree();

        final VerticalPanel panel = new VerticalPanel();

        final HorizontalPanel hpFactsAndHide = new HorizontalPanel();
        final HorizontalPanel hpShow = new HorizontalPanel();

        hpShow.add(new ClickableLabel(Constants.INSTANCE.ShowFactTypes(),
                new ClickHandler() {
                    public void onClick(com.google.gwt.event.dom.client.ClickEvent event) {
                        hpShow.setVisible(false);
                        hpFactsAndHide.setVisible(true);
                        tree.setVisible(true);
                    }
                }));
        panel.add(hpShow);

        hpFactsAndHide.add(new SmallLabel(Constants.INSTANCE.FactTypes()));
        hpFactsAndHide.add(new ClickableLabel(Constants.INSTANCE.hide(),
                new ClickHandler() {
                    public void onClick(com.google.gwt.event.dom.client.ClickEvent event) {
                        hpShow.setVisible(true);
                        hpFactsAndHide.setVisible(false);
                        tree.setVisible(false);
                    }
                }));
        panel.add(hpFactsAndHide);

        panel.add(tree);
        if (sce.getFactTypes() != null) {
            for (String type : sce.getFactTypes()) {
                TreeItem it = new TreeItem();
                it.setHTML(AbstractImagePrototype.create(DroolsGuvnorImageResources.INSTANCE.classImage()).getHTML()
                        + "<small>"
                        + type + "</small>");
                it.setUserObject(type + "( )");
                tree.addItem(it);

                String[] fields = (String[]) sce.getModelFields(type);
                if (fields != null) {
                    for (String field : fields) {
                        TreeItem fi = new TreeItem();
                        fi.setHTML(AbstractImagePrototype.create(DroolsGuvnorImageResources.INSTANCE.field()).getHTML()
                                + "<small>"
                                + field + "</small>");
                        fi.setUserObject(field);
                        it.addItem(fi);
                    }
                }
            }
        }

        tree.setStyleName("category-explorer-Tree"); //NON-NLS
        tree.addSelectionHandler(new SelectionHandler<TreeItem>() {

            public void onSelection(SelectionEvent<TreeItem> event) {
                Object o = event.getSelectedItem().getUserObject();
                if (o instanceof String) {
                    ev.selected((String) o);
                }
            }
        });

        tree.setVisible(false);
        hpFactsAndHide.setVisible(false);
        hpShow.setVisible(true);

        initWidget(panel);
    }
View Full Code Here

            return null;
        }
    }

    public Tree createTree() {
        return new Tree();
    }
View Full Code Here

    public VerifierResultWidget(AnalysisReport report,
                                boolean showFactUsage) {
       
        FormStyleLayout layout = new FormStyleLayout();

        Tree tree = new Tree();

        TreeItem errors = doMessageLines( Constants.INSTANCE.Errors(),
                                          DroolsGuvnorImageResources.INSTANCE.error(),
                                          report.errors );
        tree.addItem( errors );

        TreeItem warnings = doMessageLines( Constants.INSTANCE.Warnings(),
                                            DroolsGuvnorImageResources.INSTANCE.warning(),
                                            report.warnings );
        tree.addItem( warnings );

        TreeItem notes = doMessageLines( Constants.INSTANCE.Notes(),
                                         DroolsGuvnorImageResources.INSTANCE.note(),
                                         report.notes );
        tree.addItem( notes );

        if ( showFactUsage ) {
            tree.addItem( new FactUsagesItem( report.factUsages ) );
        }

        tree.addCloseHandler( new CloseHandler<TreeItem>() {
            public void onClose(CloseEvent<TreeItem> event) {
                swapTitleWithUserObject( event.getTarget() );
            }
        } );
        tree.addOpenHandler( new OpenHandler<TreeItem>() {
            public void onOpen(OpenEvent<TreeItem> event) {
                swapTitleWithUserObject( event.getTarget() );
            }
        } );
        layout.addRow( tree );
View Full Code Here

       
        for (Map.Entry<String,String> entry : springContextElements.entrySet()) {
            mainPanel.add(new PanelButton(entry.getKey(), entry.getValue()));
        }

        final Tree resourcesTree = new Tree();
        mainPanel.add(resourcesTree);

        final TreeItem rootItem = new TreeItem(Constants.INSTANCE.Packages());

        //Global Area Data
        ModuleServiceAsync moduleService = GWT.create(ModuleService.class);
        moduleService.loadGlobalModule(new AsyncCallback<Module>() {

                                public void onFailure(Throwable caught) {
                                    ErrorPopup.showMessage("Error listing Global Area information!");
                                }

                                public void onSuccess(Module result) {
                                    populatePackageTree(result, rootItem);
                                }
                            });

        //Packages Data
        moduleService.listModules(new AsyncCallback<Module[]>() {

                                public void onFailure(Throwable caught) {
                                    ErrorPopup.showMessage("Error listing package information!");
                                }

                                public void onSuccess(Module[] result) {
                                    for (int i = 0; i < result.length; i++) {
                                        final Module packageConfigData = result[i];
                                        populatePackageTree(packageConfigData, rootItem);
                                    }
                                }
                            });

        resourcesTree.addItem(rootItem);
        resourcesTree.setStyleName("category-explorer-Tree"); //NON-NLS
        resourcesTree.addSelectionHandler(new SelectionHandler<TreeItem>()    {

            public void onSelection(SelectionEvent<TreeItem> event) {
                Object o = event.getSelectedItem().getUserObject();
                if (o instanceof String) {
                }
View Full Code Here

   */
  @ShowcaseSource
  @Override
  public Widget onInitialize() {
    // Create a static tree and a container to hold it
    Tree staticTree = createStaticTree();
    staticTree.setAnimationEnabled(true);
    staticTree.ensureDebugId("cwTree-staticTree");
    ScrollPanel staticTreeWrapper = new ScrollPanel(staticTree);
    staticTreeWrapper.ensureDebugId("cwTree-staticTree-Wrapper");
    staticTreeWrapper.setSize("300px", "300px");

    // Wrap the static tree in a DecoratorPanel
    DecoratorPanel staticDecorator = new DecoratorPanel();
    staticDecorator.setWidget(staticTreeWrapper);

    // Create a dynamically generated tree and a container to hold it
    final Tree dynamicTree = createDynamicTree();
    dynamicTree.ensureDebugId("cwTree-dynamicTree");
    ScrollPanel dynamicTreeWrapper = new ScrollPanel(dynamicTree);
    dynamicTreeWrapper.ensureDebugId("cwTree-dynamicTree-Wrapper");
    dynamicTreeWrapper.setSize("300px", "300px");

    // Wrap the dynamic tree in a DecoratorPanel
View Full Code Here

   * @return the new tree
   */
  @ShowcaseSource
  private Tree createDynamicTree() {
    // Create a new tree
    Tree dynamicTree = new Tree();

    // Add some default tree items
    for (int i = 0; i < 5; i++) {
      TreeItem item = dynamicTree.addItem(constants.cwTreeItem() + " " + i);

      // Temporarily add an item so we can expand this node
      item.addItem("");
    }

    // Add a handler that automatically generates some children
    dynamicTree.addOpenHandler(new OpenHandler<TreeItem>() {
      public void onOpen(OpenEvent<TreeItem> event) {
        TreeItem item = event.getTarget();
        if (item.getChildCount() == 1) {
          // Close the item immediately
          item.setState(false, false);
View Full Code Here

    String[] composers = constants.cwTreeComposers();
    String concertosLabel = constants.cwTreeConcertos();
    String quartetsLabel = constants.cwTreeQuartets();
    String sonatasLabel = constants.cwTreeSonatas();
    String symphoniesLabel = constants.cwTreeSymphonies();
    Tree staticTree = new Tree();

    // Add some of Beethoven's music
    TreeItem beethovenItem = staticTree.addItem(composers[0]);
    addMusicSection(beethovenItem, concertosLabel,
        constants.cwTreeBeethovenWorkConcertos());
    addMusicSection(beethovenItem, quartetsLabel,
        constants.cwTreeBeethovenWorkQuartets());
    addMusicSection(beethovenItem, sonatasLabel,
        constants.cwTreeBeethovenWorkSonatas());
    addMusicSection(beethovenItem, symphoniesLabel,
        constants.cwTreeBeethovenWorkSymphonies());

    // Add some of Brahms's music
    TreeItem brahmsItem = staticTree.addItem(composers[1]);
    addMusicSection(brahmsItem, concertosLabel,
        constants.cwTreeBrahmsWorkConcertos());
    addMusicSection(brahmsItem, quartetsLabel,
        constants.cwTreeBrahmsWorkQuartets());
    addMusicSection(brahmsItem, sonatasLabel,
        constants.cwTreeBrahmsWorkSonatas());
    addMusicSection(brahmsItem, symphoniesLabel,
        constants.cwTreeBrahmsWorkSymphonies());

    // Add some of Mozart's music
    TreeItem mozartItem = staticTree.addItem(composers[2]);
    addMusicSection(mozartItem, concertosLabel,
        constants.cwTreeMozartWorkConcertos());

    // Return the tree
    return staticTree;
View Full Code Here

   * Setup all of the options in the main menu.
   *
   * @param constants the constant values to use
   */
  private void setupMainMenu(ShowcaseConstants constants) {
    Tree mainMenu = app.getMainMenu();

    // Widgets
    TreeItem catWidgets = mainMenu.addItem(constants.categoryWidgets());
    setupMainMenuOption(catWidgets, new CwCheckBox(constants),
        images.catWidgets());
    setupMainMenuOption(catWidgets, new CwRadioButton(constants),
        images.catWidgets());
    setupMainMenuOption(catWidgets, new CwBasicButton(constants),
        images.catWidgets());
    setupMainMenuOption(catWidgets, new CwCustomButton(constants),
        images.catWidgets());
    setupMainMenuOption(catWidgets, new CwFileUpload(constants),
        images.catWidgets());
    setupMainMenuOption(catWidgets, new CwDatePicker(constants),
        images.catWidgets());
    setupMainMenuOption(catWidgets, new CwHyperlink(constants),
        images.catWidgets());

    // Lists
    TreeItem catLists = mainMenu.addItem(constants.categoryLists());
    setupMainMenuOption(catLists, new CwListBox(constants), images.catLists());
    setupMainMenuOption(catLists, new CwSuggestBox(constants),
        images.catLists());
    setupMainMenuOption(catLists, new CwTree(constants), images.catLists());
    setupMainMenuOption(catLists, new CwMenuBar(constants), images.catLists());
    setupMainMenuOption(catLists, new CwStackPanel(constants),
        images.catLists());

    // Text
    TreeItem catText = mainMenu.addItem(constants.categoryTextInput());
    setupMainMenuOption(catText, new CwBasicText(constants),
        images.catTextInput());
    setupMainMenuOption(catText, new CwRichText(constants),
        images.catTextInput());

    // Popups
    TreeItem catPopup = mainMenu.addItem(constants.categoryPopups());
    setupMainMenuOption(catPopup, new CwBasicPopup(constants),
        images.catPopups());
    setupMainMenuOption(catPopup, new CwDialogBox(constants),
        images.catPopups());

    // Panels
    TreeItem catPanels = mainMenu.addItem(constants.categoryPanels());
    setupMainMenuOption(catPanels, new CwDecoratorPanel(constants),
        images.catPanels());
    setupMainMenuOption(catPanels, new CwFlowPanel(constants),
        images.catPanels());
    setupMainMenuOption(catPanels, new CwHorizontalPanel(constants),
        images.catPanels());
    setupMainMenuOption(catPanels, new CwVerticalPanel(constants),
        images.catPanels());
    setupMainMenuOption(catPanels, new CwAbsolutePanel(constants),
        images.catPanels());
    setupMainMenuOption(catPanels, new CwDockPanel(constants),
        images.catPanels());
    setupMainMenuOption(catPanels, new CwDisclosurePanel(constants),
        images.catPanels());
    setupMainMenuOption(catPanels, new CwTabPanel(constants),
        images.catPanels());
    setupMainMenuOption(catPanels, new CwHorizontalSplitPanel(constants),
        images.catPanels());
    setupMainMenuOption(catPanels, new CwVerticalSplitPanel(constants),
        images.catPanels());

    // Tables
    TreeItem catTables = mainMenu.addItem(constants.categoryTables());
    setupMainMenuOption(catTables, new CwGrid(constants), images.catTables());
    setupMainMenuOption(catTables, new CwFlexTable(constants),
        images.catTables());

    // Internationalization
    TreeItem catI18N = mainMenu.addItem(constants.categoryI18N());
    setupMainMenuOption(catI18N, new CwNumberFormat(constants),
        images.catI18N());
    setupMainMenuOption(catI18N, new CwDateTimeFormat(constants),
        images.catI18N());
    setupMainMenuOption(catI18N, new CwMessagesExample(constants),
        images.catI18N());
    setupMainMenuOption(catI18N, new CwPluralFormsExample(constants),
        images.catI18N());
    setupMainMenuOption(catI18N, new CwConstantsExample(constants),
        images.catI18N());
    setupMainMenuOption(catI18N, new CwConstantsWithLookupExample(constants),
        images.catI18N());
    setupMainMenuOption(catI18N, new CwDictionaryExample(constants),
        images.catI18N());

    // Other
    TreeItem catOther = mainMenu.addItem(constants.categoryOther());
    setupMainMenuOption(catOther, new CwAnimation(constants), images.catOther());
    setupMainMenuOption(catOther, new CwCookies(constants), images.catOther());
  }
View Full Code Here

   * Create the main menu.
   */
  private void createMainMenu() {
    // Setup the main menu
    ApplicationImages treeImages = GWT.create(ApplicationImages.class);
    mainMenu = new Tree(treeImages);
    mainMenu.setAnimationEnabled(true);
    mainMenu.addStyleName(DEFAULT_STYLE_NAME + "-menu");
  }
View Full Code Here

TOP

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

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.