Skip to content
Snippets Groups Projects
Commit 3e39d021 authored by Jens Bendisposto's avatar Jens Bendisposto
Browse files

Merge remote-tracking branch 'origin/develop' into develop

parents d7423698 83c7dec9
No related branches found
No related tags found
No related merge requests found
Showing
with 367 additions and 295 deletions
......@@ -9,20 +9,17 @@ package de.bmotionstudio.gef.editor.observer;
import java.util.ArrayList;
import java.util.List;
import de.bmotionstudio.gef.editor.Animation;
import de.bmotionstudio.gef.editor.AttributeConstants;
import de.bmotionstudio.gef.editor.animation.AnimationMove;
import de.bmotionstudio.gef.editor.internal.Animation;
import de.bmotionstudio.gef.editor.model.BControl;
import de.bmotionstudio.gef.editor.observer.wizard.WizardObserverSwitchCoordinates;
import de.bmotionstudio.gef.editor.util.BMSUtil;
public class SwitchCoordinates extends Observer {
private List<ToggleObjectCoordinates> toggleObjects;
// private transient AnimationListener animationListener;
// private transient Boolean checked;
public SwitchCoordinates() {
toggleObjects = new ArrayList<ToggleObjectCoordinates>();
}
......@@ -31,27 +28,6 @@ public class SwitchCoordinates extends Observer {
boolean set = false;
// if (checked == null)
// checked = true;
// if (animationListener == null) {
// animationListener = new AnimationListener() {
// public void animationStopped(AnimationEvent evt) {
// setCallBack(true);
// checked = true;
// // System.out
// // .println("Animation stopped ---> Set callback to TRUE!");
// }
//
// public void animationStarted(AnimationEvent evt) {
// setCallBack(false);
// checked = false;
// // System.out
// // .println("Animation started ---> Set callback to FALSE!");
// }
// };
// }
// Collect evaluate predicate objects in list
for (ToggleObjectCoordinates obj : toggleObjects) {
......@@ -60,8 +36,8 @@ public class SwitchCoordinates extends Observer {
// First evaluate predicate (predicate field)
String bolValue = "true";
if (obj.getEval().length() > 0) {
bolValue = parsePredicate(obj.getEval(), control, animation,
obj);
bolValue = BMSUtil.parsePredicate(obj.getEval(), control,
animation);
}
if (!obj.hasError() && Boolean.valueOf(bolValue)) {
......@@ -70,21 +46,21 @@ public class SwitchCoordinates extends Observer {
int parsedY = 0;
// Handle X field
try {
parsedX = Integer.valueOf(parseExpression(obj.getX(),
false, control, animation, obj, false));
parsedX = Integer.valueOf(BMSUtil.parseExpression(
obj.getX(), control, animation));
} catch (NumberFormatException n) {
obj.setHasError(true);
addError(control, animation, "x is not a valid integer: "
+ n.getMessage());
// addError(control, animation, "x is not a valid integer: "
// + n.getMessage());
}
// Handle Y field
try {
parsedY = Integer.valueOf(parseExpression(obj.getY(),
false, control, animation, obj, false));
parsedY = Integer.valueOf(BMSUtil.parseExpression(
obj.getY(), control, animation));
} catch (NumberFormatException n) {
obj.setHasError(true);
addError(control, animation, "y is not a valid integer: "
+ n.getMessage());
// addError(control, animation, "y is not a valid integer: "
// + n.getMessage());
}
int currentX = Integer.valueOf(control.getAttributeValue(
......
......@@ -12,10 +12,11 @@ import java.util.List;
import org.eclipse.core.resources.IFile;
import de.bmotionstudio.gef.editor.Animation;
import de.bmotionstudio.gef.editor.AttributeConstants;
import de.bmotionstudio.gef.editor.internal.Animation;
import de.bmotionstudio.gef.editor.model.BControl;
import de.bmotionstudio.gef.editor.observer.wizard.WizardObserverSwitchImage;
import de.bmotionstudio.gef.editor.util.BMSUtil;
public class SwitchImage extends Observer {
......@@ -37,8 +38,8 @@ public class SwitchImage extends Observer {
// First evaluate predicate (predicate field)
String bolValue = "true";
if (obj.getEval().length() > 0) {
bolValue = parsePredicate(obj.getEval(), control, animation,
obj);
bolValue = BMSUtil.parsePredicate(obj.getEval(), control,
animation);
}
if (!obj.hasError() && Boolean.valueOf(bolValue)) {
......@@ -46,16 +47,16 @@ public class SwitchImage extends Observer {
String fImage = obj.getImage();
if (obj.isExpressionMode()) { // Expression mode
fImage = parseExpression(obj.getImage(), control,
animation, obj);
fImage = BMSUtil.parseExpression(obj.getImage(), control,
animation);
}
IFile pFile = control.getVisualization().getProjectFile();
String myPath = (pFile.getProject().getLocation() + "/images/" + fImage)
.replace("file:", "");
if (!new File(myPath).exists()) {
addError(control, animation,
"No such image in your library: " + fImage);
// addError(control, animation,
// "No such image in your library: " + fImage);
}
if (!obj.hasError()) {
......
/**
* (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen,
* Heinrich Heine Universitaet Duesseldorf
* This software is licenced under EPL 1.0 (http://www.eclipse.org/org/documents/epl-v10.html)
* */
package de.bmotionstudio.gef.editor.observer.wizard;
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.beans.BeansObservables;
import org.eclipse.core.databinding.observable.list.WritableList;
import org.eclipse.core.databinding.observable.map.IObservableMap;
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
import org.eclipse.jface.databinding.viewers.ObservableMapLabelProvider;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITableColorProvider;
import org.eclipse.jface.viewers.ITableFontProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import de.bmotionstudio.gef.editor.BMotionStudioImage;
import de.bmotionstudio.gef.editor.EditorImageRegistry;
import de.bmotionstudio.gef.editor.edit.PredicateEditingSupport;
import de.bmotionstudio.gef.editor.edit.TextEditingSupport;
import de.bmotionstudio.gef.editor.model.BControl;
import de.bmotionstudio.gef.editor.observer.CloneObserver;
import de.bmotionstudio.gef.editor.observer.Observer;
import de.bmotionstudio.gef.editor.observer.ObserverCloneObject;
import de.bmotionstudio.gef.editor.observer.ObserverWizard;
/**
* @author Lukas Ladenberger
*
*/
public class WizardObserverClone extends ObserverWizard {
public WizardObserverClone(BControl control, Observer observer) {
super(control, observer);
addPage(new WizardObserverClonePage("WizardObserverClonePage"));
}
private class WizardObserverClonePage extends WizardPage {
private TableViewer tableViewer;
protected WizardObserverClonePage(String pageName) {
super(pageName);
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt
* .widgets.Composite)
*/
@Override
public void createControl(Composite parent) {
DataBindingContext dbc = new DataBindingContext();
Composite container = new Composite(parent, SWT.NONE);
container.setLayout(new GridLayout(1, true));
setControl(container);
tableViewer = new TableViewer(container, SWT.BORDER
| SWT.FULL_SELECTION);
tableViewer.getTable().setLinesVisible(true);
tableViewer.getTable().setHeaderVisible(true);
tableViewer.getTable().setLayoutData(
new GridData(GridData.FILL_BOTH));
tableViewer.getTable().setFont(
new Font(Display.getDefault(), new FontData("Arial", 10,
SWT.NONE)));
TableViewerColumn column = new TableViewerColumn(tableViewer,
SWT.NONE);
column.getColumn().setText("Expression");
column.getColumn().setWidth(200);
column.setEditingSupport(new PredicateEditingSupport(tableViewer,
dbc, "eval", getBControl().getVisualization(), getShell()));
column = new TableViewerColumn(tableViewer, SWT.NONE);
column.getColumn().setText("Control");
column.getColumn().setWidth(175);
column.setEditingSupport(new TextEditingSupport(tableViewer, dbc,
"controlId"));
column = new TableViewerColumn(tableViewer, SWT.NONE);
column.getColumn().setText("Count from");
column.getColumn().setWidth(125);
column.setEditingSupport(new TextEditingSupport(tableViewer, dbc,
"counter"));
ObservableListContentProvider contentProvider = new ObservableListContentProvider();
tableViewer.setContentProvider(contentProvider);
tableViewer.setLabelProvider(new ObserverLabelProvider(
BeansObservables.observeMaps(
contentProvider.getKnownElements(), new String[] {
"eval", "controlId", "counter" })));
final WritableList input = new WritableList(
((CloneObserver) getObserver()).getObserverCloneObjects(),
ObserverCloneObject.class);
tableViewer.setInput(input);
Composite comp = new Composite(container, SWT.NONE);
comp.setLayout(new RowLayout());
comp.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
Button btRemove = new Button(comp, SWT.PUSH);
btRemove.setText("Remove");
btRemove.setImage(BMotionStudioImage
.getImage(EditorImageRegistry.IMG_ICON_DELETE));
btRemove.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (tableViewer.getSelection().isEmpty()) {
return;
}
ObserverCloneObject obj = (ObserverCloneObject) ((IStructuredSelection) tableViewer
.getSelection()).getFirstElement();
input.remove(obj);
}
});
Button btAdd = new Button(comp, SWT.PUSH);
btAdd.setText("Add");
btAdd.setImage(BMotionStudioImage
.getImage(EditorImageRegistry.IMG_ICON_ADD));
btAdd.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ObserverCloneObject obj = new ObserverCloneObject();
input.add(obj);
}
});
}
}
/*
* (non-Javadoc)
*
* @see
* de.bmotionstudio.gef.editor.observer.ObserverWizard#prepareToFinish()
*/
@Override
protected Boolean prepareToFinish() {
if (((CloneObserver) getObserver()).getObserverCloneObjects().size() == 0) {
setObserverDelete(true);
} else {
for (ObserverCloneObject obj : ((CloneObserver) getObserver())
.getObserverCloneObjects()) {
if (obj.getEval() == null || obj.getControlId() == null) {
MessageDialog
.openError(getShell(), "Please check your entries",
"Please check your entries. The eval and control field must not be empty.");
return false;
}
}
}
return true;
}
/*
* (non-Javadoc)
*
* @see de.bmotionstudio.gef.editor.observer.ObserverWizard#getSize()
*/
@Override
public Point getSize() {
return new Point(700, 500);
}
private static class ObserverLabelProvider extends
ObservableMapLabelProvider implements ITableLabelProvider,
ITableColorProvider, ITableFontProvider {
public ObserverLabelProvider(IObservableMap[] attributeMaps) {
super(attributeMaps);
}
private final Color errorColor = Display.getDefault().getSystemColor(
SWT.COLOR_INFO_BACKGROUND);
@Override
public Image getColumnImage(Object element, int columnIndex) {
return null;
}
@Override
public String getColumnText(Object element, int columnIndex) {
ObserverCloneObject obj = (ObserverCloneObject) element;
if (columnIndex == 0) {
return obj.getEval();
}
if (columnIndex == 1) {
return obj.getControlId();
}
return super.getColumnText(element, columnIndex);
}
public Color getBackground(final Object element, final int column) {
ObserverCloneObject obj = (ObserverCloneObject) element;
if (obj.hasError())
return errorColor;
return null;
}
public Color getForeground(final Object element, final int column) {
return null;
}
public Font getFont(final Object element, final int column) {
// return JFaceResources.getFontRegistry().get(
// BMotionStudioConstants.RODIN_FONT_KEY);
return null;
}
}
}
/**
* (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen,
* Heinrich Heine Universitaet Duesseldorf
* This software is licenced under EPL 1.0 (http://www.eclipse.org/org/documents/epl-v10.html)
* */
package de.bmotionstudio.gef.editor.observer.wizard;
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.beans.BeansObservables;
import org.eclipse.jface.databinding.swt.SWTObservables;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import de.bmotionstudio.gef.editor.model.BControl;
import de.bmotionstudio.gef.editor.observer.ExternalObserverScript;
import de.bmotionstudio.gef.editor.observer.Observer;
import de.bmotionstudio.gef.editor.observer.ObserverWizard;
public class WizardObserverExternalObserverScript extends ObserverWizard {
private class ObserverExternalObserverScriptPage extends WizardPage {
private Text txtScriptPath;
protected ObserverExternalObserverScriptPage(final String pageName) {
super(pageName);
}
public Text getTxtScriptPath() {
return txtScriptPath;
}
public void createControl(final Composite parent) {
final DataBindingContext dbc = new DataBindingContext();
Composite container = new Composite(parent, SWT.NONE);
container.setLayoutData(new GridData(GridData.FILL_BOTH));
container.setLayout(new GridLayout(2, false));
Label lb = new Label(container, SWT.NONE);
lb.setText("Script File:");
txtScriptPath = new Text(container, SWT.BORDER);
txtScriptPath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
txtScriptPath.setFont(new Font(Display.getDefault(), new FontData(
"Arial", 10, SWT.NONE)));
initBindings(dbc);
setControl(container);
}
private void initBindings(DataBindingContext dbc) {
dbc.bindValue(
SWTObservables.observeText(txtScriptPath, SWT.Modify),
BeansObservables.observeValue(
(ExternalObserverScript) getObserver(),
"scriptPath"));
}
}
public WizardObserverExternalObserverScript(BControl bcontrol,
Observer bobserver) {
super(bcontrol, bobserver);
addPage(new ObserverExternalObserverScriptPage(
"ObserverExternalObserverScriptPage"));
}
@Override
protected Boolean prepareToFinish() {
ObserverExternalObserverScriptPage page = (ObserverExternalObserverScriptPage) getPage("ObserverExternalObserverScriptPage");
String errorStr = "";
if (page.getTxtScriptPath().getText().length() == 0)
errorStr += "Please enter a path for a script file.\n";
if (errorStr.length() > 0) {
MessageDialog.openError(Display.getDefault().getActiveShell(),
"An Error occured", errorStr);
return false;
}
return true;
}
@Override
public Point getSize() {
return new Point(600, 500);
}
}
......@@ -10,9 +10,10 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import de.bmotionstudio.gef.editor.internal.Animation;
import de.bmotionstudio.gef.editor.Animation;
import de.bmotionstudio.gef.editor.model.BControl;
import de.bmotionstudio.gef.editor.scheduler.wizard.WizardExecuteScheduler;
import de.bmotionstudio.gef.editor.util.BMSUtil;
import de.prob.core.Animator;
import de.prob.core.command.ExecuteOperationCommand;
import de.prob.core.command.GetCurrentStateIdCommand;
......@@ -45,8 +46,8 @@ public class ExecuteAnimationScript extends SchedulerEvent {
// First evaluate predicate (predicate field)
// If true (execute operation sequence)
if (Boolean.valueOf(parsePredicate(obj.getPredicate(), control,
animation, null))) {
if (Boolean.valueOf(BMSUtil.parsePredicate(obj.getPredicate(),
control, animation))) {
for (AnimationScriptStep step : obj.getSteps()) {
......@@ -55,7 +56,7 @@ public class ExecuteAnimationScript extends SchedulerEvent {
String currentState = GetCurrentStateIdCommand
.getID(animator);
List<Operation> operations = parseOperation(
List<Operation> operations = BMSUtil.parseOperation(
step.getCommand(), step.getParameter(),
step.getMaxrandom(), animation, currentState,
control);
......
......@@ -9,9 +9,10 @@ package de.bmotionstudio.gef.editor.scheduler;
import java.util.List;
import java.util.Random;
import de.bmotionstudio.gef.editor.internal.Animation;
import de.bmotionstudio.gef.editor.Animation;
import de.bmotionstudio.gef.editor.model.BControl;
import de.bmotionstudio.gef.editor.scheduler.wizard.WizardExecuteOperationByPredicate;
import de.bmotionstudio.gef.editor.util.BMSUtil;
import de.prob.core.Animator;
import de.prob.core.command.ExecuteOperationCommand;
import de.prob.core.command.GetCurrentStateIdCommand;
......@@ -39,7 +40,7 @@ public class ExecuteOperationByPredicate extends SchedulerEvent {
String currentState = GetCurrentStateIdCommand
.getID(animator);
List<Operation> operations = parseOperation(
List<Operation> operations = BMSUtil.parseOperation(
predicateOperation.getOperationName(),
predicateOperation.getPredicate(),
predicateOperation.getMaxrandom(), animation,
......
......@@ -2,10 +2,11 @@ package de.bmotionstudio.gef.editor.scheduler;
import java.util.ArrayList;
import de.bmotionstudio.gef.editor.Animation;
import de.bmotionstudio.gef.editor.BindingObject;
import de.bmotionstudio.gef.editor.internal.Animation;
import de.bmotionstudio.gef.editor.model.BControl;
import de.bmotionstudio.gef.editor.scheduler.wizard.WizardExecuteOperationByPredicateMulti;
import de.bmotionstudio.gef.editor.util.BMSUtil;
public class ExecuteOperationByPredicateMulti extends SchedulerEvent {
......@@ -27,8 +28,8 @@ public class ExecuteOperationByPredicateMulti extends SchedulerEvent {
.getExecutePredicate();
if (executePredicate.length() > 0) {
bolValue = parsePredicate(executePredicate, control, animation,
null);
bolValue = BMSUtil.parsePredicate(executePredicate, control,
animation);
}
if (Boolean.valueOf(bolValue)) { // If true
......
......@@ -9,8 +9,8 @@ package de.bmotionstudio.gef.editor.scheduler;
import org.eclipse.core.runtime.IConfigurationElement;
import de.bmotionstudio.gef.editor.AbstractExpressionControl;
import de.bmotionstudio.gef.editor.Animation;
import de.bmotionstudio.gef.editor.BMotionEditorPlugin;
import de.bmotionstudio.gef.editor.internal.Animation;
import de.bmotionstudio.gef.editor.model.BControl;
/**
......
package de.bmotionstudio.gef.editor.util;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import de.be4.classicalb.core.parser.exceptions.BException;
import de.bmotionstudio.gef.editor.Animation;
import de.bmotionstudio.gef.editor.AttributeConstants;
import de.bmotionstudio.gef.editor.model.BControl;
import de.prob.core.command.EvaluationGetValuesCommand;
import de.prob.core.command.GetOperationByPredicateCommand;
import de.prob.core.domainobjects.EvaluationElement;
import de.prob.core.domainobjects.EvaluationStateElement;
import de.prob.core.domainobjects.Operation;
import de.prob.core.domainobjects.State;
import de.prob.exceptions.ProBException;
import de.prob.parserbase.ProBParseException;
public class BMSUtil {
private static final Pattern PATTERN = Pattern.compile("\\$(.+?)\\$");
// private static Boolean hasError = false;
private static final String DEFAULT_PREDICATE = "1=1";
private static final String DEFAULT_BOOLVAL = "true";
public static String parseExpression(String expressionString,
BControl control, Animation animation) {
return parseExpression(expressionString, control, animation, false,
true);
}
public static String parseExpression(final String expressionString,
final BControl control, final Animation animation,
boolean parseControls) {
return parseExpression(expressionString, control, animation, false,
parseControls);
}
public static String parsePredicate(String expressionString,
BControl control, Animation animation) {
return parsePredicate(expressionString, control, animation, true);
}
public static String parsePredicate(String expressionString,
BControl control, Animation animation, boolean parseControls) {
if (expressionString == null || expressionString.trim().length() == 0)
return DEFAULT_BOOLVAL;
return parseExpression(expressionString, control, animation, true,
parseControls);
}
private static String parseExpression(String expressionString,
BControl control, Animation animation, boolean isPredicate,
boolean parseControls) {
boolean hasError = false;
boolean hasSubExpressions = false;
Map<EvaluationElement, String> evaluationKeys = new HashMap<EvaluationElement, String>();
// Find expressions and collect ExpressionEvalElements
final Matcher matcher = PATTERN.matcher(expressionString);
while (matcher.find()) {
final String subExpr = matcher.group(1);
collectEvalElements(subExpr, "$" + subExpr + "$", isPredicate,
animation, control, evaluationKeys, parseControls);
hasSubExpressions = true;
}
// We have only one expression (without "$$")
if (!hasSubExpressions) {
collectEvalElements(expressionString, expressionString,
isPredicate, animation, control, evaluationKeys,
parseControls);
}
// Try to get expression results and parse expression string
Collection<EvaluationStateElement> resultList;
try {
resultList = getExpressionValues(control, animation,
new ArrayList<EvaluationElement>(evaluationKeys.keySet()));
} catch (ProBException e) {
resultList = Collections.emptyList();
hasError = true;
}
// If getting ExpressionEvalElement throws no error, try to get
// expression results
String result = expressionString;
if (!hasError) {
for (EvaluationStateElement stateElement : resultList) {
final EvaluationElement evalElement = stateElement.getElement();
final String text;
if (isPredicate) {
text = stateElement.getResult().isPredicateTrue() ? "true"
: "false";
} else {
text = stateElement.getText();
}
final String subExpression = evaluationKeys.get(evalElement);
result = result.replace(subExpression, text);
}
} else {
// if (obj != null)
// obj.setHasError(true);
// addError(control, animation,
// "An error occurred while evaluating expression\\predicate value: \""
// + expressionString
// + "\". Please check your expression\\predicate.");
}
return result;
}
private static boolean collectEvalElements(final String subexpression,
final String key, final boolean isPredicate,
final Animation animation, final BControl control,
final Map<EvaluationElement, String> evaluationKeys,
final boolean parseControls) {
String parsedSubexpr = subexpression;
if(parseControls)
parsedSubexpr = parseControls(parsedSubexpr, control);
EvaluationElement evalElement;
try {
evalElement = animation.getCachedEvalElement(parsedSubexpr,
isPredicate);
evaluationKeys.put(evalElement, key);
return true;
} catch (UnsupportedOperationException e) {
return false;
} catch (ProBException e) {
return false;
} catch (ProBParseException e) {
// addError(control, animation, e.getMessage());
return false;
}
}
public static String parseControls(String expressionString,
BControl control) {
List<String> allControlIDs = control.getVisualization()
.getAllBControlNames();
// Search for control ids
Pattern cPattern = Pattern.compile("(\\w+)");
Matcher cMatcher = cPattern.matcher(expressionString);
while (cMatcher.find()) {
String controlID = cMatcher.group(1);
if (controlID.equals("this")) {
expressionString = expressionString.replace(controlID, control
.getAttributeValue(AttributeConstants.ATTRIBUTE_CUSTOM)
.toString());
} else if (allControlIDs.contains(controlID)) {
expressionString = expressionString.replace(controlID, control
.getVisualization().getBControl(controlID)
.getValueOfData());
} else {
// TODO: Return error if no control exists
}
}
return expressionString;
}
private static Collection<EvaluationStateElement> getExpressionValues(
final BControl control, final Animation animation,
final Collection<EvaluationElement> evalElements)
throws ProBException {
final State state = animation.getAnimator().getCurrentState();
// TODO[DP, 11.04.2011] Add an animator to the parameters!
final Collection<EvaluationStateElement> values = EvaluationGetValuesCommand
.getValuesForExpressionsCached(state, evalElements);
return values;
}
public static List<Operation> parseOperation(final String opName,
String opPredicate, int opRandom, final Animation animation,
final String currentState, final BControl control) {
try {
if (opPredicate != null && opPredicate.length() > 0)
opPredicate = parseControls(opPredicate, control);
else
opPredicate = DEFAULT_PREDICATE;
if (opRandom < 1)
opRandom = 1;
return GetOperationByPredicateCommand.getOperations(
animation.getAnimator(), currentState, opName, opPredicate,
opRandom);
} catch (ProBException e) {
} catch (BException e) {
}
return null;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment