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.workbench.screens.workitems.client.widget;
 
 import java.util.List;
 import java.util.Map;
 
 
                                                                             UberView<WorkItemDefinitionElementSelectedListener> {
 
     @Inject
 
     private final VerticalPanel mainPanel = new VerticalPanel();
     private final VerticalPanel elementsPanel = new VerticalPanel();
     private final ListBox importsList = new ListBox();
     private final ListBox imagesList = new ListBox();
 
 
     private class PanelButton extends Button {
 
         public PanelButtonfinal String html,
                             final String pasteValue ) {
             superhtml );
             this.setWidth"100px" );
             this.addClickHandlernew LeafClickHandlerhtml,
                                                         pasteValue ) );
         }
 
     }
 
     private class LeafClickHandler implements ClickHandler {
 
         final private String title;
         final private String pasteValue;
 
         public LeafClickHandlerfinal String title,
                                  final String pasteValue ) {
             this. = title;
             this. = pasteValue;
         }
 
         public void onClickfinal ClickEvent event ) {
             elementSelectedthis.,
                              this. );
         }
     }
 
         .setSpacing( 5 );
 
         //Element definitions
         .setSpacing( 5 );
         .add );
 
         //Imports
         .add );
         .addItem"BooleanDataType",
                              "import org.drools.core.process.core.datatype.impl.type.BooleanDataType;" );
         .addItem"EnumDataType",
                              "import org.drools.core.process.core.datatype.impl.type.EnumDataType;" );
         .addItem"FloatDataType",
                              "import org.drools.core.process.core.datatype.impl.type.FloatDataType;" );
         .addItem"IntegerDataType",
                              "import org.drools.core.process.core.datatype.impl.type.IntegerDataType;" );
         .addItem"ListDataType",
                             "import org.drools.core.process.core.datatype.impl.type.ListDataType;" );
        .addItem"ObjectDataType",
                             "import org.drools.core.process.core.datatype.impl.type.ObjectDataType;" );
        .addItem"StringDataType",
                             "import org.drools.core.process.core.datatype.impl.type.StringDataType;" );
        .addItem"UndefinedDataType",
                             "import org.drools.core.process.core.datatype.impl.type.UndefinedDataType;" );
        .setVisibleItemCount( 9 );
        .setSelectedIndex( 0 );
        .addChangeHandlernew ChangeHandler() {
            public void onChangeChangeEvent event ) {
                elementSelected.getItemText.getSelectedIndex() ),
                                 .getValue.getSelectedIndex() ) );
            }
        } );
        //Images
        .add );
        .setVisibleItemCount( 1 );
        .setSelectedIndex( 0 );
        .addChangeHandlernew ChangeHandler() {
            public void onChangeChangeEvent event ) {
                elementSelected.getItemText.getSelectedIndex() ),
                                 .getValue.getSelectedIndex() ) );
            }
        } );
        initWidget );
    }
    public void loadMetaData() {
        .loadMetaContentthis );
    }
    @Override
    public void initfinal WorkItemDefinitionElementSelectedListener presenter ) {
        this. = presenter;
    }
    @Override
    public void setDefinitionElementsfinal WorkItemDefinitionElements metaData ) {
        final Map<StringStringworkItemElementDefinitions = metaData.getDefinitionElements();
        for ( Map.Entry<StringStringentry : workItemElementDefinitions.entrySet() ) {
            .addnew PanelButtonentry.getKey(),
                                                entry.getValue() ) );
        }
    }
    public void setImagesfinal List<StringworkItemImages ) {
        for ( String workItemImage : workItemImages ) {
            .addItemworkItemImage );
        }
    }
    private void elementSelectedfinal String title,
                                  final String value ) {
        .onElementSelectedtitle,
                                     value );
    }
New to GrepCode? Check out our FAQ X