};
String lbl = "<div class='x-form-field'>" + HumanReadable.getCEDisplayName("from accumulate") + "</div>";
DirtyableFlexTable panel = new DirtyableFlexTable();
int r = 0;
if (pattern.getFactPattern() == null) {
panel.setWidget(r++, 0, new ClickableLabel("<br> <font color='red'>" + constants.clickToAddPattern() + "</font>", leftPatternclick, !this.readOnly));
}
panel.setWidget(r++, 0, new HTML(lbl));
if (this.getFromAccumulatePattern().getSourcePattern() == null) {
panel.setWidget(r++, 0, new ClickableLabel("<br> <font color='red'>" + constants.clickToAddPattern() + "</font>", sourcePatternClick, !this.readOnly));
} else {
IPattern rPattern = this.getFromAccumulatePattern().getSourcePattern();
if (rPattern instanceof FactPattern) {
this.sourcePatternWidget = new FactPatternWidget(this.getModeller(), rPattern, constants.All0with(), true,this.readOnly);
} else if (rPattern instanceof FromAccumulateCompositeFactPattern) {
this.sourcePatternWidget = new FromAccumulateCompositeFactPatternWidget(this.getModeller(), (FromAccumulateCompositeFactPattern) rPattern,this.readOnly);
} else if (rPattern instanceof FromCollectCompositeFactPattern) {
this.sourcePatternWidget = new FromCollectCompositeFactPatternWidget(this.getModeller(), (FromCollectCompositeFactPattern) rPattern,this.readOnly);
} else if (rPattern instanceof FromCompositeFactPattern) {
this.sourcePatternWidget = new FromCompositeFactPatternWidget(this.getModeller(), (FromCompositeFactPattern) rPattern,this.readOnly);
} else {
throw new IllegalArgumentException("Unsuported pattern " + rPattern + " for right side of FROM ACCUMULATE");
}
this.sourcePatternWidget.addOnModifiedCommand(new Command() {
public void execute() {
setModified(true);
}
});
panel.setWidget(r++,
0,
addRemoveButton(this.sourcePatternWidget, new ClickListener() {
public void onClick(Widget sender) {
if (Window.confirm(constants.RemoveThisBlockOfData())) {
setModified(true);
getFromAccumulatePattern().setSourcePattern(null);
getModeller().refreshWidget();
}
}
}));
}
TabPanel tPanel = new TabPanel();
DirtyableFlexTable codeTable = new DirtyableFlexTable();
int codeTableRow = 0;
int codeTableCol = 0;
codeTable.setWidget(codeTableRow, codeTableCol++, new HTML("<div class='x-form-field'>Init:</div>"));
final TextBox initField = new TextBox();
initField.setTitle("init code");
initField.setText(getFromAccumulatePattern().getInitCode());
codeTable.setWidget(codeTableRow++, codeTableCol--, initField);
codeTable.setWidget(codeTableRow, codeTableCol++, new HTML("<div class='x-form-field'>Action:</div>"));
final TextBox actionField = new TextBox();
actionField.setTitle("action code");
actionField.setText(getFromAccumulatePattern().getActionCode());
codeTable.setWidget(codeTableRow++, codeTableCol--, actionField);
codeTable.setWidget(codeTableRow, codeTableCol++, new HTML("<div class='x-form-field'>Reverse:</div>"));
final TextBox reverseField = new TextBox();
reverseField.setTitle("reverse code.");
reverseField.setText(getFromAccumulatePattern().getReverseCode());
codeTable.setWidget(codeTableRow++, codeTableCol--, reverseField);
codeTable.setWidget(codeTableRow, codeTableCol++, new HTML("<div class='x-form-field'>Result:</div>"));
final TextBox resultField = new TextBox();
resultField.setTitle("result code");
resultField.setText(getFromAccumulatePattern().getResultCode());
codeTable.setWidget(codeTableRow++, codeTableCol--, resultField);
//panel.setWidget(r++, 0, codeTable);
Panel codePanel = new Panel();
codePanel.setAutoWidth(true);
codePanel.setClosable(false);
codePanel.setTitle("Custom Code");
codePanel.setAutoHeight(true);
codePanel.add(codeTable);
codePanel.setDisabled(this.readOnly);
tPanel.add(codePanel);
DirtyableFlexTable functionTable = new DirtyableFlexTable();
functionTable.setWidget(0, 0, new HTML("<div class='x-form-field'>Function:</div>"));
final TextBox functionField = new TextBox();
functionField.setTitle("function code");
functionField.setText(getFromAccumulatePattern().getFunction());
functionTable.setWidget(0, 1, functionField);
// panel.setWidget(r++, 0, functionTable);
Panel functionPanel = new Panel();
functionPanel.setAutoWidth(true);