use of org.applause.lang.applauseDsl.Screen in project applause by applause.
the class ScreenCompiler method doGenerate.
public void doGenerate(final Resource resource, final IFileSystemAccess fsa) {
TreeIterator<EObject> _allContents = resource.getAllContents();
Iterable<EObject> _iterable = IteratorExtensions.<EObject>toIterable(_allContents);
Iterable<Screen> _filter = Iterables.<Screen>filter(_iterable, Screen.class);
final Procedure1<Screen> _function = new Procedure1<Screen>() {
public void apply(final Screen it) {
ScreenKind _kind = it.getKind();
final ScreenKind getKind = _kind;
boolean _matched = false;
if (!_matched) {
if (Objects.equal(getKind, ScreenKind.DEFAULT_LIST)) {
_matched = true;
ScreenCompiler.this.defaultListScreenCompiler.doGenerate(it, fsa);
}
}
if (!_matched) {
if (Objects.equal(getKind, ScreenKind.DEFAULT_DETAILS)) {
_matched = true;
ScreenCompiler.this.defaultDetailsScreenCompiler.doGenerate(it, fsa);
}
}
}
};
IterableExtensions.<Screen>forEach(_filter, _function);
}
use of org.applause.lang.applauseDsl.Screen in project applause by applause.
the class DefaultListScreenActionCompiler method compileActionButton.
private CharSequence compileActionButton(final UIAction it) {
CharSequence _xifexpression = null;
UIActionSpecification _action = it.getAction();
if ((_action instanceof UIActionNavigateAction)) {
CharSequence _switchResult = null;
UIActionSpecification _action_1 = it.getAction();
ActionVerb _actionVerb = ((UIActionNavigateAction) _action_1).getActionVerb();
final ActionVerb _switchValue = _actionVerb;
boolean _matched = false;
if (!_matched) {
if (Objects.equal(_switchValue, ActionVerb.ADD)) {
_matched = true;
Screen _screen = this._defaultListScreenClassExtensions.screen(it);
CharSequence _compileActionButton_AddItem = this.compileActionButton_AddItem(_screen);
_switchResult = _compileActionButton_AddItem;
}
}
_xifexpression = _switchResult;
}
return _xifexpression;
}
use of org.applause.lang.applauseDsl.Screen in project applause by applause.
the class DefaultListScreenActionCompiler method compileActionMethod_EditItem.
private CharSequence compileActionMethod_EditItem(final Screen it) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("- (void)onEditItem:(");
Entity _resourceType = this._defaultListScreenClassExtensions.resourceType(it);
String _typeName = this._typeExtensions.typeName(_resourceType);
_builder.append(_typeName, "");
_builder.append(" *)item");
_builder.newLineIfNotEmpty();
_builder.append("{");
_builder.newLine();
_builder.append("\t");
_builder.append("[");
Screen _targetNavigationScreen = this._defaultListScreenClassExtensions.targetNavigationScreen(it);
String _controllerClassName = this._defaultListScreenClassExtensions.controllerClassName(_targetNavigationScreen);
_builder.append(_controllerClassName, " ");
_builder.append(" presentForEditingItem:item fromParent:self onDone:^(");
Entity _resourceType_1 = this._defaultListScreenClassExtensions.resourceType(it);
String _typeName_1 = this._typeExtensions.typeName(_resourceType_1);
_builder.append(_typeName_1, " ");
_builder.append(" *editedItem)");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("{");
_builder.newLine();
_builder.append("\t\t");
_builder.append("[self refresh];");
_builder.newLine();
_builder.append("\t");
_builder.append("}];");
_builder.newLine();
_builder.newLine();
_builder.append("}");
_builder.newLine();
return _builder;
}
use of org.applause.lang.applauseDsl.Screen in project applause by applause.
the class DefaultListScreenActionCompiler method compileActionMethod_AddItem.
private CharSequence compileActionMethod_AddItem(final Screen it) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("- (void)onAddItem");
_builder.newLine();
_builder.append("{");
_builder.newLine();
_builder.append("\t");
_builder.append("[");
Screen _targetNavigationScreen = this._defaultListScreenClassExtensions.targetNavigationScreen(it);
String _controllerClassName = this._defaultListScreenClassExtensions.controllerClassName(_targetNavigationScreen);
_builder.append(_controllerClassName, " ");
_builder.append(" presentForAddingNewItemFromParent:self onDone:^(");
Entity _resourceType = this._defaultListScreenClassExtensions.resourceType(it);
String _typeName = this._typeExtensions.typeName(_resourceType);
_builder.append(_typeName, " ");
_builder.append(" *item)");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("{");
_builder.newLine();
_builder.append("\t\t");
_builder.append("[self refresh];");
_builder.newLine();
_builder.append("\t");
_builder.append("}];");
_builder.newLine();
_builder.append("}");
_builder.newLine();
return _builder;
}
use of org.applause.lang.applauseDsl.Screen in project applause by applause.
the class DefaultListScreenClassExtensions method targetNavigationScreen.
public Screen targetNavigationScreen(final Screen it) {
ScreenListItemCell _defaultCell = this.defaultCell(it);
EList<UIAction> _actions = _defaultCell.getActions();
final Function1<UIAction, UIActionSpecification> _function = new Function1<UIAction, UIActionSpecification>() {
public UIActionSpecification apply(final UIAction it) {
UIActionSpecification _action = it.getAction();
return _action;
}
};
List<UIActionSpecification> _map = ListExtensions.<UIAction, UIActionSpecification>map(_actions, _function);
Iterable<UIActionNavigateAction> _filter = Iterables.<UIActionNavigateAction>filter(_map, UIActionNavigateAction.class);
UIActionNavigateAction _head = IterableExtensions.<UIActionNavigateAction>head(_filter);
Screen _targetScreen = _head.getTargetScreen();
return _targetScreen;
}
Aggregations