Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2010 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.guvnor.client.qa;
 
 import  org.drools.guvnor.client.common.FormStyleLayout;
 import  org.drools.guvnor.client.rpc.AnalysisReport;
 import  org.drools.guvnor.client.rpc.AnalysisReportLine;
 
 import  com.gwtext.client.util.Format;

Shows the results of an analysis run.

Author(s):
Michael Neale
 
 public class VerifierResultWidget extends Composite {
 
     private Constants     constants = GWT.createConstants.class );
     private EditItemEvent edit      = null;
 
     public VerifierResultWidget(AnalysisReport report,
                                 boolean showFactUsage,
                                 EditItemEvent edit) {
         thisreport,
               showFactUsage );
         this. = edit;
     }
 
     public VerifierResultWidget(AnalysisReport report,
                                 boolean showFactUsage) {
         FormStyleLayout layout = new FormStyleLayout();
 
         Tree tree = new Tree();
 
         TreeItem errors = doMessageLines.Errors(),
                                           "images/error.gif",
                                           report.errors );
         tree.addItemerrors );
 
         TreeItem warnings = doMessageLines.Warnings(),
                                             "images/warning.gif",
                                             report.warnings );
         tree.addItemwarnings );
 
         TreeItem notes = doMessageLines.Notes(),
                                          "images/note.gif",
                                          report.notes );
         tree.addItemnotes );
 
         if ( showFactUsage ) {
             tree.addItemnew FactUsagesItemreport.factUsages ) );
         }
 
         tree.addTreeListenerswapTitleWithUserObject() );
         layout.addRow( tree );
 
         initWidgetlayout );
     }
 
     private TreeItem doMessageLines(String messageType,
                                     String icon,
                                     AnalysisReportLine[] lines) {
 
         TreeItem linesItem;
 
         String summary = Format.format( .analysisResultSummary(),
                                         messageType,
                                         "" + lines.length );
 
         String topicHtml = Format.format( "<img src='{0}' /> &nbsp; {1}",
                                           icon,
                                           summary );
 
         linesItem = new VerifierMessageLinesItemtopicHtml,
                                                   lines,
                                                    );
 
         return linesItem;
    }
        return new TreeListener() {
            public void onTreeItemSelected(TreeItem x) {
            }
            //swap around with user object to toggle
            public void onTreeItemStateChanged(TreeItem x) {
                if ( x.getUserObject() != null ) {
                    Widget currentW = x.getWidget();
                    x.setWidget( (Widgetx.getUserObject() );
                    x.setUserObjectcurrentW );
                }
            }
        };
    }
New to GrepCode? Check out our FAQ X