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 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.ruleeditor;
  * Copyright 2005 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
  * 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.
 import  com.gwtext.client.widgets.Toolbar;
 import  com.gwtext.client.widgets.ToolbarTextItem;
 import  com.gwtext.client.widgets.Panel;
 import  org.drools.guvnor.client.common.DirtyableComposite;
 import  org.drools.guvnor.client.messages.Constants;
 import  org.drools.guvnor.client.rpc.MetaData;
 import  org.drools.guvnor.client.rpc.RuleAsset;

This holds the editor and viewer for rule documentation. It will update the model when the text is changed.

Michael Neale
 public class RuleDocumentWidget extends DirtyableComposite {
 	private TextArea text;
     private Constants constants = ((Constants) GWT.create(Constants.class));
     public RuleDocumentWidget(final RuleAsset asset) {
         MetaData data = asset.metaData;
 		 = new TextArea();
         .setWidth( "100%" );
         .setVisibleLines( 5 );
         .setStyleName( "rule-viewer-Documentation" ); //NON-NLS
         Panel p = new Panel();
         p.setCollapsible( true );
         p.setTitle( .Description() + ":" );
         if (data.description == null || data.description.equals("") || data.description.equals("<documentation>")) {
         final VerticalPanel vp = new VerticalPanel();
         DeferredCommand.addCommand(new Command() {
             public void execute() {
                 vp.add(new DiscussionWidget(asset));
     private void loadData(final MetaData data) {
         .addChangeListener( new ChangeListener() {
             public void onChange(Widget w) {
                data.description = .getText();
        if (data.description == null || "".equals(data.description )) {
New to GrepCode? Check out our FAQ X