Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2012 JBoss Inc
   *
   * 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.drools.workbench.screens.drltext.client.widget;
 
 
 public class FactTypeBrowserWidget
         extends Composite {
 
     private final Tree tree;
 
     public FactTypeBrowserWidgetfinal ClickEvent ev ) {
         this. = new Tree();
 
         final VerticalPanel panel = new VerticalPanel();
 
         final HorizontalPanel hpFactsAndHide = new HorizontalPanel();
         final HorizontalPanel hpShow = new HorizontalPanel();
 
                                         new ClickHandler() {
                                             public void onClickcom.google.gwt.event.dom.client.ClickEvent event ) {
                                                 hpShow.setVisiblefalse );
                                                 hpFactsAndHide.setVisibletrue );
                                                 .setVisibletrue );
                                             }
                                         } ) );
         panel.addhpShow );
 
         hpFactsAndHide.addnew SmallLabel..FactTypes() ) );
         hpFactsAndHide.addnew ClickableLabel..hide(),
                                                 new ClickHandler() {
                                                     public void onClickcom.google.gwt.event.dom.client.ClickEvent event ) {
                                                         hpShow.setVisibletrue );
                                                         hpFactsAndHide.setVisiblefalse );
                                                         .setVisiblefalse );
                                                     }
                                                 } ) );
         panel.addhpFactsAndHide );
 
         panel.add );
 
         .addSelectionHandlernew SelectionHandler<TreeItem>() {
             public void onSelectionSelectionEvent<TreeItemevent ) {
                 Object o = event.getSelectedItem().getUserObject();
                 if ( o instanceof String ) {
                     ev.selected( (Stringo );
                 }
             }
         } );
 
         .setVisiblefalse );
         hpFactsAndHide.setVisiblefalse );
         hpShow.setVisibletrue );
 
         initWidgetpanel );
     }
 
     public void setDataModelfinal PackageDataModelOracle dataModel ) {
         if ( .getItem( 0 ) != null ) {
             .clear();
         }
 
         if ( dataModel.getFactTypes() != null ) {
             for ( String type : dataModel.getFactTypes() ) {
                 TreeItem it = new TreeItem();
                 it.setHTML( AbstractImagePrototype.create..images().classImage() ).getHTML()
                                     + "<small>"
                                     + type + "</small>" );
                 it.setUserObjecttype + "( )" );
                .addItemit );
                String[] fields = dataModel.getFieldCompletionstype );
                if ( fields != null ) {
                    for ( String field : fields ) {
                        TreeItem fi = new TreeItem();
                        fi.setHTML( AbstractImagePrototype.create..images().fieldImage() ).getHTML()
                                            + "<small>"
                                            + field + "</small>" );
                        fi.setUserObjectfield );
                        it.addItemfi );
                    }
                }
            }
        }
    }
    public static interface ClickEvent {
        public void selectedString text );
    }
New to GrepCode? Check out our FAQ X