commit 23571ab1fa7fedc262d6c21510614353e9d8a4dc Author: Shawn O. Pearce Date: Fri Nov 14 16:56:58 2008 -0800 Initial project setup of Gerrit 2 Gerrit 2 is a ground-up rewrite of Gerrit, using GWT (Google Web Toolkit) for the client side user interface and a Java servlet based backend. Signed-off-by: Shawn O. Pearce diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..58378e968e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/config.mak diff --git a/COPYING b/COPYING new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/COPYING @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..587cdbfdcd --- /dev/null +++ b/Makefile @@ -0,0 +1,101 @@ +# Gerrit +# +# Copyright 2008 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Define GWT_SDK to the location of the Google Web Toolkit SDK. +# +# Define GEN_DEBUG to save the generated Java code from GWT. +# + +uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') + +JAVA = java +JAVA_ARGS = -Xmx265m +GWT_OS = unknown +GWT_FLAGS = +gwtjsonrpc = ../gwtjsonrpc + +ifeq ($(uname_S),Darwin) + GWT_OS = mac +endif +ifeq ($(uname_S),Linux) + GWT_OS = linux +endif +ifeq ($(uname_S),Cygwin) + GWT_OS = win +endif + +-include config.mak + +WEBAPP = webapp +WEB_MAIN = com.google.gerrit.Gerrit +GWT_CP = \ + $(GWT_SDK)/gwt-user.jar \ + $(GWT_SDK)/gwt-dev-$(GWT_OS).jar \ + lib/gwtjsonrpc.jar +#end GWT_CP + +ifdef GEN_DEBUG + GWT_FLAGS += -gen gensrc +endif + +all: web + +clean: + rm -f $(WEBAPP)/lib/gwtjsonrpc.jar + rm -f $(WEBAPP)/lib/gson.jar + rm -f $(WEBAPP)/lib/commons-codec.jar + rm -rf $(WEBAPP)/gensrc + rm -rf $(WEBAPP)/classes + rm -rf $(WEBAPP)/www + rm -rf $(WEBAPP)/tomcat + +web: web-lib + CLASSPATH=src:classes && \ + $(foreach p,$(GWT_CP),CLASSPATH=$$CLASSPATH:$p &&) \ + export CLASSPATH && \ + cd $(WEBAPP) && $(JAVA) $(JAVA_ARGS) \ + com.google.gwt.dev.GWTCompiler \ + -out www \ + $(GWT_FLAGS) \ + $(WEB_MAIN) + +web-shell: web-lib + CLASSPATH=src:classes && \ + $(foreach p,$(GWT_CP),CLASSPATH=$$CLASSPATH:$p &&) \ + export CLASSPATH && \ + cd $(WEBAPP) && $(JAVA) $(JAVA_ARGS) \ + com.google.gwt.dev.GWTShell \ + -out www \ + $(WEB_MAIN)/Gerrit.html + +web-lib: \ + $(WEBAPP)/lib/gson.jar \ + $(WEBAPP)/lib/commons-codec.jar \ + $(WEBAPP)/lib/gwtjsonrpc.jar + +$(WEBAPP)/lib/gwtjsonrpc.jar: $(gwtjsonrpc)/lib/gwtjsonrpc.jar + cp $< $@ +$(WEBAPP)/lib/gson.jar: $(gwtjsonrpc)/lib/gson.jar + cp $< $@ +$(WEBAPP)/lib/commons-codec.jar: $(gwtjsonrpc)/lib/commons-codec.jar + cp $< $@ +$(gwtjsonrpc)/lib/gwtjsonrpc.jar: make-gwtjsonrpc + $(MAKE) -C $(gwtjsonrpc) GWT_SDK=$(GWT_SDK) +.PHONY: make-gwtjsonrpc + +.PHONY: all +.PHONY: clean +.PHONY: web web-shell web-lib diff --git a/README_ECLIPSE b/README_ECLIPSE new file mode 100644 index 0000000000..ba31783f1e --- /dev/null +++ b/README_ECLIPSE @@ -0,0 +1,18 @@ +Eclipse Setup +============= + +User Library +------------ + + Window > Preferences + Java > Build Path > User Libraries + +Create a User Library called "GWT": + + New + + Name: GWT + Add JARs... + + * Select gwt-user.jar from the $(GWT_SDK) directory. + * Select gwt-dev-$(GWT_OS).jar from the $(GWT_SDK) directory. diff --git a/webapp/.classpath b/webapp/.classpath new file mode 100644 index 0000000000..2cccd38922 --- /dev/null +++ b/webapp/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/webapp/.gitignore b/webapp/.gitignore new file mode 100644 index 0000000000..07480bf410 --- /dev/null +++ b/webapp/.gitignore @@ -0,0 +1,8 @@ +/classes +/tomcat +/www +/gensrc +/lib/*_src.zip +/lib/gwtjsonrpc.jar +/lib/gson.jar +/lib/commons-codec.jar diff --git a/webapp/.project b/webapp/.project new file mode 100644 index 0000000000..ca7d4b5f83 --- /dev/null +++ b/webapp/.project @@ -0,0 +1,17 @@ + + + Gerrit-webapp + GerritUI project + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/webapp/.settings/org.eclipse.core.resources.prefs b/webapp/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000000..82eb859e3b --- /dev/null +++ b/webapp/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +#Tue Sep 02 16:59:24 PDT 2008 +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/webapp/.settings/org.eclipse.core.runtime.prefs b/webapp/.settings/org.eclipse.core.runtime.prefs new file mode 100644 index 0000000000..8667cfd4a3 --- /dev/null +++ b/webapp/.settings/org.eclipse.core.runtime.prefs @@ -0,0 +1,3 @@ +#Tue Sep 02 16:59:24 PDT 2008 +eclipse.preferences.version=1 +line.separator=\n diff --git a/webapp/.settings/org.eclipse.jdt.core.prefs b/webapp/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..fa64d21829 --- /dev/null +++ b/webapp/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,268 @@ +#Thu Sep 04 11:18:51 PDT 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=16 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=0 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=0 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=2 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=true +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=80 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=3 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=2 +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true diff --git a/webapp/.settings/org.eclipse.jdt.ui.prefs b/webapp/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000000..f37f6f00a4 --- /dev/null +++ b/webapp/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,9 @@ +#Tue Sep 02 17:00:18 PDT 2008 +eclipse.preferences.version=1 +formatter_profile=_Google Format +formatter_settings_version=11 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=com.google;com;junit;net;org;java;javax; +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= diff --git a/webapp/Gerrit-webapp.launch b/webapp/Gerrit-webapp.launch new file mode 100644 index 0000000000..87d45f30ff --- /dev/null +++ b/webapp/Gerrit-webapp.launch @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/webapp/src/com/google/gerrit/Gerrit.gwt.xml b/webapp/src/com/google/gerrit/Gerrit.gwt.xml new file mode 100644 index 0000000000..f86efa656f --- /dev/null +++ b/webapp/src/com/google/gerrit/Gerrit.gwt.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff --git a/webapp/src/com/google/gerrit/client/Gerrit.java b/webapp/src/com/google/gerrit/client/Gerrit.java new file mode 100644 index 0000000000..ed475a1ef4 --- /dev/null +++ b/webapp/src/com/google/gerrit/client/Gerrit.java @@ -0,0 +1,97 @@ +// Copyright 2008 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.gerrit.client; + +import com.google.gwt.core.client.EntryPoint; +import com.google.gwt.core.client.GWT; +import com.google.gwt.user.client.History; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.WindowResizeListener; +import com.google.gwt.user.client.ui.DockPanel; +import com.google.gwt.user.client.ui.FlowPanel; +import com.google.gwt.user.client.ui.Hyperlink; +import com.google.gwt.user.client.ui.RootPanel; +import com.google.gwt.user.client.ui.StackPanel; + +public class Gerrit implements EntryPoint { + public static GerritConstants C; + private static Link linkManager; + + static DockPanel body; + static StackPanel leftMenu; + private static Screen currentScreen; + + public static void display(final Screen view) { + if (currentScreen != null) { + body.remove(currentScreen); + } + + currentScreen = view; + body.add(currentScreen, DockPanel.CENTER); + } + + public void onModuleLoad() { + C = GWT.create(GerritConstants.class); + linkManager = new Link(); + History.addHistoryListener(linkManager); + + body = new DockPanel(); + body.setWidth("100%"); + body.setHeight(Window.getClientHeight() + "px"); + Window.addWindowResizeListener(new WindowResizeListener() { + public void onWindowResized(final int width, final int height) { + body.setHeight(height + "px"); + } + }); + RootPanel.get("gerrit_body").add(body); + + leftMenu = new StackPanel(); + leftMenu.addStyleName("gerrit-LeftMenu"); + leftMenu.add(createCodeReviewMenu(), C.leftMenuCodeReviews()); + leftMenu.add(createAdminMenu(), C.leftMenuAdmin()); + body.add(leftMenu, DockPanel.WEST); + body.setCellWidth(leftMenu, "150px"); + + if ("".equals(History.getToken())) { + History.newItem(Link.MINE); + } else { + History.fireCurrentHistoryState(); + } + } + + private FlowPanel createCodeReviewMenu() { + final FlowPanel menu = new FlowPanel(); + menu.setStyleName("gerrit-MenuList"); + + menu.add(new Hyperlink(C.menuMyChanges(), Link.MINE)); + menu.add(new Hyperlink(C.menuMyUnclaimedChanges(), Link.MINE_UNCLAIMED)); + menu.add(new Hyperlink(C.menuAllRecentChanges(), Link.ALL)); + menu.add(new Hyperlink(C.menuAllUnclaimedChanges(), Link.ALL_UNCLAIMED)); + menu.add(new Hyperlink(C.menuMyStarredChanges(), Link.MINE_STARRED)); + + return menu; + } + + private FlowPanel createAdminMenu() { + final FlowPanel menu = new FlowPanel(); + menu.setStyleName("gerrit-MenuList"); + + menu.add(new Hyperlink(C.menuPeople(), Link.ADMIN_PEOPLE)); + menu.add(new Hyperlink(C.menuGroups(), Link.ADMIN_GROUPS)); + menu.add(new Hyperlink(C.menuProjects(), Link.ADMIN_PROJECTS)); + + return menu; + } +} diff --git a/webapp/src/com/google/gerrit/client/GerritConstants.java b/webapp/src/com/google/gerrit/client/GerritConstants.java new file mode 100644 index 0000000000..73068ef5ff --- /dev/null +++ b/webapp/src/com/google/gerrit/client/GerritConstants.java @@ -0,0 +1,31 @@ +// Copyright 2008 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.gerrit.client; + +import com.google.gwt.i18n.client.Constants; + +public interface GerritConstants extends Constants { + String leftMenuCodeReviews(); + String menuMyChanges(); + String menuMyUnclaimedChanges(); + String menuAllUnclaimedChanges(); + String menuAllRecentChanges(); + String menuMyStarredChanges(); + + String leftMenuAdmin(); + String menuPeople(); + String menuGroups(); + String menuProjects(); +} diff --git a/webapp/src/com/google/gerrit/client/GerritConstants.properties b/webapp/src/com/google/gerrit/client/GerritConstants.properties new file mode 100644 index 0000000000..307dbf4e90 --- /dev/null +++ b/webapp/src/com/google/gerrit/client/GerritConstants.properties @@ -0,0 +1,11 @@ +leftMenuCodeReviews = Code Reviews +menuMyChanges = My Changes +menuMyUnclaimedChanges = Unclaimed Changes +menuAllUnclaimedChanges = All Unclaimed Changes +menuAllRecentChanges = Recent Changes +menuMyStarredChanges = Starred Changes + +leftMenuAdmin = Admin +menuPeople = People +menuGroups = Groups +menuProjects = Projects diff --git a/webapp/src/com/google/gerrit/client/Link.java b/webapp/src/com/google/gerrit/client/Link.java new file mode 100644 index 0000000000..c24a9daa5d --- /dev/null +++ b/webapp/src/com/google/gerrit/client/Link.java @@ -0,0 +1,65 @@ +// Copyright 2008 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.gerrit.client; + +import com.google.gerrit.client.changes.ChangeScreen; +import com.google.gerrit.client.changes.MineScreen; +import com.google.gerrit.client.changes.MineStarredScreen; +import com.google.gerrit.client.data.ChangeHeader; +import com.google.gwt.user.client.HistoryListener; + +public class Link implements HistoryListener { + public static final String MINE = "mine"; + public static final String MINE_UNCLAIMED = "mine,unclaimed"; + public static final String MINE_STARRED = "mine,starred"; + + public static final String ALL = "all"; + public static final String ALL_UNCLAIMED = "all,unclaimed"; + + public static final String ADMIN_PEOPLE = "admin,people"; + public static final String ADMIN_GROUPS = "admin,groups"; + public static final String ADMIN_PROJECTS = "admin,projects"; + + public static String toChange(final ChangeHeader c) { + return "change," + c.id; + } + + public void onHistoryChanged(final String token) { + final Screen s = select(token); + if (s != null) { + Gerrit.display(s); + } else { + // TODO show error + } + } + + private Screen select(final String token) { + if (token == null) + return null; + + else if (MINE.equals(token)) + return new MineScreen(); + + else if (MINE_STARRED.equals(token)) + return new MineStarredScreen(); + + else if (token.matches("^change,\\d+$")) { + final String id = token.substring("change,".length()); + return new ChangeScreen(Integer.parseInt(id)); + } + + return null; + } +} diff --git a/webapp/src/com/google/gerrit/client/Screen.java b/webapp/src/com/google/gerrit/client/Screen.java new file mode 100644 index 0000000000..22dae49126 --- /dev/null +++ b/webapp/src/com/google/gerrit/client/Screen.java @@ -0,0 +1,28 @@ +// Copyright 2008 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.gerrit.client; + +import com.google.gwt.user.client.ui.FlowPanel; +import com.google.gwt.user.client.ui.Label; + +public class Screen extends FlowPanel { + public Screen(final String heading) { + setStyleName("gerrit-Screen"); + + final Label hLabel = new Label(heading); + hLabel.setStyleName("gerrit-ScreenHeading"); + add(hLabel); + } +} diff --git a/webapp/src/com/google/gerrit/client/changes/ChangeConstants.java b/webapp/src/com/google/gerrit/client/changes/ChangeConstants.java new file mode 100644 index 0000000000..f6d7422c8b --- /dev/null +++ b/webapp/src/com/google/gerrit/client/changes/ChangeConstants.java @@ -0,0 +1,34 @@ +// Copyright 2008 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.gerrit.client.changes; + +import com.google.gwt.i18n.client.Constants; + +public interface ChangeConstants extends Constants { + String mineHeading(); + String mineByMe(); + String mineForReview(); + String mineClosed(); + + String starredHeading(); + + String changeTableColumnID(); + String changeTableColumnSubject(); + String changeTableColumnOwner(); + String changeTableColumnReviewers(); + String changeTableColumnProject(); + String changeTableColumnLastUpdate(); + String changeTableNone(); +} diff --git a/webapp/src/com/google/gerrit/client/changes/ChangeConstants.properties b/webapp/src/com/google/gerrit/client/changes/ChangeConstants.properties new file mode 100644 index 0000000000..0474061b63 --- /dev/null +++ b/webapp/src/com/google/gerrit/client/changes/ChangeConstants.properties @@ -0,0 +1,27 @@ +leftMenuCodeReviews = Code Reviews +menuMyChanges = My Changes +menuMyUnclaimedChanges = Unclaimed Changes +menuAllUnclaimedChanges = All Unclaimed Changes +menuAllRecentChanges = Recent Changes +menuMyStarredChanges = Starred Changes + +leftMenuAdmin = Admin +menuPeople = People +menuGroups = Groups +menuProjects = Projects + +mineHeading = Changes for me +mineByMe = Changes uploaded by me +mineForReview = Changes reviewable by me +mineClosed = Recently closed changes + +starredHeading = Starred Changes + +changeTableColumnID = ID +changeTableColumnSubject = Subject +changeTableColumnOwner = Owner +changeTableColumnReviewers = Reviewers +changeTableColumnProject = Project +changeTableColumnLastUpdate = LastUpdate +changeTableNone = (None) + \ No newline at end of file diff --git a/webapp/src/com/google/gerrit/client/changes/ChangeLink.java b/webapp/src/com/google/gerrit/client/changes/ChangeLink.java new file mode 100644 index 0000000000..8405709bec --- /dev/null +++ b/webapp/src/com/google/gerrit/client/changes/ChangeLink.java @@ -0,0 +1,41 @@ +// Copyright 2008 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.gerrit.client.changes; + +import com.google.gerrit.client.Gerrit; +import com.google.gerrit.client.Link; +import com.google.gerrit.client.data.ChangeHeader; +import com.google.gwt.user.client.DOM; +import com.google.gwt.user.client.Event; +import com.google.gwt.user.client.History; +import com.google.gwt.user.client.ui.Hyperlink; + +public class ChangeLink extends Hyperlink { + private ChangeHeader change; + + public ChangeLink(final String text, final ChangeHeader c) { + super(text, Link.toChange(c)); + change = c; + } + + @Override + public void onBrowserEvent(final Event event) { + if (DOM.eventGetType(event) == Event.ONCLICK) { + History.newItem(getTargetHistoryToken(), false); + Gerrit.display(new ChangeScreen(change)); + DOM.eventPreventDefault(event); + } + } +} diff --git a/webapp/src/com/google/gerrit/client/changes/ChangeScreen.java b/webapp/src/com/google/gerrit/client/changes/ChangeScreen.java new file mode 100644 index 0000000000..b669a9ce60 --- /dev/null +++ b/webapp/src/com/google/gerrit/client/changes/ChangeScreen.java @@ -0,0 +1,29 @@ +// Copyright 2008 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.gerrit.client.changes; + +import com.google.gerrit.client.Screen; +import com.google.gerrit.client.data.ChangeHeader; + + +public class ChangeScreen extends Screen { + public ChangeScreen(final int id) { + super("Loading Change " + id); + } + + public ChangeScreen(final ChangeHeader c) { + super(c.subject); + } +} diff --git a/webapp/src/com/google/gerrit/client/changes/ChangeTable.java b/webapp/src/com/google/gerrit/client/changes/ChangeTable.java new file mode 100644 index 0000000000..ac60733415 --- /dev/null +++ b/webapp/src/com/google/gerrit/client/changes/ChangeTable.java @@ -0,0 +1,175 @@ +// Copyright 2008 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.gerrit.client.changes; + +import com.google.gerrit.client.data.ChangeHeader; +import com.google.gwt.user.client.ui.FlexTable; + +import java.util.ArrayList; +import java.util.List; + +public class ChangeTable extends FlexTable { + private static final int C_ID = 0; + private static final int C_SUBJECT = 1; + private static final int C_OWNER = 2; + private static final int C_REVIEWERS = 3; + private static final int C_PROJECT = 4; + private static final int C_LAST_UPDATE = 5; + private static final int COLUMNS = 6; + + private final List
sections; + + public ChangeTable() { + sections = new ArrayList
(); + addStyleName("gerrit-ChangeTable"); + + setColumnHeader(C_ID, Util.C.changeTableColumnID()); + setColumnHeader(C_SUBJECT, Util.C.changeTableColumnSubject()); + setColumnHeader(C_OWNER, Util.C.changeTableColumnOwner()); + setColumnHeader(C_REVIEWERS, Util.C.changeTableColumnReviewers()); + setColumnHeader(C_PROJECT, Util.C.changeTableColumnProject()); + setColumnHeader(C_LAST_UPDATE, Util.C.changeTableColumnLastUpdate()); + + getFlexCellFormatter().addStyleName(0, C_ID, "gerrit-ChangeTable-ColumnID"); + } + + private void setColumnHeader(final int col, final String text) { + setText(0, col, text); + setStyleName(0, col, "gerrit-ChangeTable-ColumnHeader"); + } + + private void insertNoneRow(final int row) { + insertRow(row); + setText(row, 0, Util.C.changeTableNone()); + getFlexCellFormatter().setColSpan(row, 0, COLUMNS); + setStyleName(row, 0, "gerrit-ChangeTable-EmptySectionRow"); + } + + private void insertChangeRow(final int row) { + insertRow(row); + setStyleName(row, C_ID, "gerrit-ChangeTable-ColumnID"); + } + + private void populateChangeRow(final int row, final ChangeHeader c) { + setWidget(row, C_ID, new ChangeLink(String.valueOf(c.id), c)); + + String s = c.subject; + if (c.status != null) { + s += " (" + c.status + ")"; + } + setWidget(row, C_SUBJECT, new ChangeLink(s, c)); + + setText(row, C_OWNER, c.owner.fullName); + setText(row, C_REVIEWERS, "TODO"); + setText(row, C_PROJECT, c.project.name); + setText(row, C_LAST_UPDATE, c.lastUpdate.toString()); + } + + private void setStyleName(final int row, final int col, final String name) { + getFlexCellFormatter().setStyleName(row, col, name); + } + + public void addSection(final Section s) { + assert s.table == null; + + if (s.titleText != null) { + s.titleRow = getRowCount(); + setText(s.titleRow, 0, s.titleText); + getFlexCellFormatter().setColSpan(s.titleRow, 0, COLUMNS); + setStyleName(s.titleRow, 0, "gerrit-ChangeTable-SectionHeader"); + } else { + s.titleRow = -1; + } + + s.table = this; + s.dataBegin = getRowCount(); + insertNoneRow(s.dataBegin); + sections.add(s); + } + + @Override + public int insertRow(final int beforeRow) { + for (final Section s : sections) { + boolean dirty = false; + if (beforeRow <= s.titleRow) { + s.titleRow++; + } + if (beforeRow < s.dataBegin) { + s.dataBegin++; + } + } + return super.insertRow(beforeRow); + } + + @Override + public void removeRow(final int row) { + for (final Section s : sections) { + if (row < s.titleRow) { + s.titleRow--; + } + if (row < s.dataBegin) { + s.dataBegin--; + } + } + super.removeRow(row); + } + + public static class Section { + String titleText; + + ChangeTable table; + int titleRow; + int dataBegin; + int rows; + + public Section() { + this(null); + } + + public Section(final String titleText) { + this.titleText = titleText; + } + + public void display(final List changeList) { + final int sz = changeList != null ? changeList.size() : 0; + final boolean hadData = rows > 0; + + if (hadData) { + while (sz < rows) { + table.removeRow(dataBegin); + rows--; + } + } + + if (sz == 0) { + if (hadData) { + table.insertNoneRow(dataBegin); + } + } else { + if (!hadData) { + table.removeRow(dataBegin); + } + + while (rows < sz) { + table.insertChangeRow(dataBegin + rows); + rows++; + } + for (int i = 0; i < sz; i++) { + table.populateChangeRow(dataBegin + i, changeList.get(i)); + } + } + } + } +} diff --git a/webapp/src/com/google/gerrit/client/changes/MineScreen.java b/webapp/src/com/google/gerrit/client/changes/MineScreen.java new file mode 100644 index 0000000000..e2684b12d2 --- /dev/null +++ b/webapp/src/com/google/gerrit/client/changes/MineScreen.java @@ -0,0 +1,55 @@ +// Copyright 2008 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.gerrit.client.changes; + +import com.google.gerrit.client.Screen; +import com.google.gerrit.client.data.MineResult; +import com.google.gwt.core.client.GWT; +import com.google.gwt.user.client.rpc.AsyncCallback; + + +public class MineScreen extends Screen { + private ChangeTable table; + private ChangeTable.Section byMe; + private ChangeTable.Section forReview; + private ChangeTable.Section closed; + + public MineScreen() { + super(Util.C.mineHeading()); + + table = new ChangeTable(); + byMe = new ChangeTable.Section(Util.C.mineByMe()); + forReview = new ChangeTable.Section(Util.C.mineForReview()); + closed = new ChangeTable.Section(Util.C.mineClosed()); + + Util.LIST_SVC.mine(new AsyncCallback() { + public void onSuccess(final MineResult r) { + byMe.display(r.byMe); + forReview.display(r.forReview); + closed.display(r.closed); + } + + public void onFailure(final Throwable caught) { + GWT.log("Fail", caught); + } + }); + + table.addSection(byMe); + table.addSection(forReview); + table.addSection(closed); + + add(table); + } +} diff --git a/webapp/src/com/google/gerrit/client/changes/MineStarredScreen.java b/webapp/src/com/google/gerrit/client/changes/MineStarredScreen.java new file mode 100644 index 0000000000..a429da7f11 --- /dev/null +++ b/webapp/src/com/google/gerrit/client/changes/MineStarredScreen.java @@ -0,0 +1,34 @@ +// Copyright 2008 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.gerrit.client.changes; + +import com.google.gerrit.client.Screen; + + +public class MineStarredScreen extends Screen { + private ChangeTable table; + private ChangeTable.Section starred; + + public MineStarredScreen() { + super(Util.C.starredHeading()); + + table = new ChangeTable(); + starred = new ChangeTable.Section(); + + table.addSection(starred); + + add(table); + } +} diff --git a/webapp/src/com/google/gerrit/client/changes/Util.java b/webapp/src/com/google/gerrit/client/changes/Util.java new file mode 100644 index 0000000000..619d0cdf67 --- /dev/null +++ b/webapp/src/com/google/gerrit/client/changes/Util.java @@ -0,0 +1,31 @@ +// Copyright 2008 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.gerrit.client.changes; + +import com.google.gerrit.client.data.ChangeListService; +import com.google.gwt.core.client.GWT; +import com.google.gwt.user.client.rpc.ServiceDefTarget; + +public class Util { + public static final ChangeConstants C = GWT.create(ChangeConstants.class); + + public static final ChangeListService LIST_SVC; + + static { + LIST_SVC = GWT.create(ChangeListService.class); + ((ServiceDefTarget) LIST_SVC).setServiceEntryPoint(GWT.getModuleBaseURL() + + "rpc/ChangeListService"); + } +} diff --git a/webapp/src/com/google/gerrit/client/data/ChangeHeader.java b/webapp/src/com/google/gerrit/client/data/ChangeHeader.java new file mode 100644 index 0000000000..c3e39a0ff9 --- /dev/null +++ b/webapp/src/com/google/gerrit/client/data/ChangeHeader.java @@ -0,0 +1,28 @@ +// Copyright 2008 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.gerrit.client.data; + +import java.util.Date; +import java.util.List; + +public class ChangeHeader { + public int id; + public String subject; + public String status; + public UserIdentity owner; + public List reviewers; + public ProjectIdentity project; + public Date lastUpdate; +} diff --git a/webapp/src/com/google/gerrit/client/data/ChangeListService.java b/webapp/src/com/google/gerrit/client/data/ChangeListService.java new file mode 100644 index 0000000000..ab69106d5a --- /dev/null +++ b/webapp/src/com/google/gerrit/client/data/ChangeListService.java @@ -0,0 +1,22 @@ +// Copyright 2008 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.gerrit.client.data; + +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwtjsonrpc.client.RemoteJsonService; + +public interface ChangeListService extends RemoteJsonService { + public void mine(AsyncCallback callback); +} diff --git a/webapp/src/com/google/gerrit/client/data/MineResult.java b/webapp/src/com/google/gerrit/client/data/MineResult.java new file mode 100644 index 0000000000..71c1c8edb7 --- /dev/null +++ b/webapp/src/com/google/gerrit/client/data/MineResult.java @@ -0,0 +1,23 @@ +// Copyright 2008 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.gerrit.client.data; + +import java.util.List; + +public class MineResult { + public List byMe; + public List forReview; + public List closed; +} diff --git a/webapp/src/com/google/gerrit/client/data/ProjectIdentity.java b/webapp/src/com/google/gerrit/client/data/ProjectIdentity.java new file mode 100644 index 0000000000..d59a1eb417 --- /dev/null +++ b/webapp/src/com/google/gerrit/client/data/ProjectIdentity.java @@ -0,0 +1,19 @@ +// Copyright 2008 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.gerrit.client.data; + +public class ProjectIdentity { + public String name; +} diff --git a/webapp/src/com/google/gerrit/client/data/UserIdentity.java b/webapp/src/com/google/gerrit/client/data/UserIdentity.java new file mode 100644 index 0000000000..82ecf72615 --- /dev/null +++ b/webapp/src/com/google/gerrit/client/data/UserIdentity.java @@ -0,0 +1,20 @@ +// Copyright 2008 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.gerrit.client.data; + +public class UserIdentity { + public String fullName; + public String emailAddress; +} diff --git a/webapp/src/com/google/gerrit/public/Gerrit.css b/webapp/src/com/google/gerrit/public/Gerrit.css new file mode 100644 index 0000000000..0f8768b5af --- /dev/null +++ b/webapp/src/com/google/gerrit/public/Gerrit.css @@ -0,0 +1,69 @@ +#gerrit_body { + font-family: Arial,Verdana,sans-serif; + font-size: 11pt; +} + + +/** Menu **/ +.gerrit-LeftMenu { + padding-left: 10px; + padding-right: 10px; +} + +.gerrit-MenuList { + white-space: nowrap; + width: 150px; +} + + +/** Screen **/ +.gerrit-Screen { + padding-right: 20px; + width: 100%; +} + +.gerrit-ScreenHeading { + white-space: nowrap; + font-size: 16pt; + font-weight: bold; + margin:3px 0 8px; +} + + +/** ChangeTable **/ + +.gerrit-ChangeTable { + width: 100%; + border-collapse: separate; + border-spacing: 0; +} + +.gerrit-ChangeTable td { + border-bottom: 1px solid #d4e9a9; + border-right: 1px solid #d4e9a9; +} + +.gerrit-ChangeTable-ColumnHeader { + border: 1px solid white; + padding: 2px 6px 1px; + background-color: #d4e9a9; + white-space: nowrap; +} + +.gerrit-ChangeTable-ColumnID { + text-align: right; +} + +.gerrit-ChangeTable-SectionHeader { + border-top: 8px solid white; + padding: 2px 6px 1px; + background-color: #d4e9a9; + white-space: nowrap; + font-weight: bold; +} + +.gerrit-ChangeTable-EmptySectionRow { + border: none; + font-style: italic; + padding-left: 25px; +} \ No newline at end of file diff --git a/webapp/src/com/google/gerrit/public/Gerrit.html b/webapp/src/com/google/gerrit/public/Gerrit.html new file mode 100644 index 0000000000..2ba657bc43 --- /dev/null +++ b/webapp/src/com/google/gerrit/public/Gerrit.html @@ -0,0 +1,15 @@ + + + + + Gerrit Code Review + + + + +
+ + + diff --git a/webapp/src/com/google/gerrit/server/ChangeListServiceImpl.java b/webapp/src/com/google/gerrit/server/ChangeListServiceImpl.java new file mode 100644 index 0000000000..ca0ece26a5 --- /dev/null +++ b/webapp/src/com/google/gerrit/server/ChangeListServiceImpl.java @@ -0,0 +1,47 @@ +// Copyright 2008 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.gerrit.server; + +import com.google.gerrit.client.data.ChangeHeader; +import com.google.gerrit.client.data.ChangeListService; +import com.google.gerrit.client.data.MineResult; +import com.google.gerrit.client.data.ProjectIdentity; +import com.google.gerrit.client.data.UserIdentity; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwtjsonrpc.server.JsonServlet; + +import java.util.ArrayList; +import java.util.Date; + +public class ChangeListServiceImpl extends JsonServlet implements ChangeListService { + public void mine(final AsyncCallback callback) { + final MineResult r = new MineResult(); + r.byMe = new ArrayList(); + for (int i = 10; i < 10 + 2; i++) { + final ChangeHeader c = new ChangeHeader(); + c.id = i; + c.subject = "Change " + i; + + c.owner = new UserIdentity(); + c.owner.fullName = "User " + i; + + c.project = new ProjectIdentity(); + c.project.name = "platform/test"; + c.lastUpdate = new Date(); + r.byMe.add(c); + } + callback.onSuccess(r); + } +}