use of org.eclipse.xtend2.lib.StringConcatenation in project applause by applause.
the class DefaultDetailsScreenModuleFileCompiler method compileUpdateItemFragment.
public CharSequence compileUpdateItemFragment(final Screen it) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("[self.item ");
String _dataAccessMethodNameForUpdate = this.dataAccessMethodNameForUpdate(it);
_builder.append(_dataAccessMethodNameForUpdate, "");
_builder.append(":^(");
Entity _resourceType = this._defaultDetailsScreenClassExtensions.resourceType(it);
String _typeName = this._typeExtensions.typeName(_resourceType);
_builder.append(_typeName, "");
_builder.append(" *item, NSError *error)");
_builder.newLineIfNotEmpty();
_builder.append("{");
_builder.newLine();
_builder.append("\t");
_builder.append("if(error == nil) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("if (self.doneBlock) {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("self.doneBlock(item);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("else {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("// use a HUD to display this to the user:");
_builder.newLine();
_builder.append("\t\t");
_builder.append("NSLog(@\"Problem saving the ");
Entity _resourceType_1 = this._defaultDetailsScreenClassExtensions.resourceType(it);
String _typeName_1 = this._typeExtensions.typeName(_resourceType_1);
String _firstLower = StringExtensions.toFirstLower(_typeName_1);
_builder.append(_firstLower, " ");
_builder.append(". Try again later.\");");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}];");
_builder.newLine();
return _builder;
}
use of org.eclipse.xtend2.lib.StringConcatenation in project applause by applause.
the class DefaultDetailsScreenModuleFileCompiler method compileCreateNewItemFragment.
public CharSequence compileCreateNewItemFragment(final Screen it) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("[self.item ");
String _dataAccessMethodNameForCreate = this.dataAccessMethodNameForCreate(it);
_builder.append(_dataAccessMethodNameForCreate, "");
_builder.append(":^(");
Entity _resourceType = this._defaultDetailsScreenClassExtensions.resourceType(it);
String _typeName = this._typeExtensions.typeName(_resourceType);
_builder.append(_typeName, "");
_builder.append(" *item, NSError *error)");
_builder.newLineIfNotEmpty();
_builder.append("{");
_builder.newLine();
_builder.append("\t");
_builder.append("if(error == nil) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("if (self.doneBlock) {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("self.doneBlock(item);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("else {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("// use a HUD to display this to the user:");
_builder.newLine();
_builder.append("\t\t");
_builder.append("NSLog(@\"Problem saving the ");
Entity _resourceType_1 = this._defaultDetailsScreenClassExtensions.resourceType(it);
String _typeName_1 = this._typeExtensions.typeName(_resourceType_1);
String _firstLower = StringExtensions.toFirstLower(_typeName_1);
_builder.append(_firstLower, " ");
_builder.append(". Try again later.\");");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}];");
_builder.newLine();
return _builder;
}
use of org.eclipse.xtend2.lib.StringConcatenation 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.eclipse.xtend2.lib.StringConcatenation in project applause by applause.
the class DefaultListScreenActionCompiler method compileActionButton_AddItem.
private CharSequence compileActionButton_AddItem(final Screen it) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd");
_builder.newLine();
_builder.append("\t\t\t\t\t\t\t\t\t\t\t ");
_builder.append("target:self");
_builder.newLine();
_builder.append("\t\t\t\t\t\t\t\t\t\t\t ");
_builder.append("action:@selector(onAddItem)]");
_builder.newLine();
return _builder;
}
use of org.eclipse.xtend2.lib.StringConcatenation 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;
}
Aggregations