diff options
author | Eike Stepper | 2012-01-14 10:27:01 +0000 |
---|---|---|
committer | Eike Stepper | 2012-01-14 10:27:01 +0000 |
commit | 0266166cb9ff9535c150250073ea1e57b42d2693 (patch) | |
tree | c006a3bc0ba1f6e1d8a2bc032eedc346f71eab0d /plugins/org.gastro.rcp.table | |
parent | 7416443692cdda72d1f704ea4fc5ececcc669df7 (diff) | |
download | cdo-0266166cb9ff9535c150250073ea1e57b42d2693.tar.gz cdo-0266166cb9ff9535c150250073ea1e57b42d2693.tar.xz cdo-0266166cb9ff9535c150250073ea1e57b42d2693.zip |
Adjusted copyrights to 2012
Diffstat (limited to 'plugins/org.gastro.rcp.table')
7 files changed, 1118 insertions, 1118 deletions
diff --git a/plugins/org.gastro.rcp.table/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.gastro.rcp.table/.settings/org.eclipse.jdt.ui.prefs index aaef0ccba1..6726e7034a 100644 --- a/plugins/org.gastro.rcp.table/.settings/org.eclipse.jdt.ui.prefs +++ b/plugins/org.gastro.rcp.table/.settings/org.eclipse.jdt.ui.prefs @@ -1,120 +1,120 @@ -#Thu Feb 04 09:44:24 CET 2010 -cleanup.add_default_serial_version_id=true -cleanup.add_generated_serial_version_id=false -cleanup.add_missing_annotations=true -cleanup.add_missing_deprecated_annotations=true -cleanup.add_missing_methods=false -cleanup.add_missing_nls_tags=false -cleanup.add_missing_override_annotations=true -cleanup.add_missing_override_annotations_interface_methods=true -cleanup.add_serial_version_id=true -cleanup.always_use_blocks=true -cleanup.always_use_parentheses_in_expressions=false -cleanup.always_use_this_for_non_static_field_access=false -cleanup.always_use_this_for_non_static_method_access=false -cleanup.convert_to_enhanced_for_loop=false -cleanup.correct_indentation=true -cleanup.format_source_code=true -cleanup.format_source_code_changes_only=false -cleanup.make_local_variable_final=true -cleanup.make_parameters_final=false -cleanup.make_private_fields_final=true -cleanup.make_type_abstract_if_missing_method=false -cleanup.make_variable_declarations_final=false -cleanup.never_use_blocks=false -cleanup.never_use_parentheses_in_expressions=true -cleanup.organize_imports=true -cleanup.qualify_static_field_accesses_with_declaring_class=false -cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -cleanup.qualify_static_member_accesses_with_declaring_class=false -cleanup.qualify_static_method_accesses_with_declaring_class=false -cleanup.remove_private_constructors=true -cleanup.remove_trailing_whitespaces=true -cleanup.remove_trailing_whitespaces_all=true -cleanup.remove_trailing_whitespaces_ignore_empty=false -cleanup.remove_unnecessary_casts=true -cleanup.remove_unnecessary_nls_tags=true -cleanup.remove_unused_imports=true -cleanup.remove_unused_local_variables=false -cleanup.remove_unused_private_fields=true -cleanup.remove_unused_private_members=false -cleanup.remove_unused_private_methods=true -cleanup.remove_unused_private_types=true -cleanup.sort_members=false -cleanup.sort_members_all=false -cleanup.use_blocks=true -cleanup.use_blocks_only_for_return_and_throw=false -cleanup.use_parentheses_in_expressions=true -cleanup.use_this_for_non_static_field_access=true -cleanup.use_this_for_non_static_field_access_only_if_necessary=true -cleanup.use_this_for_non_static_method_access=true -cleanup.use_this_for_non_static_method_access_only_if_necessary=true -cleanup_profile=_EMFT -cleanup_settings_version=2 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_EMFT -formatter_settings_version=11 -org.eclipse.jdt.ui.exception.name=ex -org.eclipse.jdt.ui.gettersetter.use.is=true -org.eclipse.jdt.ui.ignorelowercasenames=true -org.eclipse.jdt.ui.importorder=org.eclipse.emf.cdo;org.eclipse.emf.internal.cdo;org.eclipse.net4j;org.eclipse.internal.net4j;org.eclipse.emf;org.eclipse;com;org;javax;java; -org.eclipse.jdt.ui.javadoc=true -org.eclipse.jdt.ui.keywordthis=false -org.eclipse.jdt.ui.ondemandthreshold=99 -org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.staticondemandthreshold=99 -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment"/><template autoinsert\="false" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment"/><template autoinsert\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment"/><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*\r\n * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * Contributors\:\r\n * Eike Stepper - initial API and implementation\r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author Eike Stepper\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="false" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment"/><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment"/><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=true -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_missing_override_annotations_interface_methods=false -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=true -sp_cleanup.format_source_code=true -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.make_local_variable_final=false -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=false -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=true -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=true -sp_cleanup.remove_unnecessary_nls_tags=true -sp_cleanup.remove_unused_imports=true -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=true -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=true -sp_cleanup.use_this_for_non_static_field_access=true -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=true -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +#Thu Feb 04 09:44:24 CET 2010
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=true
+cleanup.add_serial_version_id=true
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_to_enhanced_for_loop=false
+cleanup.correct_indentation=true
+cleanup.format_source_code=true
+cleanup.format_source_code_changes_only=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=false
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=false
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=true
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=false
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_parentheses_in_expressions=true
+cleanup.use_this_for_non_static_field_access=true
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=true
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup_profile=_EMFT
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_EMFT
+formatter_settings_version=11
+org.eclipse.jdt.ui.exception.name=ex
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=org.eclipse.emf.cdo;org.eclipse.emf.internal.cdo;org.eclipse.net4j;org.eclipse.internal.net4j;org.eclipse.emf;org.eclipse;com;org;javax;java;
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.overrideannotation=true
+org.eclipse.jdt.ui.staticondemandthreshold=99
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment"/><template autoinsert\="false" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment"/><template autoinsert\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment"/><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*\r\n * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * Contributors\:\r\n * Eike Stepper - initial API and implementation\r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author Eike Stepper\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="false" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment"/><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment"/><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=false
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=true
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=true
+sp_cleanup.use_this_for_non_static_field_access=true
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=true
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/plugins/org.gastro.rcp.table/build.properties b/plugins/org.gastro.rcp.table/build.properties index fd3aa5c414..2ec229706a 100644 --- a/plugins/org.gastro.rcp.table/build.properties +++ b/plugins/org.gastro.rcp.table/build.properties @@ -1,26 +1,26 @@ -# Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Eike Stepper - initial API and implementation - -source.. = src/ -output.. = bin/ -bin.includes = plugin.xml,\ - META-INF/,\ - .,\ - icons/,\ - images/,\ - copyright.txt,\ - about.html,\ - config/,\ - GastroTable1.launch,\ - GastroTable2.launch -src.includes = about.html,\ - copyright.txt,\ - config/,\ - GastroTable1.launch,\ - GastroTable2.launch +# Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Eike Stepper - initial API and implementation
+
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/,\
+ images/,\
+ copyright.txt,\
+ about.html,\
+ config/,\
+ GastroTable1.launch,\
+ GastroTable2.launch
+src.includes = about.html,\
+ copyright.txt,\
+ config/,\
+ GastroTable1.launch,\
+ GastroTable2.launch
diff --git a/plugins/org.gastro.rcp.table/copyright.txt b/plugins/org.gastro.rcp.table/copyright.txt index 5e75dad95d..194641baea 100644 --- a/plugins/org.gastro.rcp.table/copyright.txt +++ b/plugins/org.gastro.rcp.table/copyright.txt @@ -1,11 +1,11 @@ -Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others. -All rights reserved. This program and the accompanying materials -are made available under the terms of the Eclipse Public License v1.0 -which accompanies this distribution, and is available at -http://www.eclipse.org/legal/epl-v10.html - -Contributors: - Eike Stepper - initial API and implementation - -Initial Publication: +Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Eike Stepper - initial API and implementation
+
+Initial Publication:
Eclipse Magazin - http://www.eclipse-magazin.de
\ No newline at end of file diff --git a/plugins/org.gastro.rcp.table/plugin.xml b/plugins/org.gastro.rcp.table/plugin.xml index a85e9428e7..1018dc8ff1 100644 --- a/plugins/org.gastro.rcp.table/plugin.xml +++ b/plugins/org.gastro.rcp.table/plugin.xml @@ -1,34 +1,34 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.4"?> -<!-- - Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others. - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - which accompanies this distribution, and is available at - http://www.eclipse.org/legal/epl-v10.html - - Contributors: - Eike Stepper - initial API and implementation ---> - -<plugin> - - <extension - point="org.eclipse.ui.perspectives"> - <perspective - name="Table Perspective" - class="org.gastro.rcp.internal.table.TablePerspective" - id="org.gastro.rcp.table.perspective"> - </perspective> - </extension> - - <extension - point="org.eclipse.ui.views"> - <view - name="Table View" - class="org.gastro.rcp.internal.table.TableView" - id="org.gastro.rcp.table.view"> - </view> - </extension> - -</plugin> +<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<!--
+ Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Eike Stepper - initial API and implementation
+-->
+
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.perspectives">
+ <perspective
+ name="Table Perspective"
+ class="org.gastro.rcp.internal.table.TablePerspective"
+ id="org.gastro.rcp.table.perspective">
+ </perspective>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ name="Table View"
+ class="org.gastro.rcp.internal.table.TableView"
+ id="org.gastro.rcp.table.view">
+ </view>
+ </extension>
+
+</plugin>
diff --git a/plugins/org.gastro.rcp.table/src/org/gastro/rcp/internal/table/Activator.java b/plugins/org.gastro.rcp.table/src/org/gastro/rcp/internal/table/Activator.java index fe1934ca69..57dffb16c0 100644 --- a/plugins/org.gastro.rcp.table/src/org/gastro/rcp/internal/table/Activator.java +++ b/plugins/org.gastro.rcp.table/src/org/gastro/rcp/internal/table/Activator.java @@ -1,87 +1,87 @@ -/* - * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Eike Stepper - initial API and implementation - * - * Initial Publication: - * Eclipse Magazin - http://www.eclipse-magazin.de - */ -package org.gastro.rcp.internal.table; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.ui.plugin.AbstractUIPlugin; - -import com.swtdesigner.ResourceManager; - -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - * - * @author Eike Stepper - */ -public class Activator extends AbstractUIPlugin -{ - // The plug-in ID - public static final String PLUGIN_ID = "org.gastro.rcp.table"; - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() - { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - @Override - public void start(BundleContext context) throws Exception - { - super.start(context); - plugin = this; - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - @Override - public void stop(BundleContext context) throws Exception - { - ResourceManager.dispose(); - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() - { - return plugin; - } - - /** - * Returns an image descriptor for the image file at the given plug-in relative path - * - * @param path - * the path - * @return the image descriptor - */ - public static ImageDescriptor getImageDescriptor(String path) - { - return imageDescriptorFromPlugin(PLUGIN_ID, path); - } -} +/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ *
+ * Initial Publication:
+ * Eclipse Magazin - http://www.eclipse-magazin.de
+ */
+package org.gastro.rcp.internal.table;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+import com.swtdesigner.ResourceManager;
+
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ *
+ * @author Eike Stepper
+ */
+public class Activator extends AbstractUIPlugin
+{
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.gastro.rcp.table";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator()
+ {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception
+ {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception
+ {
+ ResourceManager.dispose();
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault()
+ {
+ return plugin;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given plug-in relative path
+ *
+ * @param path
+ * the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path)
+ {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+}
diff --git a/plugins/org.gastro.rcp.table/src/org/gastro/rcp/internal/table/TablePerspective.java b/plugins/org.gastro.rcp.table/src/org/gastro/rcp/internal/table/TablePerspective.java index 6863d9e355..fee7e86618 100644 --- a/plugins/org.gastro.rcp.table/src/org/gastro/rcp/internal/table/TablePerspective.java +++ b/plugins/org.gastro.rcp.table/src/org/gastro/rcp/internal/table/TablePerspective.java @@ -1,31 +1,31 @@ -/* - * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Eike Stepper - initial API and implementation - * - * Initial Publication: - * Eclipse Magazin - http://www.eclipse-magazin.de - */ -package org.gastro.rcp.internal.table; - -import org.eclipse.ui.IPageLayout; -import org.eclipse.ui.IPerspectiveFactory; - -/** - * @author Eike Stepper - */ -public class TablePerspective implements IPerspectiveFactory -{ - public void createInitialLayout(IPageLayout layout) - { - String editorArea = layout.getEditorArea(); - layout.setEditorAreaVisible(false); - layout.setFixed(true); - layout.addStandaloneView(TableView.ID, false, IPageLayout.LEFT, 1.0f, editorArea); - } -} +/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ *
+ * Initial Publication:
+ * Eclipse Magazin - http://www.eclipse-magazin.de
+ */
+package org.gastro.rcp.internal.table;
+
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+
+/**
+ * @author Eike Stepper
+ */
+public class TablePerspective implements IPerspectiveFactory
+{
+ public void createInitialLayout(IPageLayout layout)
+ {
+ String editorArea = layout.getEditorArea();
+ layout.setEditorAreaVisible(false);
+ layout.setFixed(true);
+ layout.addStandaloneView(TableView.ID, false, IPageLayout.LEFT, 1.0f, editorArea);
+ }
+}
diff --git a/plugins/org.gastro.rcp.table/src/org/gastro/rcp/internal/table/TableView.java b/plugins/org.gastro.rcp.table/src/org/gastro/rcp/internal/table/TableView.java index 282b5fa782..d68f636d1f 100644 --- a/plugins/org.gastro.rcp.table/src/org/gastro/rcp/internal/table/TableView.java +++ b/plugins/org.gastro.rcp.table/src/org/gastro/rcp/internal/table/TableView.java @@ -1,810 +1,810 @@ -/* - * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Eike Stepper - initial API and implementation - * - * Initial Publication: - * Eclipse Magazin - http://www.eclipse-magazin.de - */ -package org.gastro.rcp.internal.table; - -import org.eclipse.net4j.util.StringUtil; -import org.eclipse.net4j.util.ref.ReferenceValueMap; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.impl.AdapterImpl; -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; - -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.nebula.widgets.pshelf.PShelf; -import org.eclipse.nebula.widgets.pshelf.PShelfItem; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.ui.part.ViewPart; - -import com.swtdesigner.ResourceManager; -import com.swtdesigner.SWTResourceManager; - -import org.gastro.business.BusinessDay; -import org.gastro.business.BusinessFactory; -import org.gastro.business.Order; -import org.gastro.business.OrderDetail; -import org.gastro.inventory.MenuCard; -import org.gastro.inventory.Offering; -import org.gastro.inventory.Section; -import org.gastro.rcp.IModel; -import org.gastro.rcp.IModel.ITransactionalOperation; - -import java.text.NumberFormat; -import java.util.Iterator; -import java.util.Map; - -/** - * @author Eike Stepper - */ -public class TableView extends ViewPart -{ - public static final String ID = "org.gastro.rcp.table.view"; - - private static final AdapterFactory FACTORY = IModel.INSTANCE.getAdapterFactory(); - - private static final Map<String, String> fakeImages = new ReferenceValueMap.Soft<String, String>(); - - private static int fakeImageID; - - private TreeViewer menuViewer; - - private Label menuTitle; - - private Label menuDescription; - - private Label menuImage; - - private Label menuPrice; - - private Label quantity; - - private Button buttonDelete; - - private Button buttonAdd; - - private EObject currentItem; - - private Adapter currentItemAdapter = new AdapterImpl() - { - @Override - public void notifyChanged(Notification msg) - { - try - { - menuViewer.getTree().getDisplay().asyncExec(new Runnable() - { - public void run() - { - try - { - showMenuCard(); - } - catch (Exception ex) - { - } - } - }); - } - catch (Exception ex) - { - } - } - }; - - private Order order; - - private OrderDetail orderDetail; - - private Adapter businessDayAdapter = new AdapterImpl() - { - @Override - public void notifyChanged(Notification msg) - { - try - { - menuViewer.getTree().getDisplay().asyncExec(new Runnable() - { - public void run() - { - try - { - menuViewer.setInput(IModel.INSTANCE.getBusinessDay().getMenuCard()); - } - catch (Exception ex) - { - } - } - }); - } - catch (Exception ex) - { - } - } - }; - - private TableViewer orderViewer; - - public TableView() - { - } - - /** - * Passing the focus request to the viewer's control. - */ - @Override - public void setFocus() - { - // Do nothing - } - - @Override - public void dispose() - { - IModel.INSTANCE.getBusinessDay().eAdapters().remove(businessDayAdapter); - if (currentItem != null) - { - currentItem.eAdapters().remove(currentItemAdapter); - } - - super.dispose(); - } - - /** - * This is a callback that will allow us to create the viewer and initialize it. - */ - @Override - public void createPartControl(Composite parent) - { - BusinessDay businessDay = IModel.INSTANCE.getBusinessDay(); - businessDay.eAdapters().add(businessDayAdapter); - - parent.setLayout(new FillLayout(SWT.VERTICAL)); - { - PShelf shelf = new PShelf(parent, SWT.NONE); - shelf.setForeground(SWTResourceManager.getColor(SWT.COLOR_LIST_SELECTION)); - shelf.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT)); - shelf.setFont(SWTResourceManager.getFont("Comic Sans MS", 24, SWT.BOLD)); - shelf.setRenderer(new org.eclipse.nebula.widgets.pshelf.RedmondShelfRenderer()); - { - PShelfItem shelfItem = new PShelfItem(shelf, SWT.NONE); - GridLayout gridLayout = new GridLayout(3, false); - gridLayout.horizontalSpacing = 0; - gridLayout.marginHeight = 0; - gridLayout.verticalSpacing = 0; - gridLayout.marginWidth = 0; - shelfItem.getBody().setLayout(gridLayout); - { - menuViewer = new TreeViewer(shelfItem.getBody(), SWT.NONE); - menuViewer.addSelectionChangedListener(new ISelectionChangedListener() - { - public void selectionChanged(SelectionChangedEvent event) - { - EObject item = (EObject)((IStructuredSelection)event.getSelection()).getFirstElement(); - if (item != currentItem) - { - if (currentItem != null) - { - currentItem.eAdapters().remove(currentItemAdapter); - } - - if (item != null) - { - item.eAdapters().add(currentItemAdapter); - } - - currentItem = item; - showMenuCard(); - } - } - }); - - menuViewer.setContentProvider(new AdapterFactoryContentProvider(FACTORY)); - menuViewer.setLabelProvider(new AdapterFactoryLabelProvider(FACTORY) - { - @Override - public Image getImage(Object object) - { - return null; - } - }); - - menuViewer.setInput(businessDay.getMenuCard()); - - Tree tree = menuViewer.getTree(); - tree.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE)); - tree.setFont(SWTResourceManager.getFont("Comic Sans MS", 16, SWT.BOLD)); - { - GridData gridData = new GridData(SWT.LEFT, SWT.FILL, false, true, 1, 1); - gridData.widthHint = 300; - tree.setLayoutData(gridData); - } - } - - { - Composite composite = new Composite(shelfItem.getBody(), SWT.NONE); - composite.setLayout(new GridLayout(1, false)); - composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); - composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); - { - menuTitle = new Label(composite, SWT.NONE); - menuTitle.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE)); - menuTitle.setFont(SWTResourceManager.getFont("Comic Sans MS", 16, SWT.BOLD)); - menuTitle.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); - menuTitle.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); - menuTitle.setText("Titel"); - } - - { - Label label = new Label(composite, SWT.SEPARATOR); - { - GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); - gridData.heightHint = 2; - label.setLayoutData(gridData); - } - } - - { - menuDescription = new Label(composite, SWT.WRAP); - menuDescription.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE)); - menuDescription.setFont(SWTResourceManager.getFont("Comic Sans MS", 16, SWT.BOLD)); - menuDescription.setText("Beschreibung"); - menuDescription.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); - menuDescription.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); - } - - { - Composite composite_1 = new Composite(composite, SWT.NONE); - composite_1.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false, 1, 1)); - composite_1.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); - GridLayout gridLayout_1 = new GridLayout(2, false); - gridLayout_1.marginWidth = 0; - gridLayout_1.marginHeight = 0; - composite_1.setLayout(gridLayout_1); - { - menuImage = new Label(composite_1, SWT.NONE); - menuImage.setLayoutData(new GridData(SWT.RIGHT, SWT.BOTTOM, true, false, 1, 1)); - menuImage.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); - menuImage.setText("Bild"); - menuImage.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE)); - menuImage.setFont(SWTResourceManager.getFont("Comic Sans MS", 16, SWT.BOLD)); - } - - { - menuPrice = new Label(composite_1, SWT.NONE); - menuPrice.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, true, false, 1, 1)); - menuPrice.setAlignment(SWT.RIGHT); - menuPrice.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE)); - menuPrice.setFont(SWTResourceManager.getFont("Comic Sans MS", 16, SWT.BOLD)); - menuPrice.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); - menuPrice.setText("Preis"); - } - } - } - - { - Composite composite = new Composite(shelfItem.getBody(), SWT.NONE); - composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND)); - GridLayout gridLayout_1 = new GridLayout(1, false); - gridLayout_1.marginHeight = 0; - gridLayout_1.marginWidth = 0; - composite.setLayout(gridLayout_1); - composite.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true, 1, 1)); - { - Button buttonPrev = new Button(composite, SWT.NONE); - buttonPrev.setToolTipText("Voriger Eintrag"); - buttonPrev.addSelectionListener(new SelectionAdapter() - { - @Override - public void widgetSelected(SelectionEvent e) - { - prevMenu(); - } - }); - - buttonPrev.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/up.png")); - } - - { - Label label = new Label(composite, SWT.NONE); - label.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true, 1, 1)); - } - - { - quantity = new Label(composite, SWT.NONE); - quantity.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE)); - quantity.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND)); - quantity.setAlignment(SWT.CENTER); - quantity.setFont(SWTResourceManager.getFont("Comic Sans MS", 32, SWT.BOLD)); - quantity.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false, 1, 1)); - quantity.setText("0"); - } - - { - Composite composite_1 = new Composite(composite, SWT.NONE); - composite_1.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND)); - composite_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); - FillLayout fillLayout = new FillLayout(SWT.HORIZONTAL); - fillLayout.spacing = 5; - composite_1.setLayout(fillLayout); - { - buttonDelete = new Button(composite_1, SWT.NONE); - buttonDelete.setToolTipText("Weniger bestellen"); - buttonDelete.addSelectionListener(new SelectionAdapter() - { - @Override - public void widgetSelected(SelectionEvent e) - { - deleteOrder(); - } - }); - - buttonDelete.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/delete.gif")); - } - - { - buttonAdd = new Button(composite_1, SWT.NONE); - buttonAdd.setToolTipText("Mehr bestellen"); - buttonAdd.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/add.gif")); - buttonAdd.addSelectionListener(new SelectionAdapter() - { - @Override - public void widgetSelected(SelectionEvent e) - { - addOrder(); - } - }); - } - } - - { - Label label = new Label(composite, SWT.NONE); - label.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true, 1, 1)); - } - - { - Button buttonNext = new Button(composite, SWT.NONE); - buttonNext.setToolTipText("N\u00E4chster Eintrag"); - buttonNext.addSelectionListener(new SelectionAdapter() - { - @Override - public void widgetSelected(SelectionEvent e) - { - nextMenu(); - } - }); - - buttonNext.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/down.png")); - } - } - - shelfItem.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/menucard.png")); - shelfItem.setText(" Speisen und Getr\u00E4nke"); - } - - { - PShelfItem shelfItem = new PShelfItem(shelf, SWT.NONE); - GridLayout gridLayout = new GridLayout(2, false); - gridLayout.horizontalSpacing = 0; - gridLayout.verticalSpacing = 0; - gridLayout.marginWidth = 0; - gridLayout.marginHeight = 0; - shelfItem.getBody().setLayout(gridLayout); - { - orderViewer = new TableViewer(shelfItem.getBody(), SWT.HIDE_SELECTION); - - Table table = orderViewer.getTable(); - table.setLinesVisible(true); - table.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE)); - table.setFont(SWTResourceManager.getFont("Comic Sans MS", 16, SWT.BOLD)); - { - GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); - gridData.widthHint = 300; - table.setLayoutData(gridData); - } - - { - TableViewerColumn tableViewerColumn = new TableViewerColumn(orderViewer, SWT.NONE); - TableColumn tblclmnQuantity = tableViewerColumn.getColumn(); - tblclmnQuantity.setResizable(false); - tblclmnQuantity.setAlignment(SWT.RIGHT); - tblclmnQuantity.setWidth(70); - tblclmnQuantity.setText("Quantity"); - } - - { - TableViewerColumn tableViewerColumn = new TableViewerColumn(orderViewer, SWT.NONE); - TableColumn tblclmnOffering = tableViewerColumn.getColumn(); - tblclmnOffering.setWidth(410); - tblclmnOffering.setText("Offering"); - } - - { - TableViewerColumn tableViewerColumn = new TableViewerColumn(orderViewer, SWT.NONE); - TableColumn tblclmnPrice = tableViewerColumn.getColumn(); - tblclmnPrice.setResizable(false); - tblclmnPrice.setAlignment(SWT.RIGHT); - tblclmnPrice.setWidth(100); - tblclmnPrice.setText("Price"); - } - - { - TableViewerColumn tableViewerColumn = new TableViewerColumn(orderViewer, SWT.NONE); - TableColumn tblclmnSum = tableViewerColumn.getColumn(); - tblclmnSum.setResizable(false); - tblclmnSum.setAlignment(SWT.RIGHT); - tblclmnSum.setWidth(117); - tblclmnSum.setText("Sum"); - } - - orderViewer.setContentProvider(new AdapterFactoryContentProvider(FACTORY)); - orderViewer.setLabelProvider(new AdapterFactoryLabelProvider(FACTORY) - { - @Override - public String getColumnText(Object object, int columnIndex) - { - switch (columnIndex) - { - case 0: - return "" + ((OrderDetail)object).getQuantity() + "x"; - case 1: - return ((OrderDetail)object).getOffering().getName(); - case 2: - return formatPrice(((OrderDetail)object).getOffering().getPrice()); - case 3: - return formatPrice(((OrderDetail)object).getPrice()); - - default: - return super.getColumnText(object, columnIndex); - } - } - - @Override - public Image getColumnImage(Object object, int columnIndex) - { - return null; - } - }); - } - - { - Composite composite = new Composite(shelfItem.getBody(), SWT.NONE); - composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND)); - composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1)); - GridLayout gridLayout_1 = new GridLayout(1, false); - gridLayout_1.marginHeight = 0; - gridLayout_1.marginWidth = 0; - composite.setLayout(gridLayout_1); - composite.setBounds(0, 0, 64, 64); - { - Button buttonCancel = new Button(composite, SWT.NONE); - buttonCancel.addSelectionListener(new SelectionAdapter() - { - @Override - public void widgetSelected(SelectionEvent e) - { - cancelOrder(); - } - }); - - buttonCancel.setToolTipText("Bestellung abbrechen"); - buttonCancel.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/cancel.png")); - } - - { - Label labelTotalPrice = new Label(composite, SWT.NONE); - labelTotalPrice.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND)); - labelTotalPrice.setAlignment(SWT.CENTER); - labelTotalPrice.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, true, 1, 1)); - } - - { - Button buttonSend = new Button(composite, SWT.NONE); - buttonSend.addSelectionListener(new SelectionAdapter() - { - @Override - public void widgetSelected(SelectionEvent e) - { - sendOrder(); - } - }); - - buttonSend.setToolTipText("Bestellung absenden"); - buttonSend.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/send.png")); - } - } - - shelfItem.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/order.png")); - shelfItem.setText(" Bestellung"); - } - - { - PShelfItem shelfItem = new PShelfItem(shelf, SWT.NONE); - shelfItem.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/payment.png")); - shelfItem.setText(" Bezahlung"); - } - - { - PShelfItem shelfItem = new PShelfItem(shelf, SWT.NONE); - shelfItem.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/service.png")); - shelfItem.setText(" Service"); - } - - shelf.addSelectionListener(new SelectionAdapter() - { - @Override - public void widgetSelected(SelectionEvent e) - { - orderViewer.refresh(true); - } - }); - - createNewOrder(); - } - } - - protected void nextMenu() - { - EList<EObject> menuItems = getAllMenuItems(); - int index = menuItems.indexOf(currentItem); - if (index >= 0 && index < menuItems.size() - 1) - { - menuViewer.setSelection(new StructuredSelection(menuItems.get(index + 1))); - } - } - - protected void prevMenu() - { - EList<EObject> menuItems = getAllMenuItems(); - int index = menuItems.indexOf(currentItem); - if (index > 0) - { - menuViewer.setSelection(new StructuredSelection(menuItems.get(index - 1))); - } - } - - protected void showMenuCard() - { - OrderDetail oldOrderDetail = orderDetail; - if (currentItem instanceof Section) - { - Section section = (Section)currentItem; - updateMenuDetail( // - section.getTitle(), // - section.getText(), // - null, // - false); - orderDetail = null; - } - else if (currentItem instanceof Offering) - { - Offering offering = (Offering)currentItem; - updateMenuDetail( // - offering.getName(), // - offering.getDescription(), // - formatPrice(offering.getPrice()), // - true); - orderDetail = getOrderDetail(offering); - } - - if (oldOrderDetail != null && oldOrderDetail != orderDetail) - { - if (oldOrderDetail.getQuantity() == 0) - { - order.getOrderDetails().remove(oldOrderDetail); - } - } - - updateOrderDetail(); - } - - protected void addOrder() - { - if (orderDetail == null) - { - orderDetail = BusinessFactory.eINSTANCE.createOrderDetail(); - orderDetail.setOffering((Offering)currentItem); - orderDetail.setQuantity(1); - order.getOrderDetails().add(orderDetail); - } - else - { - orderDetail.setQuantity(orderDetail.getQuantity() + 1); - } - - updateOrderDetail(); - } - - protected void deleteOrder() - { - int quantity = orderDetail.getQuantity(); - if (quantity == 1) - { - order.getOrderDetails().remove(orderDetail); - orderDetail = null; - } - else - { - orderDetail.setQuantity(quantity - 1); - } - - updateOrderDetail(); - } - - protected void sendOrder() - { - ITransactionalOperation<BusinessDay> operation = new ITransactionalOperation<BusinessDay>() - { - public Object execute(BusinessDay businessDay) - { - businessDay.cdoWriteLock().lock(); - EList<Order> orders = businessDay.getOrders(); - order.setNumber(getNextOrderNumber(orders)); - orders.add(order); - return null; - } - }; - - IModel.INSTANCE.modify(IModel.INSTANCE.getBusinessDay(), operation); - createNewOrder(); - } - - protected void cancelOrder() - { - createNewOrder(); - } - - private EList<EObject> getAllMenuItems() - { - MenuCard menuCard = (MenuCard)menuViewer.getInput(); - EList<EObject> result = new BasicEList<EObject>(); - for (Iterator<EObject> it = menuCard.eAllContents(); it.hasNext();) - { - result.add(it.next()); - } - - return result; - } - - private void createNewOrder() - { - order = BusinessFactory.eINSTANCE.createOrder(); - order.setTable((org.gastro.inventory.Table)IModel.INSTANCE.getStation()); - orderViewer.setInput(order); - - orderDetail = null; - updateOrderDetail(); - } - - private int getNextOrderNumber(EList<Order> orders) - { - int count = orders.size(); - if (count > 0) - { - return orders.get(count - 1).getNumber() + 1; - } - - return 1; - } - - private OrderDetail getOrderDetail(Offering offering) - { - for (OrderDetail orderDetail : order.getOrderDetails()) - { - if (orderDetail.getOffering() == offering) - { - return orderDetail; - } - } - - return null; - } - - private void updateMenuDetail(String title, String description, String price, boolean withImage) - { - menuTitle.setText(StringUtil.safe(title)); - menuDescription.setText(StringUtil.safe(description)); - menuPrice.setText(StringUtil.safe(price)); - - if (title == null || !withImage) - { - menuImage.setImage(null); - } - else - { - String name = fakeImages.get(title); - if (name == null) - { - for (;;) - { - name = "meal-" + ++fakeImageID; - Image image = getCachedImage(name); - if (image != null) - { - fakeImages.put(title, name); - menuImage.setImage(getCachedImage(name)); - break; - } - - fakeImageID = 0; - } - } - else - { - menuImage.setImage(getCachedImage(name)); - } - } - - menuImage.getParent().getParent().layout(true); - } - - private void updateOrderDetail() - { - if (currentItem instanceof Offering) - { - if (orderDetail != null) - { - quantity.setText("" + orderDetail.getQuantity()); - buttonDelete.setEnabled(true); - } - else - { - quantity.setText("0"); - buttonDelete.setEnabled(false); - } - - quantity.setVisible(true); - buttonAdd.setVisible(true); - buttonDelete.setVisible(true); - } - else - { - quantity.setVisible(false); - buttonAdd.setVisible(false); - buttonDelete.setVisible(false); - } - } - - private Image getCachedImage(String name) - { - return ResourceManager.getPluginImage("org.gastro.rcp.table", "images/" + name + ".png"); - } - - private String formatPrice(float price) - { - return NumberFormat.getCurrencyInstance().format(price); - } -} +/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ *
+ * Initial Publication:
+ * Eclipse Magazin - http://www.eclipse-magazin.de
+ */
+package org.gastro.rcp.internal.table;
+
+import org.eclipse.net4j.util.StringUtil;
+import org.eclipse.net4j.util.ref.ReferenceValueMap;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.nebula.widgets.pshelf.PShelf;
+import org.eclipse.nebula.widgets.pshelf.PShelfItem;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.part.ViewPart;
+
+import com.swtdesigner.ResourceManager;
+import com.swtdesigner.SWTResourceManager;
+
+import org.gastro.business.BusinessDay;
+import org.gastro.business.BusinessFactory;
+import org.gastro.business.Order;
+import org.gastro.business.OrderDetail;
+import org.gastro.inventory.MenuCard;
+import org.gastro.inventory.Offering;
+import org.gastro.inventory.Section;
+import org.gastro.rcp.IModel;
+import org.gastro.rcp.IModel.ITransactionalOperation;
+
+import java.text.NumberFormat;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class TableView extends ViewPart
+{
+ public static final String ID = "org.gastro.rcp.table.view";
+
+ private static final AdapterFactory FACTORY = IModel.INSTANCE.getAdapterFactory();
+
+ private static final Map<String, String> fakeImages = new ReferenceValueMap.Soft<String, String>();
+
+ private static int fakeImageID;
+
+ private TreeViewer menuViewer;
+
+ private Label menuTitle;
+
+ private Label menuDescription;
+
+ private Label menuImage;
+
+ private Label menuPrice;
+
+ private Label quantity;
+
+ private Button buttonDelete;
+
+ private Button buttonAdd;
+
+ private EObject currentItem;
+
+ private Adapter currentItemAdapter = new AdapterImpl()
+ {
+ @Override
+ public void notifyChanged(Notification msg)
+ {
+ try
+ {
+ menuViewer.getTree().getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ showMenuCard();
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+ });
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+ };
+
+ private Order order;
+
+ private OrderDetail orderDetail;
+
+ private Adapter businessDayAdapter = new AdapterImpl()
+ {
+ @Override
+ public void notifyChanged(Notification msg)
+ {
+ try
+ {
+ menuViewer.getTree().getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ menuViewer.setInput(IModel.INSTANCE.getBusinessDay().getMenuCard());
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+ });
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+ };
+
+ private TableViewer orderViewer;
+
+ public TableView()
+ {
+ }
+
+ /**
+ * Passing the focus request to the viewer's control.
+ */
+ @Override
+ public void setFocus()
+ {
+ // Do nothing
+ }
+
+ @Override
+ public void dispose()
+ {
+ IModel.INSTANCE.getBusinessDay().eAdapters().remove(businessDayAdapter);
+ if (currentItem != null)
+ {
+ currentItem.eAdapters().remove(currentItemAdapter);
+ }
+
+ super.dispose();
+ }
+
+ /**
+ * This is a callback that will allow us to create the viewer and initialize it.
+ */
+ @Override
+ public void createPartControl(Composite parent)
+ {
+ BusinessDay businessDay = IModel.INSTANCE.getBusinessDay();
+ businessDay.eAdapters().add(businessDayAdapter);
+
+ parent.setLayout(new FillLayout(SWT.VERTICAL));
+ {
+ PShelf shelf = new PShelf(parent, SWT.NONE);
+ shelf.setForeground(SWTResourceManager.getColor(SWT.COLOR_LIST_SELECTION));
+ shelf.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT));
+ shelf.setFont(SWTResourceManager.getFont("Comic Sans MS", 24, SWT.BOLD));
+ shelf.setRenderer(new org.eclipse.nebula.widgets.pshelf.RedmondShelfRenderer());
+ {
+ PShelfItem shelfItem = new PShelfItem(shelf, SWT.NONE);
+ GridLayout gridLayout = new GridLayout(3, false);
+ gridLayout.horizontalSpacing = 0;
+ gridLayout.marginHeight = 0;
+ gridLayout.verticalSpacing = 0;
+ gridLayout.marginWidth = 0;
+ shelfItem.getBody().setLayout(gridLayout);
+ {
+ menuViewer = new TreeViewer(shelfItem.getBody(), SWT.NONE);
+ menuViewer.addSelectionChangedListener(new ISelectionChangedListener()
+ {
+ public void selectionChanged(SelectionChangedEvent event)
+ {
+ EObject item = (EObject)((IStructuredSelection)event.getSelection()).getFirstElement();
+ if (item != currentItem)
+ {
+ if (currentItem != null)
+ {
+ currentItem.eAdapters().remove(currentItemAdapter);
+ }
+
+ if (item != null)
+ {
+ item.eAdapters().add(currentItemAdapter);
+ }
+
+ currentItem = item;
+ showMenuCard();
+ }
+ }
+ });
+
+ menuViewer.setContentProvider(new AdapterFactoryContentProvider(FACTORY));
+ menuViewer.setLabelProvider(new AdapterFactoryLabelProvider(FACTORY)
+ {
+ @Override
+ public Image getImage(Object object)
+ {
+ return null;
+ }
+ });
+
+ menuViewer.setInput(businessDay.getMenuCard());
+
+ Tree tree = menuViewer.getTree();
+ tree.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE));
+ tree.setFont(SWTResourceManager.getFont("Comic Sans MS", 16, SWT.BOLD));
+ {
+ GridData gridData = new GridData(SWT.LEFT, SWT.FILL, false, true, 1, 1);
+ gridData.widthHint = 300;
+ tree.setLayoutData(gridData);
+ }
+ }
+
+ {
+ Composite composite = new Composite(shelfItem.getBody(), SWT.NONE);
+ composite.setLayout(new GridLayout(1, false));
+ composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+ {
+ menuTitle = new Label(composite, SWT.NONE);
+ menuTitle.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE));
+ menuTitle.setFont(SWTResourceManager.getFont("Comic Sans MS", 16, SWT.BOLD));
+ menuTitle.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
+ menuTitle.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
+ menuTitle.setText("Titel");
+ }
+
+ {
+ Label label = new Label(composite, SWT.SEPARATOR);
+ {
+ GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
+ gridData.heightHint = 2;
+ label.setLayoutData(gridData);
+ }
+ }
+
+ {
+ menuDescription = new Label(composite, SWT.WRAP);
+ menuDescription.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE));
+ menuDescription.setFont(SWTResourceManager.getFont("Comic Sans MS", 16, SWT.BOLD));
+ menuDescription.setText("Beschreibung");
+ menuDescription.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+ menuDescription.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
+ }
+
+ {
+ Composite composite_1 = new Composite(composite, SWT.NONE);
+ composite_1.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false, 1, 1));
+ composite_1.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
+ GridLayout gridLayout_1 = new GridLayout(2, false);
+ gridLayout_1.marginWidth = 0;
+ gridLayout_1.marginHeight = 0;
+ composite_1.setLayout(gridLayout_1);
+ {
+ menuImage = new Label(composite_1, SWT.NONE);
+ menuImage.setLayoutData(new GridData(SWT.RIGHT, SWT.BOTTOM, true, false, 1, 1));
+ menuImage.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
+ menuImage.setText("Bild");
+ menuImage.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE));
+ menuImage.setFont(SWTResourceManager.getFont("Comic Sans MS", 16, SWT.BOLD));
+ }
+
+ {
+ menuPrice = new Label(composite_1, SWT.NONE);
+ menuPrice.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, true, false, 1, 1));
+ menuPrice.setAlignment(SWT.RIGHT);
+ menuPrice.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE));
+ menuPrice.setFont(SWTResourceManager.getFont("Comic Sans MS", 16, SWT.BOLD));
+ menuPrice.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
+ menuPrice.setText("Preis");
+ }
+ }
+ }
+
+ {
+ Composite composite = new Composite(shelfItem.getBody(), SWT.NONE);
+ composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));
+ GridLayout gridLayout_1 = new GridLayout(1, false);
+ gridLayout_1.marginHeight = 0;
+ gridLayout_1.marginWidth = 0;
+ composite.setLayout(gridLayout_1);
+ composite.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true, 1, 1));
+ {
+ Button buttonPrev = new Button(composite, SWT.NONE);
+ buttonPrev.setToolTipText("Voriger Eintrag");
+ buttonPrev.addSelectionListener(new SelectionAdapter()
+ {
+ @Override
+ public void widgetSelected(SelectionEvent e)
+ {
+ prevMenu();
+ }
+ });
+
+ buttonPrev.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/up.png"));
+ }
+
+ {
+ Label label = new Label(composite, SWT.NONE);
+ label.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true, 1, 1));
+ }
+
+ {
+ quantity = new Label(composite, SWT.NONE);
+ quantity.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE));
+ quantity.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));
+ quantity.setAlignment(SWT.CENTER);
+ quantity.setFont(SWTResourceManager.getFont("Comic Sans MS", 32, SWT.BOLD));
+ quantity.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false, 1, 1));
+ quantity.setText("0");
+ }
+
+ {
+ Composite composite_1 = new Composite(composite, SWT.NONE);
+ composite_1.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));
+ composite_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
+ FillLayout fillLayout = new FillLayout(SWT.HORIZONTAL);
+ fillLayout.spacing = 5;
+ composite_1.setLayout(fillLayout);
+ {
+ buttonDelete = new Button(composite_1, SWT.NONE);
+ buttonDelete.setToolTipText("Weniger bestellen");
+ buttonDelete.addSelectionListener(new SelectionAdapter()
+ {
+ @Override
+ public void widgetSelected(SelectionEvent e)
+ {
+ deleteOrder();
+ }
+ });
+
+ buttonDelete.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/delete.gif"));
+ }
+
+ {
+ buttonAdd = new Button(composite_1, SWT.NONE);
+ buttonAdd.setToolTipText("Mehr bestellen");
+ buttonAdd.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/add.gif"));
+ buttonAdd.addSelectionListener(new SelectionAdapter()
+ {
+ @Override
+ public void widgetSelected(SelectionEvent e)
+ {
+ addOrder();
+ }
+ });
+ }
+ }
+
+ {
+ Label label = new Label(composite, SWT.NONE);
+ label.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true, 1, 1));
+ }
+
+ {
+ Button buttonNext = new Button(composite, SWT.NONE);
+ buttonNext.setToolTipText("N\u00E4chster Eintrag");
+ buttonNext.addSelectionListener(new SelectionAdapter()
+ {
+ @Override
+ public void widgetSelected(SelectionEvent e)
+ {
+ nextMenu();
+ }
+ });
+
+ buttonNext.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/down.png"));
+ }
+ }
+
+ shelfItem.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/menucard.png"));
+ shelfItem.setText(" Speisen und Getr\u00E4nke");
+ }
+
+ {
+ PShelfItem shelfItem = new PShelfItem(shelf, SWT.NONE);
+ GridLayout gridLayout = new GridLayout(2, false);
+ gridLayout.horizontalSpacing = 0;
+ gridLayout.verticalSpacing = 0;
+ gridLayout.marginWidth = 0;
+ gridLayout.marginHeight = 0;
+ shelfItem.getBody().setLayout(gridLayout);
+ {
+ orderViewer = new TableViewer(shelfItem.getBody(), SWT.HIDE_SELECTION);
+
+ Table table = orderViewer.getTable();
+ table.setLinesVisible(true);
+ table.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE));
+ table.setFont(SWTResourceManager.getFont("Comic Sans MS", 16, SWT.BOLD));
+ {
+ GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
+ gridData.widthHint = 300;
+ table.setLayoutData(gridData);
+ }
+
+ {
+ TableViewerColumn tableViewerColumn = new TableViewerColumn(orderViewer, SWT.NONE);
+ TableColumn tblclmnQuantity = tableViewerColumn.getColumn();
+ tblclmnQuantity.setResizable(false);
+ tblclmnQuantity.setAlignment(SWT.RIGHT);
+ tblclmnQuantity.setWidth(70);
+ tblclmnQuantity.setText("Quantity");
+ }
+
+ {
+ TableViewerColumn tableViewerColumn = new TableViewerColumn(orderViewer, SWT.NONE);
+ TableColumn tblclmnOffering = tableViewerColumn.getColumn();
+ tblclmnOffering.setWidth(410);
+ tblclmnOffering.setText("Offering");
+ }
+
+ {
+ TableViewerColumn tableViewerColumn = new TableViewerColumn(orderViewer, SWT.NONE);
+ TableColumn tblclmnPrice = tableViewerColumn.getColumn();
+ tblclmnPrice.setResizable(false);
+ tblclmnPrice.setAlignment(SWT.RIGHT);
+ tblclmnPrice.setWidth(100);
+ tblclmnPrice.setText("Price");
+ }
+
+ {
+ TableViewerColumn tableViewerColumn = new TableViewerColumn(orderViewer, SWT.NONE);
+ TableColumn tblclmnSum = tableViewerColumn.getColumn();
+ tblclmnSum.setResizable(false);
+ tblclmnSum.setAlignment(SWT.RIGHT);
+ tblclmnSum.setWidth(117);
+ tblclmnSum.setText("Sum");
+ }
+
+ orderViewer.setContentProvider(new AdapterFactoryContentProvider(FACTORY));
+ orderViewer.setLabelProvider(new AdapterFactoryLabelProvider(FACTORY)
+ {
+ @Override
+ public String getColumnText(Object object, int columnIndex)
+ {
+ switch (columnIndex)
+ {
+ case 0:
+ return "" + ((OrderDetail)object).getQuantity() + "x";
+ case 1:
+ return ((OrderDetail)object).getOffering().getName();
+ case 2:
+ return formatPrice(((OrderDetail)object).getOffering().getPrice());
+ case 3:
+ return formatPrice(((OrderDetail)object).getPrice());
+
+ default:
+ return super.getColumnText(object, columnIndex);
+ }
+ }
+
+ @Override
+ public Image getColumnImage(Object object, int columnIndex)
+ {
+ return null;
+ }
+ });
+ }
+
+ {
+ Composite composite = new Composite(shelfItem.getBody(), SWT.NONE);
+ composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
+ GridLayout gridLayout_1 = new GridLayout(1, false);
+ gridLayout_1.marginHeight = 0;
+ gridLayout_1.marginWidth = 0;
+ composite.setLayout(gridLayout_1);
+ composite.setBounds(0, 0, 64, 64);
+ {
+ Button buttonCancel = new Button(composite, SWT.NONE);
+ buttonCancel.addSelectionListener(new SelectionAdapter()
+ {
+ @Override
+ public void widgetSelected(SelectionEvent e)
+ {
+ cancelOrder();
+ }
+ });
+
+ buttonCancel.setToolTipText("Bestellung abbrechen");
+ buttonCancel.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/cancel.png"));
+ }
+
+ {
+ Label labelTotalPrice = new Label(composite, SWT.NONE);
+ labelTotalPrice.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));
+ labelTotalPrice.setAlignment(SWT.CENTER);
+ labelTotalPrice.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, true, 1, 1));
+ }
+
+ {
+ Button buttonSend = new Button(composite, SWT.NONE);
+ buttonSend.addSelectionListener(new SelectionAdapter()
+ {
+ @Override
+ public void widgetSelected(SelectionEvent e)
+ {
+ sendOrder();
+ }
+ });
+
+ buttonSend.setToolTipText("Bestellung absenden");
+ buttonSend.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/send.png"));
+ }
+ }
+
+ shelfItem.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/order.png"));
+ shelfItem.setText(" Bestellung");
+ }
+
+ {
+ PShelfItem shelfItem = new PShelfItem(shelf, SWT.NONE);
+ shelfItem.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/payment.png"));
+ shelfItem.setText(" Bezahlung");
+ }
+
+ {
+ PShelfItem shelfItem = new PShelfItem(shelf, SWT.NONE);
+ shelfItem.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/service.png"));
+ shelfItem.setText(" Service");
+ }
+
+ shelf.addSelectionListener(new SelectionAdapter()
+ {
+ @Override
+ public void widgetSelected(SelectionEvent e)
+ {
+ orderViewer.refresh(true);
+ }
+ });
+
+ createNewOrder();
+ }
+ }
+
+ protected void nextMenu()
+ {
+ EList<EObject> menuItems = getAllMenuItems();
+ int index = menuItems.indexOf(currentItem);
+ if (index >= 0 && index < menuItems.size() - 1)
+ {
+ menuViewer.setSelection(new StructuredSelection(menuItems.get(index + 1)));
+ }
+ }
+
+ protected void prevMenu()
+ {
+ EList<EObject> menuItems = getAllMenuItems();
+ int index = menuItems.indexOf(currentItem);
+ if (index > 0)
+ {
+ menuViewer.setSelection(new StructuredSelection(menuItems.get(index - 1)));
+ }
+ }
+
+ protected void showMenuCard()
+ {
+ OrderDetail oldOrderDetail = orderDetail;
+ if (currentItem instanceof Section)
+ {
+ Section section = (Section)currentItem;
+ updateMenuDetail( //
+ section.getTitle(), //
+ section.getText(), //
+ null, //
+ false);
+ orderDetail = null;
+ }
+ else if (currentItem instanceof Offering)
+ {
+ Offering offering = (Offering)currentItem;
+ updateMenuDetail( //
+ offering.getName(), //
+ offering.getDescription(), //
+ formatPrice(offering.getPrice()), //
+ true);
+ orderDetail = getOrderDetail(offering);
+ }
+
+ if (oldOrderDetail != null && oldOrderDetail != orderDetail)
+ {
+ if (oldOrderDetail.getQuantity() == 0)
+ {
+ order.getOrderDetails().remove(oldOrderDetail);
+ }
+ }
+
+ updateOrderDetail();
+ }
+
+ protected void addOrder()
+ {
+ if (orderDetail == null)
+ {
+ orderDetail = BusinessFactory.eINSTANCE.createOrderDetail();
+ orderDetail.setOffering((Offering)currentItem);
+ orderDetail.setQuantity(1);
+ order.getOrderDetails().add(orderDetail);
+ }
+ else
+ {
+ orderDetail.setQuantity(orderDetail.getQuantity() + 1);
+ }
+
+ updateOrderDetail();
+ }
+
+ protected void deleteOrder()
+ {
+ int quantity = orderDetail.getQuantity();
+ if (quantity == 1)
+ {
+ order.getOrderDetails().remove(orderDetail);
+ orderDetail = null;
+ }
+ else
+ {
+ orderDetail.setQuantity(quantity - 1);
+ }
+
+ updateOrderDetail();
+ }
+
+ protected void sendOrder()
+ {
+ ITransactionalOperation<BusinessDay> operation = new ITransactionalOperation<BusinessDay>()
+ {
+ public Object execute(BusinessDay businessDay)
+ {
+ businessDay.cdoWriteLock().lock();
+ EList<Order> orders = businessDay.getOrders();
+ order.setNumber(getNextOrderNumber(orders));
+ orders.add(order);
+ return null;
+ }
+ };
+
+ IModel.INSTANCE.modify(IModel.INSTANCE.getBusinessDay(), operation);
+ createNewOrder();
+ }
+
+ protected void cancelOrder()
+ {
+ createNewOrder();
+ }
+
+ private EList<EObject> getAllMenuItems()
+ {
+ MenuCard menuCard = (MenuCard)menuViewer.getInput();
+ EList<EObject> result = new BasicEList<EObject>();
+ for (Iterator<EObject> it = menuCard.eAllContents(); it.hasNext();)
+ {
+ result.add(it.next());
+ }
+
+ return result;
+ }
+
+ private void createNewOrder()
+ {
+ order = BusinessFactory.eINSTANCE.createOrder();
+ order.setTable((org.gastro.inventory.Table)IModel.INSTANCE.getStation());
+ orderViewer.setInput(order);
+
+ orderDetail = null;
+ updateOrderDetail();
+ }
+
+ private int getNextOrderNumber(EList<Order> orders)
+ {
+ int count = orders.size();
+ if (count > 0)
+ {
+ return orders.get(count - 1).getNumber() + 1;
+ }
+
+ return 1;
+ }
+
+ private OrderDetail getOrderDetail(Offering offering)
+ {
+ for (OrderDetail orderDetail : order.getOrderDetails())
+ {
+ if (orderDetail.getOffering() == offering)
+ {
+ return orderDetail;
+ }
+ }
+
+ return null;
+ }
+
+ private void updateMenuDetail(String title, String description, String price, boolean withImage)
+ {
+ menuTitle.setText(StringUtil.safe(title));
+ menuDescription.setText(StringUtil.safe(description));
+ menuPrice.setText(StringUtil.safe(price));
+
+ if (title == null || !withImage)
+ {
+ menuImage.setImage(null);
+ }
+ else
+ {
+ String name = fakeImages.get(title);
+ if (name == null)
+ {
+ for (;;)
+ {
+ name = "meal-" + ++fakeImageID;
+ Image image = getCachedImage(name);
+ if (image != null)
+ {
+ fakeImages.put(title, name);
+ menuImage.setImage(getCachedImage(name));
+ break;
+ }
+
+ fakeImageID = 0;
+ }
+ }
+ else
+ {
+ menuImage.setImage(getCachedImage(name));
+ }
+ }
+
+ menuImage.getParent().getParent().layout(true);
+ }
+
+ private void updateOrderDetail()
+ {
+ if (currentItem instanceof Offering)
+ {
+ if (orderDetail != null)
+ {
+ quantity.setText("" + orderDetail.getQuantity());
+ buttonDelete.setEnabled(true);
+ }
+ else
+ {
+ quantity.setText("0");
+ buttonDelete.setEnabled(false);
+ }
+
+ quantity.setVisible(true);
+ buttonAdd.setVisible(true);
+ buttonDelete.setVisible(true);
+ }
+ else
+ {
+ quantity.setVisible(false);
+ buttonAdd.setVisible(false);
+ buttonDelete.setVisible(false);
+ }
+ }
+
+ private Image getCachedImage(String name)
+ {
+ return ResourceManager.getPluginImage("org.gastro.rcp.table", "images/" + name + ".png");
+ }
+
+ private String formatPrice(float price)
+ {
+ return NumberFormat.getCurrencyInstance().format(price);
+ }
+}
|