Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * 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
   *
   *      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.moduleeditor;
 
 
 
This is the module editor.
 
 public class ModuleEditorWrapper extends Composite {
     private ConstantsCore constants = GWT.create(ConstantsCore.class);
 
     private Module packageConfigData;
     private boolean isHistoricalReadOnly = false;
 
     VerticalPanel layout = new VerticalPanel();
     private final ClientFactory clientFactory;
     private final EventBus eventBus;
 
     public ModuleEditorWrapper(Module data,
                                ClientFactory clientFactory,
                                EventBus eventBus) {
         this(dataclientFactoryeventBusfalse);
     }
 
     public ModuleEditorWrapper(Module data,
                                ClientFactory clientFactory,
                                EventBus eventBus,
                                boolean isHistoricalReadOnly) {
         this. = data;
         this. = clientFactory;
         this. = eventBus;
         this. = isHistoricalReadOnly;
 
         initWidget();        
         setRefreshHandler();
         render();
         setWidth("100%");
     }
 
     private void render() {
         final TabPanel tPanel = new TabPanel();
         tPanel.setWidth("100%");
 
         ArtifactEditor artifactEditor = new ArtifactEditor(this.);
 
         Command refreshCommand = new Command() {
             public void execute() {
                 refresh();
             }
         };        
         
         .clear();
         
         .add(actionToolBar);
 
         AssetViewerActivity assetViewerActivity = new AssetViewerActivity(.getUuid(),
                 );
         assetViewerActivity.start(new AcceptItem() {
                     public void add(String tabTitleIsWidget widget) {
                         ScrollPanel pnl = new ScrollPanel();
                         pnl.setWidth("100%");
                         pnl.add(widget);
                         tPanel.add(pnl.Assets());
                     }
                 }, null);
 
         ScrollPanel pnl = new ScrollPanel();
         pnl.setWidth("100%");
        pnl.add(artifactEditor);
        tPanel.add(pnl.AttributeForModuleEditor());
        tPanel.selectTab(0);
        pnl = new ScrollPanel();
        pnl.setWidth("100%");
        pnl.add(moduleEditor);
        tPanel.add(pnl.Edit());
        tPanel.selectTab(0);
        tPanel.setHeight("100%");
        .add(tPanel);
        .setHeight("100%");
    }
    
    
Will refresh all the data.
    public void refresh() {
        LoadingPopup.showMessage(.RefreshingPackageData());
        ModuleServiceAsync moduleService = GWT.create(ModuleService.class);
        moduleService.loadModule(this..getUuid(),
                new GenericCallback<Module>() {
                    public void onSuccess(Module data) {
                        LoadingPopup.close();
                         = data;
                        render();
                    }
                });
    }
    
    private void setRefreshHandler() {
                new RefreshModuleEditorEvent.Handler() {
                    public void onRefreshModule(
                            RefreshModuleEditorEvent refreshModuleEditorEvent) {
                        String moduleUUID = refreshModuleEditorEvent.getUuid();
                        if(moduleUUID!=null && moduleUUID.equals(.getUuid())) {
                            refresh();                                
                        }
                    
                    }
                });
    }
New to GrepCode? Check out our FAQ X