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.ruleeditor;
 
 import  org.drools.guvnor.client.common.ErrorPopup;
 import  org.drools.guvnor.client.common.FormStyleLayout;
 import  org.drools.guvnor.client.common.FormStylePopup;
 import  org.drools.guvnor.client.common.LoadingPopup;
 import  org.drools.guvnor.client.rpc.RuleAsset;
 import  org.drools.guvnor.client.rpc.RuleFlowContentModel;
 import  org.drools.guvnor.client.rulefloweditor.RuleFlowViewer;
 import  org.drools.guvnor.client.explorer.Preferences;
 import  org.drools.guvnor.client.messages.Constants;
 
 import  com.google.gwt.user.client.Window;
 import  com.google.gwt.user.client.ui.Composite;
 import  com.google.gwt.user.client.ui.ScrollPanel;
 import  com.google.gwt.user.client.ui.VerticalPanel;
 import  com.google.gwt.core.client.GWT;
 import  com.gwtext.client.core.EventObject;
 import  com.gwtext.client.widgets.Panel;
 import  com.gwtext.client.widgets.Toolbar;
 import  com.gwtext.client.widgets.ToolbarButton;
 import  com.gwtext.client.widgets.event.ButtonListenerAdapter;

Author(s):
Toni Rikkola
 
 public class RuleFlowWrapper extends Composite implements SaveEventListener {
 
 	private RuleViewer viewer;
 	private RuleAsset asset;
 
 	private RuleFlowViewer ruleFlowViewer;
 	private Panel parameterPanel;
 	private Constants constants = ((Constants) GWT.create(Constants.class));
 
 	public RuleFlowWrapper(final RuleAsset assetfinal RuleViewer viewer) {
 		this. = viewer;
 		this. = asset;
 		initWidgets(asset.uuid, asset.metaData.name);
 	}
 
 	protected void initWidgets(final String uuidString formName) {
 
 
 		VerticalPanel panel = new VerticalPanel();
 		panel.add(uploadWidget);
 
 		if (Preferences.getBooleanPref("visual-ruleflow")) {
 
 			if ( != null &&  != null) {
 				Toolbar tb = new Toolbar();
 
 				ToolbarButton viewSource = new ToolbarButton();
 				viewSource.setText(.OpenEditorInNewWindow());
 				viewSource.addListener(new ButtonListenerAdapter() {
 					public void onClick(
 							com.gwtext.client.widgets.Button button,
 							EventObject e) {
 
 						.update();
 					}
 				});
 
 				tb.addButton(viewSource);
 				panel.add(tb);
 
 			}
 		}
 
 		initWidget(panel);
 
 	}
 
 	private void doViewDiagram() {
 		LoadingPopup.showMessage(.CalculatingSource());
		try {
			FormStylePopup pop = new FormStylePopup("images/view_source.gif"// NON-NLS
					.ViewingDiagram(), new Integer(800), .);
			pop.addRow(new ScrollPanel());
			pop.addRow();
			pop.show();
catch (Exception e) {
			ErrorPopup
					.showMessage(
							.CouldNotCreateTheRuleflowDiagramItIsPossibleThatTheRuleflowFileIsInvalid());
		}
		LoadingPopup.close();
	}
	private void initRuleflowViewer() {
		RuleFlowContentModel rfcm = (RuleFlowContentModel) .;
		if (rfcm != null && rfcm.getXml() != null && rfcm.getNodes() != null) {
			try {
				 = new Panel();
				.setCollapsible(true);
				.setTitle(.Parameters());
				FormStyleLayout parametersForm = new FormStyleLayout();
				parametersForm.setHeight("120px"); // NON-NLS
				.add(parametersForm);
				 = new RuleFlowViewer(rfcmparametersForm);
catch (Exception e) {
				Window.alert(e.toString());
			}
else if (rfcm != null && rfcm.getXml() == null) {
			// If the XML is not set there was some problem when the diagram was
			// created.
			Window
					.alert(
							.CouldNotCreateTheRuleflowDiagramItIsPossibleThatTheRuleflowFileIsInvalid());
		}
	}
	public String getIcon() {
		return "images/ruleflow_large.png"// NON-NLS
	}
		return "decision-Table-upload"// NON-NLS
	}
	public void onAfterSave() {
	}
	public void onSave() {
		RuleFlowContentModel rfcm = (RuleFlowContentModel) .;
		rfcm.setNodes(.getTransferNodes());
	}
	public RuleFlowViewer getRuleFlowViewer() {
	}
New to GrepCode? Check out our FAQ X