Normalize code in Devinsy style. Replace protected by private in

declarations.
This commit is contained in:
Christian P. MOMON 2013-06-23 01:28:40 +02:00
parent 13ab17cc9d
commit 0c793e9c04
16 changed files with 2174 additions and 2013 deletions

View file

@ -9,3 +9,283 @@ org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.compiler.source=1.6
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_annotation=0
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=0
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=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
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_resources_in_try=80
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.alignment_for_union_type_in_multicatch=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=1
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
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=1
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block=next_line
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_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=false
org.eclipse.jdt.core.formatter.comment.format_header=false
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=true
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=insert
org.eclipse.jdt.core.formatter.comment.line_length=80
org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
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.disabling_tag=@formatter\:off
org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
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=false
org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
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_method=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=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_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=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=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=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=insert
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=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=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=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=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_try=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_semicolon_in_try_resources=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=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_try=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_try=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_semicolon_in_try_resources=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.join_lines_in_comments=true
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
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=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.jdt.core.formatter.lineSplit=200
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=1
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true

View file

@ -1,19 +1,25 @@
v1.0.0: 01/10/2009 == 2013-06
Rename project. Clean files. Update build.
== v1.0.0: 01/10/2009
New version for: New version for:
- Eclipse integration, - Eclipse integration,
- fr.devinsy.xid package rename. - fr.devinsy.xid package rename.
V_006: 12/03/2007 == V_006: 12/03/2007
Version used in DevinsyGes and maitress-admin. Version used in DevinsyGes and maitress-admin.
V_003: 12/03/2006 == 20061214, cpm, import dans svn sur https://www.ocmland.org/svn/Xid
== V_004: 12/05/2006
-
== V_003: 12/03/2006
- add build.xml file - add build.xml file
- Vue class rename Presenter - Vue class rename Presenter
- debug of object tag - debug of object tag
- add webappPath capability - add webappPath capability
V_004: 12/05/2006
-
20061214, cpm, import dans snv sur https://www.ocmland.org/svn/Xid

View file

@ -2,7 +2,9 @@
* XidDemo * XidDemo
*/ */
import fr.devinsy.xid.*; import fr.devinsy.xid.Data;
import fr.devinsy.xid.IdData;
import fr.devinsy.xid.StringPresenter;
/** /**
* *
@ -10,297 +12,287 @@ import fr.devinsy.xid.*;
class XidDemo class XidDemo
{ {
static static
{ {
// Initialize logger. // Initialize logger.
org.apache.log4j.BasicConfigurator.configure (); org.apache.log4j.BasicConfigurator.configure();
org.apache.log4j.Logger log = null; org.apache.log4j.Logger log = null;
log = org.apache.log4j.Logger.getRootLogger (); log = org.apache.log4j.Logger.getRootLogger();
log = org.apache.log4j.Logger.getLogger (XidDemo.class); log = org.apache.log4j.Logger.getLogger(XidDemo.class);
} }
/**
/**
* *
*/ */
public static void main (String[] args) public static void main(final String[] args)
{
System.out.println("Hello World!");
//test ();
//
Data datas;
// Step #01.
{ {
System.out.println ("----------------------------"); System.out.println("Hello World!");
// Populate attributes. // test ();
datas = new Data ();
datas.setContent ("name", "Superman");
String htmlSource = "<div id='name'>a name</div >"; //
StringBuffer htmlTarget; Data datas;
try
{ // Step #01.
htmlTarget = StringPresenter.doXid (htmlSource, datas); {
} System.out.println("----------------------------");
catch (Exception exception)
{ // Populate attributes.
System.out.println(exception.getMessage()); datas = new Data();
htmlTarget = null; datas.setContent("name", "Superman");
}
System.out.println ("datas = new Data ();"); String htmlSource = "<div id='name'>a name</div >";
System.out.println ("datas.setContent (\"name\", \"Superman\");"); StringBuffer htmlTarget;
System.out.println ("+"); try
System.out.println ("<div id='name'>a name</div >"); {
System.out.println ("=>"); htmlTarget = StringPresenter.doXid(htmlSource, datas);
System.out.println (htmlTarget); }
System.out.println ("[" + htmlSource.length() + "] => [" + htmlTarget.length() + "]"); catch (Exception exception)
{
System.out.println(exception.getMessage());
htmlTarget = null;
}
System.out.println("datas = new Data ();");
System.out.println("datas.setContent (\"name\", \"Superman\");");
System.out.println("+");
System.out.println("<div id='name'>a name</div >");
System.out.println("=>");
System.out.println(htmlTarget);
System.out.println("[" + htmlSource.length() + "] => [" + htmlTarget.length() + "]");
}
// Step #02.
{
System.out.println("----------------------------");
// Populate attributes.
datas = new Data();
datas.setContent("lastname", "Spiderman");
datas.appendAttribute("lastname", "style", "background: blue;");
datas.appendAttribute("lastname", "style", "foreground: red;");
datas.setAttribute("lastname", "class", "nameClass");
String htmlSource = "<div id='lastname'>a last name</div >";
StringBuffer htmlTarget;
try
{
htmlTarget = StringPresenter.doXid(htmlSource, datas);
}
catch (Exception exception)
{
System.out.println(exception.getMessage());
htmlTarget = null;
}
System.out.println("datas = new Data ();");
System.out.println("datas.setContent (\"lastname\", \"Spiderman\");");
System.out.println("datas.appendAttribute (\"lastname\", \"style\", \"background: blue;\");");
System.out.println("datas.appendAttribute (\"lastname\", \"style\", \"foreground: red;\");");
System.out.println("datas.setAttribute (\"lastname\", \"class\", \"nameClass\");");
System.out.println("+");
System.out.println("<div id='lastname'>a last name</div>");
System.out.println("=>");
System.out.println(htmlTarget);
System.out.println("[" + htmlSource.length() + "] => [" + htmlTarget.length() + "]");
}
// Step #03.
{
System.out.println("----------------------------");
// Populate attributes.
datas = new Data();
datas.setContent("words", 0, "alpha");
datas.setContent("words", 1, "bravo");
datas.setContent("words", 2, "charlie");
datas.setContent("words", 3, "delta");
datas.setContent("words", 4, "echo");
datas.setContent("words", 5, "fox");
String htmlSource = "<ul>\n <li id='words'>a word</li>\n</ul>";
StringBuffer htmlTarget;
try
{
htmlTarget = StringPresenter.doXid(htmlSource, datas);
}
catch (Exception exception)
{
System.out.println(exception.getMessage());
htmlTarget = null;
}
System.out.println("datas = new Data ();");
System.out.println("datas.setContent (\"words\", 0, \"alpha\");");
System.out.println("datas.setContent (\"words\", 1, \"bravo\");");
System.out.println("datas.setContent (\"words\", 2, \"charlie\");");
System.out.println("datas.setContent (\"words\", 3, \"delta\");");
System.out.println("datas.setContent (\"words\", 4, \"echo\");");
System.out.println("datas.setContent (\"words\", 5, \"fox\");");
System.out.println("+");
System.out.println("<ul>");
System.out.println(" <li id='words'>a word</li>");
System.out.println("</ul>");
System.out.println("=>");
System.out.println(htmlTarget);
System.out.println("[" + htmlSource.length() + "] => [" + htmlTarget.length() + "]");
}
// Step #04.
{
System.out.println("----------------------------");
// Populate attributes.
datas = new Data();
datas.setContent("identity", 0, "last_name", "Jemba");
datas.setContent("identity", 0, "first_name", "Epo");
datas.setContent("identity", 1, "last_name", "Momon");
datas.setContent("identity", 1, "first_name", "Christian");
datas.setContent("identity", 2, "last_name", "Tronche");
datas.setContent("identity", 2, "first_name", "Christophe");
StringBuffer source = new StringBuffer();
source.append("<table>\n");
source.append(" <tr id='identity'><td>noid</td><td id='first_name'>Jean</td><td id='last_name'>Reve</td></tr>\n");
source.append("</table>");
String htmlSource = source.toString();
StringBuffer htmlTarget;
try
{
htmlTarget = StringPresenter.doXid(htmlSource, datas);
}
catch (Exception exception)
{
System.out.println(exception.getMessage());
htmlTarget = null;
}
System.out.println("datas = new Data ();");
System.out.println("datas.setContent (\"identity\", 0, \"last_name\", \"Jemba\");");
System.out.println("datas.setContent (\"identity\", 0, \"first_name\", \"Epo\");");
System.out.println("datas.setContent (\"identity\", 1, \"last_name\", \"Momon\");");
System.out.println("datas.setContent (\"identity\", 1, \"first_name\", \"Christian\");");
System.out.println("datas.setContent (\"identity\", 2, \"last_name\", \"Tronche\");");
System.out.println("datas.setContent (\"identity\", 2, \"first_name\", \"Christophe\");");
System.out.println("+");
System.out.println(htmlSource);
System.out.println("=>");
System.out.println(htmlTarget);
System.out.println("[" + htmlSource.length() + "] => [" + htmlTarget.length() + "]");
}
// Step #05.
{
System.out.println("----------------------------");
// Populate attributes.
datas = new Data();
datas.setContent("identity", 0, "last_name", "Jemba");
datas.setContent("identity", 0, "first_name", "Epo");
datas.setContent("identity", 1, "last_name", "Momon");
datas.setContent("identity", 1, "first_name", "Christian");
datas.setContent("identity", 2, "last_name", "Tronche");
datas.setContent("identity", 2, "first_name", "Christophe");
// datas.setIterationStrategy ("identity",
// IdsDataByIndex.IterationStrategy.ONLY_ROWS_WITH_ID);
// datas.setIterationStrategy ("identity",
// IdsDataByIndex.IterationStrategy.ONLY_ROWS_WITHOUT_ID);
// datas.setIterationStrategy ("identity",
// IdsDataByIndex.IterationStrategy.ALL_ROWS);
//
StringBuffer source = new StringBuffer();
source.append("<table id=\"identities\">\n");
source.append(" <tr id='the_head'><th>noid</th><th>First Name</th><th>Last Name</th></tr>\n");
source.append(" <tr id='identity'><td>noid</td><td id='first_name'>Jean</td><td id='last_name'>Reve</td></tr>\n");
source.append(" <tr id='identity_bis'><td>noid</td><td id='first_name_bis'>a first name</td><td id='last_name_bis'>a last name</td></tr>\n");
source.append(" <tr><td>noid</td><td id='first_name_ter'>a first name more</td><td id='last_name_ter'>a last name more</td></tr>\n");
source.append("</table>\n");
String htmlSource = source.toString();
System.out.println("datas = new Data ();");
System.out.println("datas.setContent (\"identity\", 0, \"first_name\", \"Epo\");");
System.out.println("datas.setContent (\"identity\", 0, \"last_name\", \"Jemba\");");
System.out.println("datas.setContent (\"identity\", 1, \"first_name\", \"Christian\");");
System.out.println("datas.setContent (\"identity\", 1, \"last_name\", \"Momon\");");
System.out.println("datas.setContent (\"identity\", 2, \"first_name\", \"Christophe\");");
System.out.println("datas.setContent (\"identity\", 2, \"last_name\", \"Tronche\");");
System.out.println("+");
System.out.println(htmlSource);
System.out.println("=>");
// #05.1
datas.setIterationStrategy("identities", IdData.IterationStrategy.ONLY_FIRST_ROW);
System.out.println("ONLY_FIRST_ROW:");
StringBuffer html;
try
{
html = StringPresenter.doXid(htmlSource, datas);
}
catch (Exception exception)
{
System.out.println(exception.getMessage());
html = null;
}
System.out.println(html);
System.out.println("");
// #05.2
datas.setIterationStrategy("identities", IdData.IterationStrategy.ONLY_FIRST_TWO_ROWS);
System.out.println("ONLY_FIRST_TWO_ROWS:");
try
{
html = StringPresenter.doXid(htmlSource, datas);
}
catch (Exception exception)
{
System.out.println(exception.getMessage());
html = null;
}
System.out.println(html);
System.out.println("");
// #05.3
datas.setIterationStrategy("identities", IdData.IterationStrategy.ONLY_ROWS_WITH_ID);
System.out.println("ONLY_ROWS_WITH_ID:");
try
{
html = StringPresenter.doXid(htmlSource, datas);
}
catch (Exception exception)
{
System.out.println(exception.getMessage());
html = null;
}
System.out.println(html);
System.out.println("");
// #05.4
datas.setIterationStrategy("identities", IdData.IterationStrategy.ONLY_ROWS_WITHOUT_ID);
System.out.println("ONLY_ROWS_WITHOUT_ID:");
try
{
html = StringPresenter.doXid(htmlSource, datas);
}
catch (Exception exception)
{
System.out.println(exception.getMessage());
html = null;
}
System.out.println(html);
System.out.println("");
// #05.5
datas.setIterationStrategy("identities", IdData.IterationStrategy.ALL_ROWS);
System.out.println("ALL_ROWS:");
try
{
html = StringPresenter.doXid(htmlSource, datas);
}
catch (Exception exception)
{
System.out.println(exception.getMessage());
html = null;
}
System.out.println(html);
}
} }
// Step #02.
{
System.out.println ("----------------------------");
// Populate attributes.
datas = new Data ();
datas.setContent ("lastname", "Spiderman");
datas.appendAttribute ("lastname", "style", "background: blue;");
datas.appendAttribute ("lastname", "style", "foreground: red;");
datas.setAttribute ("lastname", "class", "nameClass");
String htmlSource = "<div id='lastname'>a last name</div >";
StringBuffer htmlTarget;
try
{
htmlTarget = StringPresenter.doXid (htmlSource, datas);
}
catch (Exception exception)
{
System.out.println(exception.getMessage());
htmlTarget = null;
}
System.out.println ("datas = new Data ();");
System.out.println ("datas.setContent (\"lastname\", \"Spiderman\");");
System.out.println ("datas.appendAttribute (\"lastname\", \"style\", \"background: blue;\");");
System.out.println ("datas.appendAttribute (\"lastname\", \"style\", \"foreground: red;\");");
System.out.println ("datas.setAttribute (\"lastname\", \"class\", \"nameClass\");");
System.out.println ("+");
System.out.println ("<div id='lastname'>a last name</div>");
System.out.println ("=>");
System.out.println (htmlTarget);
System.out.println ("[" + htmlSource.length() + "] => [" + htmlTarget.length() + "]");
}
// Step #03.
{
System.out.println ("----------------------------");
// Populate attributes.
datas = new Data ();
datas.setContent ("words", 0, "alpha");
datas.setContent ("words", 1, "bravo");
datas.setContent ("words", 2, "charlie");
datas.setContent ("words", 3, "delta");
datas.setContent ("words", 4, "echo");
datas.setContent ("words", 5, "fox");
String htmlSource = "<ul>\n <li id='words'>a word</li>\n</ul>";
StringBuffer htmlTarget;
try
{
htmlTarget = StringPresenter.doXid (htmlSource, datas);
}
catch (Exception exception)
{
System.out.println(exception.getMessage());
htmlTarget = null;
}
System.out.println ("datas = new Data ();");
System.out.println ("datas.setContent (\"words\", 0, \"alpha\");");
System.out.println ("datas.setContent (\"words\", 1, \"bravo\");");
System.out.println ("datas.setContent (\"words\", 2, \"charlie\");");
System.out.println ("datas.setContent (\"words\", 3, \"delta\");");
System.out.println ("datas.setContent (\"words\", 4, \"echo\");");
System.out.println ("datas.setContent (\"words\", 5, \"fox\");");
System.out.println ("+");
System.out.println ("<ul>");
System.out.println (" <li id='words'>a word</li>");
System.out.println ("</ul>");
System.out.println ("=>");
System.out.println (htmlTarget);
System.out.println ("[" + htmlSource.length() + "] => [" + htmlTarget.length() + "]");
}
// Step #04.
{
System.out.println ("----------------------------");
// Populate attributes.
datas = new Data ();
datas.setContent ("identity", 0, "last_name", "Jemba");
datas.setContent ("identity", 0, "first_name", "Epo");
datas.setContent ("identity", 1, "last_name", "Momon");
datas.setContent ("identity", 1, "first_name", "Christian");
datas.setContent ("identity", 2, "last_name", "Tronche");
datas.setContent ("identity", 2, "first_name", "Christophe");
StringBuffer source = new StringBuffer ();
source.append ("<table>\n");
source.append (" <tr id='identity'><td>noid</td><td id='first_name'>Jean</td><td id='last_name'>Reve</td></tr>\n");
source.append ("</table>");
String htmlSource = source.toString ();
StringBuffer htmlTarget;
try
{
htmlTarget = StringPresenter.doXid (htmlSource, datas);
}
catch (Exception exception)
{
System.out.println(exception.getMessage());
htmlTarget = null;
}
System.out.println ("datas = new Data ();");
System.out.println ("datas.setContent (\"identity\", 0, \"last_name\", \"Jemba\");");
System.out.println ("datas.setContent (\"identity\", 0, \"first_name\", \"Epo\");");
System.out.println ("datas.setContent (\"identity\", 1, \"last_name\", \"Momon\");");
System.out.println ("datas.setContent (\"identity\", 1, \"first_name\", \"Christian\");");
System.out.println ("datas.setContent (\"identity\", 2, \"last_name\", \"Tronche\");");
System.out.println ("datas.setContent (\"identity\", 2, \"first_name\", \"Christophe\");");
System.out.println ("+");
System.out.println (htmlSource);
System.out.println ("=>");
System.out.println (htmlTarget);
System.out.println ("[" + htmlSource.length() + "] => [" + htmlTarget.length() + "]");
}
// Step #05.
{
System.out.println ("----------------------------");
// Populate attributes.
datas = new Data ();
datas.setContent ("identity", 0, "last_name", "Jemba");
datas.setContent ("identity", 0, "first_name", "Epo");
datas.setContent ("identity", 1, "last_name", "Momon");
datas.setContent ("identity", 1, "first_name", "Christian");
datas.setContent ("identity", 2, "last_name", "Tronche");
datas.setContent ("identity", 2, "first_name", "Christophe");
//datas.setIterationStrategy ("identity", IdsDataByIndex.IterationStrategy.ONLY_ROWS_WITH_ID);
//datas.setIterationStrategy ("identity", IdsDataByIndex.IterationStrategy.ONLY_ROWS_WITHOUT_ID);
//datas.setIterationStrategy ("identity", IdsDataByIndex.IterationStrategy.ALL_ROWS);
//
StringBuffer source = new StringBuffer ();
source.append ("<table id=\"identities\">\n");
source.append (" <tr id='the_head'><th>noid</th><th>First Name</th><th>Last Name</th></tr>\n");
source.append (" <tr id='identity'><td>noid</td><td id='first_name'>Jean</td><td id='last_name'>Reve</td></tr>\n");
source.append (" <tr id='identity_bis'><td>noid</td><td id='first_name_bis'>a first name</td><td id='last_name_bis'>a last name</td></tr>\n");
source.append (" <tr><td>noid</td><td id='first_name_ter'>a first name more</td><td id='last_name_ter'>a last name more</td></tr>\n");
source.append ("</table>\n");
String htmlSource = source.toString ();
System.out.println ("datas = new Data ();");
System.out.println ("datas.setContent (\"identity\", 0, \"first_name\", \"Epo\");");
System.out.println ("datas.setContent (\"identity\", 0, \"last_name\", \"Jemba\");");
System.out.println ("datas.setContent (\"identity\", 1, \"first_name\", \"Christian\");");
System.out.println ("datas.setContent (\"identity\", 1, \"last_name\", \"Momon\");");
System.out.println ("datas.setContent (\"identity\", 2, \"first_name\", \"Christophe\");");
System.out.println ("datas.setContent (\"identity\", 2, \"last_name\", \"Tronche\");");
System.out.println ("+");
System.out.println (htmlSource);
System.out.println ("=>");
// #05.1
datas.setIterationStrategy ("identities", IdData.IterationStrategy.ONLY_FIRST_ROW);
System.out.println ("ONLY_FIRST_ROW:");
StringBuffer html;
try
{
html = StringPresenter.doXid (htmlSource, datas);
}
catch (Exception exception)
{
System.out.println(exception.getMessage());
html = null;
}
System.out.println (html);
System.out.println ("");
// #05.2
datas.setIterationStrategy ("identities", IdData.IterationStrategy.ONLY_FIRST_TWO_ROWS);
System.out.println ("ONLY_FIRST_TWO_ROWS:");
try
{
html = StringPresenter.doXid (htmlSource, datas);
}
catch (Exception exception)
{
System.out.println(exception.getMessage());
html = null;
}
System.out.println (html);
System.out.println ("");
// #05.3
datas.setIterationStrategy ("identities", IdData.IterationStrategy.ONLY_ROWS_WITH_ID);
System.out.println ("ONLY_ROWS_WITH_ID:");
try
{
html = StringPresenter.doXid (htmlSource, datas);
}
catch (Exception exception)
{
System.out.println(exception.getMessage());
html = null;
}
System.out.println (html);
System.out.println ("");
// #05.4
datas.setIterationStrategy ("identities", IdData.IterationStrategy.ONLY_ROWS_WITHOUT_ID);
System.out.println ("ONLY_ROWS_WITHOUT_ID:");
try
{
html = StringPresenter.doXid (htmlSource, datas);
}
catch (Exception exception)
{
System.out.println(exception.getMessage());
html = null;
}
System.out.println (html);
System.out.println ("");
// #05.5
datas.setIterationStrategy ("identities", IdData.IterationStrategy.ALL_ROWS);
System.out.println ("ALL_ROWS:");
try
{
html = StringPresenter.doXid (htmlSource, datas);
}
catch (Exception exception)
{
System.out.println(exception.getMessage());
html = null;
}
System.out.println (html);
}
}
} }

View file

@ -1,74 +1,59 @@
package fr.devinsy.xid; package fr.devinsy.xid;
import java.util.*; import java.util.HashMap;
/** /**
* *
* Note: no more AttrValue as in Brill, because the exception of style is managed * Note: no more AttrValue as in Brill, because the exception of style is
* in the attribute merging on the "style" string detection. * managed in the attribute merging on the "style" string detection.
*/ */
public class Attributes extends HashMap<String, String> public class Attributes extends HashMap<String, String>
{ {
private static final long serialVersionUID = 2802739066295665336L; private static final long serialVersionUID = 2802739066295665336L;
/**
/*
* *
*/ */
public Attributes () public Attributes()
{ {
super (); super();
} }
/**
/*
* Useful for the merge attributes. * Useful for the merge attributes.
*/ */
public Attributes (Attributes attributes) public Attributes(final Attributes attributes)
{ {
super (attributes); super(attributes);
} }
/**
/* * Add a value to an existing value. This is useful to the 'style'
* attribute.
* *
*/ */
public void setAttribute (String label, String value) public void appendAttribute(final String label, final String value)
{ {
this.put (label, value); if (this.containsKey(label))
}
/*
* Add a value to an existing value. This is useful to the 'style' attribute.
*
*/
public void appendAttribute (String label, String value)
{
if (this.containsKey (label))
{ {
this.put (label, this.get (label) + value); this.put(label, this.get(label) + value);
} }
else else
{ {
this.put (label, value); this.put(label, value);
} }
} }
/**
/*
* *
*/ */
public String getAttribute (String label) public String getAttribute(final String label)
{ {
String result; String result;
if (this.containsKey (label)) if (this.containsKey(label))
{ {
result = this.get (label); result = this.get(label);
} }
else else
{ {
@ -79,4 +64,12 @@ public class Attributes extends HashMap<String, String>
return (result); return (result);
} }
/**
*
*/
public void setAttribute(final String label, final String value)
{
this.put(label, value);
}
} }

View file

@ -1,27 +1,178 @@
package fr.devinsy.xid; package fr.devinsy.xid;
/* /*
* *
*/ */
public class Data public class Data
{ {
protected IdsDataById idsDataById; private IdsDataById idsDataById;
/** /**
* *
*/ */
public Data () public Data()
{ {
this.idsDataById = new IdsDataById (); this.idsDataById = new IdsDataById();
} }
/**
*
*/
public void appendAttribute(final String id, final int line, final String column, final String label, final String value)
{
IdData tag = this.getIdData(id, line, column);
tag.attributes().appendAttribute(label, value);
}
/** /**
* *
*/ */
public IdsDataById getIdsDataById () public void appendAttribute(final String id, final String label, final int value)
{
appendAttribute(id, label, (new Integer(value)).toString());
}
/**
*
*/
public void appendAttribute(final String id, final String label, final String value)
{
IdData tag = this.getIdData(id);
tag.attributes().appendAttribute(label, value);
}
/**
*
*/
public void appendContent(final String id, final int line, final int value)
{
appendContent(id, line, (new Integer(value)).toString());
}
/**
*
*/
public void appendContent(final String id, final int line, final String value)
{
IdData tag = this.getIdData(id, line);
tag.appendContent(value);
}
/**
*
*/
public void appendContent(final String id, final int line, final String column, final int value)
{
appendContent(id, line, column, (new Integer(value)).toString());
}
/**
*
*/
public void appendContent(final String id, final int line, final String column, final String value)
{
IdData tag = this.getIdData(id, line, column);
tag.appendContent(value);
}
/**
*
*/
public IdData getIdData(final String id)
{
IdData result;
// Be sure that IdData is existing and get item.
result = (IdData) this.idsDataById.getId(id);
if (result == null)
{
this.idsDataById.setId(id, new IdData());
result = (IdData) this.idsDataById.getId(id);
}
//
return (result);
}
/**
*
*/
public IdData getIdData(final String id, final int line)
{
IdData result;
// Be sure that IdsData are existing.
IdsDataByIndex tags = (IdsDataByIndex) this.idsDataById.getId(id);
if (tags == null)
{
this.idsDataById.setId(id, new IdsDataByIndex());
tags = (IdsDataByIndex) this.idsDataById.getId(id);
}
// Be sure that lines are existing.
int nbLines = tags.size();
for (int nLine = nbLines; nLine < line + 1; nLine++)
{
tags.add(nLine, new IdData());
}
// Get item.
result = (IdData) tags.elementAt(line);
//
return (result);
}
/**
*
*/
public IdData getIdData(final String id, final int line, final String column)
{
IdData result;
// Be sure that IdsData are existing.
IdsDataByIndex tags = (IdsDataByIndex) this.idsDataById.getId(id);
if (tags == null)
{
this.idsDataById.setId(id, new IdsDataByIndex());
tags = (IdsDataByIndex) this.idsDataById.getId(id);
}
// Be sure that lines are existing.
int nbLines = tags.size();
for (int nLine = nbLines; nLine < line + 1; nLine++)
{
tags.add(nLine, new IdsDataById());
}
// Get item.
IdsDataById lineData = (IdsDataById) tags.elementAt(line);
result = (IdData) lineData.get(column);
if (result == null)
{
lineData.put(column, new IdData());
result = (IdData) lineData.get(column);
}
//
return (result);
}
/**
*
*/
public IdsDataById getIdsDataById()
{ {
IdsDataById result; IdsDataById result;
@ -31,311 +182,131 @@ public class Data
return (result); return (result);
} }
/**
*
*/
public void setAttribute(final String id, final int line, final String label, final int value)
{
setAttribute(id, line, label, (new Integer(value)).toString());
}
/** /**
* *
*/ */
public IdData getIdData (String id) public void setAttribute(final String id, final int line, final String label, final String value)
{ {
IdData result; IdData tag = this.getIdData(id, line);
// Be sure that IdData is existing and get item. tag.attributes().setAttribute(label, value);
result = (IdData) this.idsDataById.getId (id);
if (result == null)
{
this.idsDataById.setId (id, new IdData ());
result = (IdData) this.idsDataById.getId (id);
}
//
return (result);
} }
/** /**
* *
*/ */
public IdData getIdData (String id, int line) public void setAttribute(final String id, final int line, final String column, final String label, final int value)
{ {
IdData result; setAttribute(id, line, column, label, (new Integer(value)).toString());
// Be sure that IdsData are existing.
IdsDataByIndex tags = (IdsDataByIndex) this.idsDataById.getId (id);
if (tags == null)
{
this.idsDataById.setId (id, new IdsDataByIndex ());
tags = (IdsDataByIndex) this.idsDataById.getId (id);
}
// Be sure that lines are existing.
int nbLines = tags.size ();
for (int nLine = nbLines; nLine < line + 1; nLine++)
{
tags.add (nLine, new IdData ());
}
// Get item.
result = (IdData) tags.elementAt (line);
//
return (result);
} }
/** /**
* *
*/ */
public IdData getIdData (String id, int line, String column) public void setAttribute(final String id, final int line, final String column, final String label, final String value)
{ {
IdData result; IdData tag = this.getIdData(id, line, column);
// Be sure that IdsData are existing. tag.attributes().setAttribute(label, value);
IdsDataByIndex tags = (IdsDataByIndex) this.idsDataById.getId (id);
if (tags == null)
{
this.idsDataById.setId (id, new IdsDataByIndex ());
tags = (IdsDataByIndex) this.idsDataById.getId (id);
}
// Be sure that lines are existing.
int nbLines = tags.size ();
for (int nLine = nbLines; nLine < line + 1; nLine++)
{
tags.add (nLine, new IdsDataById ());
}
// Get item.
IdsDataById lineData = (IdsDataById) tags.elementAt (line);
result = (IdData) lineData.get (column);
if (result == null)
{
lineData.put (column, new IdData ());
result = (IdData) lineData.get (column);
}
//
return (result);
} }
/** /**
* *
*/ */
public void setIterationStrategy (String id, IdData.IterationStrategy strategy) public void setAttribute(final String id, final String label, final int value)
{ {
IdData tag = (IdData) this.getIdData (id); setAttribute(id, label, (new Integer(value)).toString());
tag.setIterationStrategy (strategy);
} }
/** /**
* *
*/ */
public void setContent (String id, String content) public void setAttribute(final String id, final String label, final String value)
{ {
IdData idData = this.getIdData (id); IdData tag = this.getIdData(id);
idData.setContent (content); tag.attributes().setAttribute(label, value);
} }
/** /**
* *
*/ */
public void setContent (String id, int content) public void setContent(final String id, final int content)
{ {
setContent (id, (new Integer (content)).toString ()); setContent(id, (new Integer(content)).toString());
} }
/** /**
* *
*/ */
public void setContent (String id, int line, String content) public void setContent(final String id, final int line, final int content)
{ {
IdData tag = this.getIdData (id, line); setContent(id, line, (new Integer(content)).toString());
tag.setContent (content);
} }
/** /**
* *
*/ */
public void setContent (String id, int line, int content) public void setContent(final String id, final int line, final String content)
{ {
setContent (id, line, (new Integer (content)).toString ()); IdData tag = this.getIdData(id, line);
}
tag.setContent(content);
}
/** /**
* *
*/ */
public void setContent (String id, int line, String column, String content) public void setContent(final String id, final int line, final String column, final int content)
{ {
IdData tag = this.getIdData (id, line, column); setContent(id, line, column, (new Integer(content)).toString());
tag.setContent (content);
} }
/**
*
*/
public void setContent (String id, int line, String column, int content)
{
setContent (id, line, column, (new Integer (content)).toString ());
}
/** /**
* @TODO * @TODO
*/ */
public void setContent (String id, int line, String subId, int subLine, String column, String content) public void setContent(final String id, final int line, final String subId, final int subLine, final String column, final String content)
{ {
// IdData tag = this.getIdData (id, line, subId, subLine, column); // IdData tag = this.getIdData (id, line, subId, subLine, column);
//tag.setContent (content); // tag.setContent (content);
} }
/** /**
* *
*/ */
public void setAttribute (String id, String label, String value) public void setContent(final String id, final int line, final String column, final String content)
{ {
IdData tag = this.getIdData (id); IdData tag = this.getIdData(id, line, column);
tag.attributes ().setAttribute (label, value); tag.setContent(content);
} }
/** /**
* *
*/ */
public void setAttribute (String id, String label, int value) public void setContent(final String id, final String content)
{ {
setAttribute (id, label, (new Integer (value)).toString ()); IdData idData = this.getIdData(id);
}
idData.setContent(content);
}
/** /**
* *
*/ */
public void setAttribute (String id, int line, String label, String value) public void setIterationStrategy(final String id, final IdData.IterationStrategy strategy)
{ {
IdData tag = this.getIdData (id, line); IdData tag = this.getIdData(id);
tag.attributes ().setAttribute (label, value); tag.setIterationStrategy(strategy);
}
/**
*
*/
public void setAttribute (String id, int line, String label, int value)
{
setAttribute (id, line, label, (new Integer (value)).toString ());
}
/**
*
*/
public void setAttribute (String id, int line, String column, String label, String value)
{
IdData tag = this.getIdData (id, line, column);
tag.attributes ().setAttribute (label, value);
}
/**
*
*/
public void setAttribute (String id, int line, String column, String label, int value)
{
setAttribute (id, line, column, label, (new Integer (value)).toString ());
}
/**
*
*/
public void appendAttribute (String id, int line, String column, String label, String value)
{
IdData tag = this.getIdData (id, line, column);
tag.attributes ().appendAttribute (label, value);
}
/**
*
*/
public void appendAttribute (String id, String label, String value)
{
IdData tag = this.getIdData (id);
tag.attributes ().appendAttribute (label, value);
}
/**
*
*/
public void appendAttribute (String id, String label, int value)
{
appendAttribute (id, label, (new Integer (value)).toString ());
}
/**
*
*/
public void appendContent (String id, int line, String value)
{
IdData tag = this.getIdData (id, line);
tag.appendContent (value);
}
/**
*
*/
public void appendContent (String id, int line, int value)
{
appendContent (id, line, (new Integer (value)).toString ());
}
/**
*
*/
public void appendContent (String id, int line, String column, String value)
{
IdData tag = this.getIdData (id, line, column);
tag.appendContent (value);
}
/**
*
*/
public void appendContent (String id, int line, String column, int value)
{
appendContent (id, line, column, (new Integer (value)).toString ());
} }
} }

View file

@ -1,8 +1,8 @@
package fr.devinsy.xid; package fr.devinsy.xid;
import java.io.StringWriter; import java.io.StringWriter;
import org.w3c.dom.Document;
import org.w3c.dom.Document;
/** /**
* *
@ -11,32 +11,29 @@ public class DomPresenter extends Presenter
{ {
static final public char INDEX_SEPARATOR = '_'; static final public char INDEX_SEPARATOR = '_';
static protected org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger (DomPresenter.class); static private org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(DomPresenter.class);
protected Document doc; protected Document doc;
/*
*
*/
public DomPresenter ()
{
this.doc = null;
}
/*
*
*/
public DomPresenter (Document doc)
{
this.doc = doc;
DomPresenter.addMetaTag (this.doc, "generator", "XID 0.0");
}
/** /**
* *
*/ */
public Document dom () public DomPresenter()
{
this.doc = null;
}
/**
*
*/
public DomPresenter(final Document doc)
{
setSource(doc);
}
/**
*
*/
public Document dom()
{ {
Document result; Document result;
@ -46,31 +43,61 @@ public class DomPresenter extends Presenter
return (result); return (result);
} }
/**
*
*/
public StringBuffer doXid(final Data datas) throws Exception
{
return (doXid(datas.getIdsDataById()));
}
/** /**
* *
*/ */
public void setDom (Document doc) public StringBuffer doXid(final IdsDataById datas) throws Exception
{
StringBuffer result;
if (this.doc == null)
{
String errorMessage = "source not defined";
logger.error(errorMessage);
result = null;
throw new Exception(errorMessage);
}
else
{
// Build the web page.
StringWriter htmlCode = new StringWriter();
Presenter.doXid(htmlCode, this.doc, datas);
result = new StringBuffer(htmlCode.toString());
}
//
return (result);
}
/**
*
*/
public void setDom(final Document doc)
{ {
this.doc = doc; this.doc = doc;
} }
/* /*
* *
*/ */
public void setSource (Document doc) public void setSource(final Document doc)
{ {
this.doc = doc; this.doc = doc;
addMetaTag(this.doc, "generator", "XID 0.0");
Presenter.addMetaTag (this.doc, "generator", "XID 0.0");
} }
/**
/*
* *
*/ */
public Object source () public Object source()
{ {
Object result; Object result;
@ -80,52 +107,15 @@ public class DomPresenter extends Presenter
return (result); return (result);
} }
/**
/*
*
*/
public StringBuffer doXid (Data datas) throws Exception
{
return (doXid (datas.getIdsDataById ()));
}
/*
*
*/
public StringBuffer doXid (IdsDataById datas) throws Exception
{
StringBuffer result;
if (this.doc == null)
{
String errorMessage = "source not defined";
logger.error (errorMessage);
result = null;
throw new Exception (errorMessage);
}
else
{
// Build the web page.
StringWriter htmlCode = new StringWriter();
Presenter.doXid (htmlCode, this.doc, datas);
result = new StringBuffer (htmlCode.toString());
}
//
return (result);
}
/*
* Xid a file with data. * Xid a file with data.
*/ */
static public StringBuffer doXid (Document doc, IdsDataById datas) throws Exception static public StringBuffer doXid(final Document doc, final IdsDataById datas) throws Exception
{ {
StringBuffer result; StringBuffer result;
StringWriter htmlCode = new StringWriter(); StringWriter htmlCode = new StringWriter();
Presenter.process (htmlCode, doc, datas); Presenter.process(htmlCode, doc, datas);
result = htmlCode.getBuffer(); result = htmlCode.getBuffer();
// //

View file

@ -5,22 +5,21 @@ import java.io.File;
import java.io.FileReader; import java.io.FileReader;
import java.io.StringWriter; import java.io.StringWriter;
/** /**
* *
*/ */
public class FilePresenter extends DomPresenter public class FilePresenter extends DomPresenter
{ {
static protected org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger (FilePresenter.class); static private org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(FilePresenter.class);
protected String sourceFilePathname; private String sourceFilePathname;
protected long sourceFileTime; private long sourceFileTime;
protected String doctype; private String doctype;
/* /**
* *
*/ */
public FilePresenter () public FilePresenter()
{ {
this.sourceFilePathname = null; this.sourceFilePathname = null;
this.sourceFileTime = 0; this.sourceFileTime = 0;
@ -28,11 +27,10 @@ public class FilePresenter extends DomPresenter
this.doctype = ""; this.doctype = "";
} }
/**
/*
* *
*/ */
public FilePresenter (String filePathname) public FilePresenter(final String filePathname)
{ {
this.sourceFilePathname = filePathname; this.sourceFilePathname = filePathname;
this.sourceFileTime = 0; this.sourceFileTime = 0;
@ -40,11 +38,62 @@ public class FilePresenter extends DomPresenter
this.doctype = ""; this.doctype = "";
} }
/**
/*
* *
*/ */
public void setSource (String filePathname) @Override
public StringBuffer doXid(final Data datas) throws Exception
{
return (doXid(datas.getIdsDataById()));
}
/**
* No need to be synchronized.
*/
@Override
public StringBuffer doXid(final IdsDataById datas) throws Exception
{
StringBuffer result;
logger.info("doXid for file [" + this.sourceFilePathname + "]");
// Get the good tree.
File source = new File(this.sourceFilePathname);
if (!source.exists())
{
String errorMessage = "source file defined but not found (" + this.sourceFilePathname + ")";
logger.error(errorMessage);
result = null;
throw new Exception(errorMessage);
}
else if ((this.doc == null) || (this.sourceFileTime != source.lastModified()))
{
this.sourceFileTime = source.lastModified();
this.doc = Presenter.fileToTree(this.sourceFilePathname);
this.doctype = getDoctype(this.sourceFilePathname);
if (this.doc != null)
{
Presenter.addMetaTag(doc, "generator", "XID 0.0");
}
}
// Build the web page.
StringWriter htmlCode = new StringWriter(Presenter.estimatedTargetLength(source.length()));
htmlCode.write(doctype);
htmlCode.write('\n');
Presenter.doXid(htmlCode, doc, datas);
result = htmlCode.getBuffer();
//
return (result);
}
/**
*
*/
public void setSource(final String filePathname)
{ {
this.sourceFilePathname = filePathname; this.sourceFilePathname = filePathname;
this.sourceFileTime = 0; this.sourceFileTime = 0;
@ -52,11 +101,11 @@ public class FilePresenter extends DomPresenter
this.doctype = ""; this.doctype = "";
} }
/**
/*
* *
*/ */
public String source () @Override
public String source()
{ {
String result; String result;
@ -66,74 +115,55 @@ public class FilePresenter extends DomPresenter
return (result); return (result);
} }
/**
/* * Xid a file without data.
*
*/ */
public StringBuffer doXid (Data datas) throws Exception static public StringBuffer doXid(final String filePathname) throws Exception
{
return (doXid (datas.getIdsDataById ()));
}
/*
* No need to be synchronized.
*/
public StringBuffer doXid (IdsDataById datas) throws Exception
{ {
StringBuffer result; StringBuffer result;
logger.info("doXid for file [" + this.sourceFilePathname + "]"); FilePresenter presenter = new FilePresenter(filePathname);
// Get the good tree. result = presenter.doXid((Data) null);
File source = new File (this.sourceFilePathname);
if (!source.exists ())
{
String errorMessage = "source file defined but not found (" + this.sourceFilePathname + ")";
logger.error (errorMessage);
result = null;
throw new Exception (errorMessage);
}
else if ((this.doc == null) ||
(this.sourceFileTime != source.lastModified ()))
{
this.sourceFileTime = source.lastModified ();
this.doc = Presenter.fileToTree (this.sourceFilePathname);
this.doctype = getDoctype(this.sourceFilePathname);
if (this.doc != null)
{
Presenter.addMetaTag (doc, "generator", "XID 0.0");
}
}
// Build the web page.
StringWriter htmlCode = new StringWriter(Presenter.estimatedTargetLength(source.length()));
htmlCode.write(doctype);
htmlCode.write('\n');
Presenter.doXid (htmlCode, doc, datas);
result = htmlCode.getBuffer();
// //
return (result); return (result);
} }
/**
* Xid a file.
*/
static public StringBuffer doXid(final String filePathname, final Data datas) throws Exception
{
StringBuffer result;
static public String getDoctype (String filePathname) throws Exception FilePresenter presenter = new FilePresenter(filePathname);
result = presenter.doXid(datas);
//
return (result);
}
/**
*
* @param filePathname
* @return
* @throws Exception
*/
static public String getDoctype(final String filePathname) throws Exception
{ {
String result; String result;
// //
BufferedReader in = new BufferedReader (new FileReader (filePathname)); BufferedReader in = new BufferedReader(new FileReader(filePathname));
String doctype = in.readLine(); String doctype = in.readLine();
in.close(); in.close();
logger.info("doctype=[" + doctype + "]"); logger.info("doctype=[" + doctype + "]");
// //
if ((doctype.startsWith ("<!DOCTYPE")) || if ((doctype.startsWith("<!DOCTYPE")) || (doctype.startsWith("<!doctype")))
(doctype.startsWith ("<!doctype")))
{ {
result = doctype; result = doctype;
} }
@ -145,36 +175,4 @@ public class FilePresenter extends DomPresenter
// //
return (result); return (result);
} }
/*
* Xid a file without data.
*/
static public StringBuffer doXid (String filePathname) throws Exception
{
StringBuffer result;
FilePresenter presenter = new FilePresenter (filePathname);
result = presenter.doXid ((Data) null);
//
return (result);
}
/*
* Xid a file.
*/
static public StringBuffer doXid (String filePathname, Data datas) throws Exception
{
StringBuffer result;
FilePresenter presenter = new FilePresenter (filePathname);
result = presenter.doXid (datas);
//
return (result);
}
} }

View file

@ -6,49 +6,43 @@
package fr.devinsy.xid; package fr.devinsy.xid;
import java.util.Vector; import java.util.Vector;
/** /**
* *
*/ */
public class FilePresenters extends Vector<FilePresenter> public class FilePresenters extends Vector<FilePresenter>
{ {
private static final long serialVersionUID = 7058868685681354293L; private static final long serialVersionUID = 7058868685681354293L;
static protected org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger (FilePresenters.class); static private org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(FilePresenters.class);
/** /**
* *
*/ */
public FilePresenters () public FilePresenters()
{ {
super (); super();
} }
/** /**
* *
*/ */
public FilePresenters (FilePresenters source) public FilePresenters(final FilePresenters source)
{ {
super (); super();
for (FilePresenter presenter : source) for (FilePresenter presenter : source)
{ {
this.add(presenter); this.add(presenter);
} }
} }
/** /**
* *
*/ */
public boolean exists (String source) public boolean exists(final String source)
{ {
boolean result; boolean result;
if (this.getBySource(source) == null) if (this.getBySource(source) == null)
{ {
result = false; result = false;
@ -59,28 +53,26 @@ public class FilePresenters extends Vector<FilePresenter>
} }
// //
return(result); return (result);
} }
/** /**
* *
*/ */
public FilePresenter getByIndex (int id) public FilePresenter getByIndex(final int id)
{ {
FilePresenter result; FilePresenter result;
result = this.get(id); result = this.get(id);
// //
return(result); return (result);
} }
/** /**
* *
*/ */
public FilePresenter getBySource (String source) public FilePresenter getBySource(final String source)
{ {
FilePresenter result; FilePresenter result;
@ -118,14 +110,13 @@ public class FilePresenters extends Vector<FilePresenter>
} }
// //
return(result); return (result);
} }
/** /**
* *
*/ */
public int getIndexOf (String source) public int getIndexOf(final String source)
{ {
int result; int result;
@ -163,13 +154,13 @@ public class FilePresenters extends Vector<FilePresenter>
} }
// //
return(result); return (result);
} }
/** /**
* *
*/ */
@Override
public String toString() public String toString()
{ {
String result; String result;
@ -177,7 +168,7 @@ public class FilePresenters extends Vector<FilePresenter>
result = ""; result = "";
// //
return(result); return (result);
} }
} }

View file

@ -1,49 +1,27 @@
package fr.devinsy.xid; package fr.devinsy.xid;
/** /**
* *
*/ */
public class FilePresentersProxy public class FilePresentersProxy
{ {
static private org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger (FilePresentersProxy.class); static private org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(FilePresentersProxy.class);
private static FilePresentersProxy instance = null; private static FilePresentersProxy instance = null;
protected FilePresenters presenters = null; private FilePresenters presenters = null;
/** /**
* *
*/ */
protected FilePresentersProxy () throws Exception protected FilePresentersProxy() throws Exception
{ {
this.presenters = new FilePresenters(); this.presenters = new FilePresenters();
} }
/** /**
* *
*/ */
public static FilePresentersProxy instance () throws Exception public FilePresenter getBySource(final String source) throws Exception
{
FilePresentersProxy result;
if (FilePresentersProxy.instance == null)
{
instance = new FilePresentersProxy ();
}
result = instance;
//
return (result);
}
/**
*
*/
public FilePresenter getBySource(String source) throws Exception
{ {
FilePresenter result; FilePresenter result;
@ -64,6 +42,24 @@ public class FilePresentersProxy
// //
return (result); return (result);
} }
/**
*
*/
public static FilePresentersProxy instance() throws Exception
{
FilePresentersProxy result;
if (FilePresentersProxy.instance == null)
{
instance = new FilePresentersProxy();
}
result = instance;
//
return (result);
}
} }
// //////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////

View file

@ -2,38 +2,42 @@ package fr.devinsy.xid;
import java.io.Serializable; import java.io.Serializable;
/** /**
* IdData class is used to hold application data and * IdData class is used to hold application data and the business logic that
* the business logic that operates on the data. * operates on the data.
* *
* The only requirement of a IdData class is that it must implement a * The only requirement of a IdData class is that it must implement a display
* display method. The display method must return a text representation * method. The display method must return a text representation of the data,
* of the data, suitable for display in a web page. * suitable for display in a web page.
* *
* XID provides a User Input IdData, Text IdData and ... * XID provides a User Input IdData, Text IdData and ... application may also
* application may also implement it's own IdData classes. * implement it's own IdData classes.
* *
*/ */
public class IdData implements Serializable, IdDataCore public class IdData implements Serializable, IdDataCore
{ {
private static final long serialVersionUID = 8976245034682639923L; public enum IterationStrategy
{
ONLY_FIRST_ROW, ONLY_FIRST_TWO_ROWS, ONLY_ROWS_WITH_ID, ONLY_ROWS_WITHOUT_ID, ALL_ROWS
}
public enum MODE
{
REPLACE, APPEND, IGNORE
}
public enum IterationStrategy {ONLY_FIRST_ROW, ONLY_FIRST_TWO_ROWS, ONLY_ROWS_WITH_ID, ONLY_ROWS_WITHOUT_ID, ALL_ROWS} private static final long serialVersionUID = 8976245034682639923L;;
public enum MODE {REPLACE, APPEND, IGNORE}; private IterationStrategy iterationStrategy;
private Attributes attributes;
private boolean excludeSection;
private MODE displayMode = MODE.REPLACE;
private String content;
protected IterationStrategy iterationStrategy; /**
protected Attributes attributes;
protected boolean excludeSection;
protected MODE displayMode = MODE.REPLACE;
protected String content;
/*
* *
*/ */
public IdData () public IdData()
{ {
this.attributes = null; this.attributes = null;
this.excludeSection = false; this.excludeSection = false;
@ -42,11 +46,10 @@ public class IdData implements Serializable, IdDataCore
this.iterationStrategy = IterationStrategy.ALL_ROWS; this.iterationStrategy = IterationStrategy.ALL_ROWS;
} }
/**
/*
* *
*/ */
public IdData (String text) public IdData(final String text)
{ {
this.attributes = null; this.attributes = null;
this.excludeSection = false; this.excludeSection = false;
@ -55,34 +58,10 @@ public class IdData implements Serializable, IdDataCore
this.iterationStrategy = IterationStrategy.ALL_ROWS; this.iterationStrategy = IterationStrategy.ALL_ROWS;
} }
/**
/*
* *
*/ */
public String display () public void appendContent(final String text)
{
String result;
result = this.content;
//
return (result);
}
/*
*
*/
public void setContent (String text)
{
this.content = text;
}
/*
*
*/
public void appendContent (String text)
{ {
if (this.content == null) if (this.content == null)
{ {
@ -94,17 +73,38 @@ public class IdData implements Serializable, IdDataCore
} }
} }
/**
/*
* *
*/ */
public void setDisplayMode(MODE displayMode) public Attributes attributes()
{ {
this.displayMode = displayMode; Attributes result;
if (this.attributes == null)
{
this.attributes = new Attributes();
}
result = this.attributes;
//
return (result);
} }
/**
*
*/
public String display()
{
String result;
/* result = this.content;
//
return (result);
}
/**
* *
*/ */
public MODE displayMode() public MODE displayMode()
@ -116,36 +116,7 @@ public class IdData implements Serializable, IdDataCore
return (result); return (result);
} }
/**
/*
*
*/
public Attributes attributes ()
{
Attributes result;
if (this.attributes == null)
{
this.attributes = new Attributes ();
}
result = this.attributes;
//
return (result);
}
/*
*
*/
public void setExcludeSection(boolean excludeSection)
{
this.excludeSection = excludeSection;
}
/*
* *
*/ */
public boolean excludeSection() public boolean excludeSection()
@ -155,23 +126,13 @@ public class IdData implements Serializable, IdDataCore
result = excludeSection; result = excludeSection;
// //
return(result); return (result);
} }
/** /**
* *
*/ */
public void setIterationStrategy (IterationStrategy strategy) public IterationStrategy iterationStrategy()
{
this.iterationStrategy = strategy;
}
/**
*
*/
public IterationStrategy iterationStrategy ()
{ {
IterationStrategy result; IterationStrategy result;
@ -180,4 +141,36 @@ public class IdData implements Serializable, IdDataCore
// //
return (result); return (result);
} }
/**
*
*/
public void setContent(final String text)
{
this.content = text;
}
/**
*
*/
public void setDisplayMode(final MODE displayMode)
{
this.displayMode = displayMode;
}
/**
*
*/
public void setExcludeSection(final boolean excludeSection)
{
this.excludeSection = excludeSection;
}
/**
*
*/
public void setIterationStrategy(final IterationStrategy strategy)
{
this.iterationStrategy = strategy;
}
} }

View file

@ -1,8 +1,8 @@
package fr.devinsy.xid; package fr.devinsy.xid;
import java.util.*; import java.util.HashMap;
/* /**
* *
*/ */
public class IdsDataById extends HashMap<String, IdDataCore> implements IdDataCore public class IdsDataById extends HashMap<String, IdDataCore> implements IdDataCore
@ -10,33 +10,33 @@ public class IdsDataById extends HashMap<String, IdDataCore> implements IdDataCo
private static final long serialVersionUID = -5787252043825503554L; private static final long serialVersionUID = -5787252043825503554L;
/* /**
* *
*/ */
public IdsDataById () public IdsDataById()
{ {
super (); super();
} }
/* /**
* *
*/ */
public void setId (String id, IdDataCore data) public IdDataCore getId(final String id)
{
this.put (id, data);
}
/*
*
*/
public IdDataCore getId (String id)
{ {
IdDataCore result; IdDataCore result;
result = this.get (id); result = this.get(id);
// //
return (result); return (result);
} }
/**
*
*/
public void setId(final String id, final IdDataCore data)
{
this.put(id, data);
}
} }

View file

@ -1,9 +1,8 @@
package fr.devinsy.xid; package fr.devinsy.xid;
import java.util.*; import java.util.Vector;
/**
/*
* *
*/ */
public class IdsDataByIndex extends Vector<IdDataCore> implements IdDataCore public class IdsDataByIndex extends Vector<IdDataCore> implements IdDataCore
@ -14,8 +13,8 @@ public class IdsDataByIndex extends Vector<IdDataCore> implements IdDataCore
/** /**
* *
*/ */
public IdsDataByIndex () public IdsDataByIndex()
{ {
super (); super();
} }
} }

View file

@ -1,36 +1,96 @@
package fr.devinsy.xid; package fr.devinsy.xid;
import org.xml.sax.*; import java.util.Vector;
import java.util.*;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXParseException;
/** /**
* Extract from org.xml.sax Interface ErrorHandler: * Extract from org.xml.sax Interface ErrorHandler: "If a SAX application needs
* "If a SAX application needs to implement customized error handling, * to implement customized error handling, it must implement this interface and
* it must implement this interface and then register an instance with * then register an instance with the XML reader using the setErrorHandler
* the XML reader using the setErrorHandler method. The parser will * method. The parser will then report all errors and warnings through this
* then report all errors and warnings through this interface." * interface."
* *
*/ */
public class ParserErrorHandler implements ErrorHandler public class ParserErrorHandler implements ErrorHandler
{ {
Vector<String> messages; private Vector<String> messages;
int fatalErrorsCount; private int fatalErrorsCount;
int errorsCount; private int errorsCount;
int warningCount; private int warningCount;
public ParserErrorHandler () public ParserErrorHandler()
{ {
fatalErrorsCount = 0; fatalErrorsCount = 0;
errorsCount = 0; errorsCount = 0;
warningCount = 0; warningCount = 0;
messages = new Vector<String> (); messages = new Vector<String>();
} }
/** /**
* *
*/ */
public int fatalErrorsCount () public int allErrorsCount()
{
int result;
result = fatalErrorsCount() + errorsCount() + warningCount();
//
return (result);
}
/**
* Called by the XML parser to handle fatal errors.
*
* @param ex
* Parse Excpetion. Contains the warning text and the line
* number.
*/
@Override
public void error(final SAXParseException exception)
{
String message = "Error at line " + exception.getLineNumber() + " : " + exception.getMessage();
this.errorsCount += 1;
this.messages.add(message);
}
/**
*
*/
public int errorsCount()
{
int result;
result = this.errorsCount;
//
return (result);
}
/**
* Called by the XML parser to handle fatal errors.
*
* @param ex
* Parse Excpetion. Contains the error text and the line number.
* When a fatal parse error occurs, the parse does not return a
* document.
*/
@Override
public void fatalError(final SAXParseException exception)
{
String message = "Fatal error at line " + exception.getLineNumber() + " : " + exception.getMessage();
this.fatalErrorsCount += 1;
this.messages.add(message);
}
/**
*
*/
public int fatalErrorsCount()
{ {
int result; int result;
@ -43,50 +103,11 @@ public class ParserErrorHandler implements ErrorHandler
/** /**
* *
*/ */
public int errorsCount () public boolean hasError()
{
int result;
result = this.errorsCount;
//
return (result);
}
/**
*
*/
public int warningCount ()
{
int result;
result = this.warningCount;
//
return (result);
}
/**
*
*/
public int allErrorsCount ()
{
int result;
result = fatalErrorsCount () + errorsCount () + warningCount ();
//
return (result);
}
/**
*
*/
public boolean hasError ()
{ {
boolean result; boolean result;
if (allErrorsCount () == 0) if (allErrorsCount() == 0)
{ {
result = false; result = false;
} }
@ -99,61 +120,52 @@ public class ParserErrorHandler implements ErrorHandler
return (result); return (result);
} }
/** /**
* Called by the XML parser to handle fatal errors. *
* @param ex Parse Excpetion. Contains the warning text and the line number.
*/ */
public void error (SAXParseException exception) @Override
public String toString()
{ {
String message = "Error at line " + exception.getLineNumber() + " : " + exception.getMessage(); StringBuffer result;
this.errorsCount += 1; result = new StringBuffer();
this.messages.add (message);
}
/** for (String message : messages)
* Called by the XML parser to handle fatal errors. {
* @param ex Parse Excpetion. Contains the error text and the line number. result.append(message);
* When a fatal parse error occurs, the parse does not return a document. result.append('\n');
*/ }
public void fatalError (SAXParseException exception)
{
String message = "Fatal error at line " + exception.getLineNumber() + " : " + exception.getMessage();
this.fatalErrorsCount += 1; //
this.messages.add (message); return (result.toString());
} }
/** /**
* Called by the XML parser to handle warnings. * Called by the XML parser to handle warnings.
* @param ex Parse Excpetion. Contains the warning text and the line number. *
* @param ex
* Parse Excpetion. Contains the warning text and the line
* number.
*/ */
public void warning(SAXParseException exception) @Override
public void warning(final SAXParseException exception)
{ {
String message = "Warning at line " + exception.getLineNumber() + " : " + exception.getMessage(); String message = "Warning at line " + exception.getLineNumber() + " : " + exception.getMessage();
this.warningCount += 1; this.warningCount += 1;
this.messages.add (message); this.messages.add(message);
} }
/** /**
* *
*/ */
public String toString () public int warningCount()
{ {
StringBuffer result; int result;
result = new StringBuffer (); result = this.warningCount;
for (String message : messages)
{
result.append (message);
result.append ('\n');
}
// //
return (result.toString ()); return (result);
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -3,77 +3,52 @@ package fr.devinsy.xid;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.StringWriter; import java.io.StringWriter;
/** /**
* *
*/ */
public class StringPresenter extends DomPresenter public class StringPresenter extends DomPresenter
{ {
static protected org.apache.log4j.Logger logger; static private org.apache.log4j.Logger logger;
static static
{ {
logger = org.apache.log4j.Logger.getLogger (StringPresenter.class); logger = org.apache.log4j.Logger.getLogger(StringPresenter.class);
} }
protected String html; private String html;
/* /**
* *
*/ */
public StringPresenter () public StringPresenter()
{ {
super (); super();
this.doc = null; this.doc = null;
this.html = null; this.html = null;
} }
/**
/*
* *
*/ */
public StringPresenter (String html) public StringPresenter(final String html)
{ {
this.doc = null; this.doc = null;
this.html = html; this.html = html;
} }
/**
/*
* *
*/ */
public void setSource (String html) @Override
public StringBuffer doXid(final Data datas) throws Exception
{ {
this.html = html; return (doXid(datas.getIdsDataById()));
this.doc = null;
} }
/**
/*
* *
*/ */
public String source () @Override
{ public StringBuffer doXid(final IdsDataById datas) throws Exception
String result;
result = this.html;
//
return (result);
}
/*
*
*/
public StringBuffer doXid (Data datas) throws Exception
{
return (doXid (datas.getIdsDataById ()));
}
/*
*
*/
public StringBuffer doXid (IdsDataById datas) throws Exception
{ {
StringBuffer result; StringBuffer result;
@ -81,10 +56,7 @@ public class StringPresenter extends DomPresenter
{ {
// Build doc from this.html. // Build doc from this.html.
String htmlSource; String htmlSource;
if ((this.html.startsWith ("<!DOCTYPE")) || if ((this.html.startsWith("<!DOCTYPE")) || (this.html.startsWith("<!doctype")) || (this.html.startsWith("<html>")) || (this.html.startsWith("<HTML>")))
(this.html.startsWith ("<!doctype")) ||
(this.html.startsWith ("<html>")) ||
(this.html.startsWith ("<HTML>")))
{ {
htmlSource = html; htmlSource = html;
} }
@ -94,33 +66,30 @@ public class StringPresenter extends DomPresenter
} }
// StringBufferInputStream is deprecated so we use another solution. // StringBufferInputStream is deprecated so we use another solution.
// (see http://www.developpez.net/forums/archive/index.php/t-14101.html). // (see
doc = buildTree (new ByteArrayInputStream (htmlSource.getBytes ())); // http://www.developpez.net/forums/archive/index.php/t-14101.html).
doc = buildTree(new ByteArrayInputStream(htmlSource.getBytes()));
} }
StringWriter htmlCode = new StringWriter(Presenter.estimatedTargetLength(this.html.length())); StringWriter htmlCode = new StringWriter(Presenter.estimatedTargetLength(this.html.length()));
if ((this.html.startsWith ("<!DOCTYPE")) || if ((this.html.startsWith("<!DOCTYPE")) || (this.html.startsWith("<!doctype")))
(this.html.startsWith ("<!doctype")))
{ {
htmlCode.write(this.html.substring(0, this.html.indexOf('>'))); htmlCode.write(this.html.substring(0, this.html.indexOf('>')));
} }
Presenter.doXid (htmlCode, doc, datas); Presenter.doXid(htmlCode, doc, datas);
StringBuffer htmlTarget = htmlCode.getBuffer(); StringBuffer htmlTarget = htmlCode.getBuffer();
if (htmlTarget == null) if (htmlTarget == null)
{ {
result = null; result = null;
} }
else if ((this.html.startsWith ("<!DOCTYPE")) || else if ((this.html.startsWith("<!DOCTYPE")) || (this.html.startsWith("<!doctype")) || (this.html.startsWith("<html>")) || (this.html.startsWith("<HTML>")))
(this.html.startsWith ("<!doctype")) ||
(this.html.startsWith ("<html>")) ||
(this.html.startsWith ("<HTML>")))
{ {
result = htmlTarget; result = htmlTarget;
} }
else else
{ {
String bodyContent = extractBodyContent (htmlTarget); String bodyContent = extractBodyContent(htmlTarget);
if (bodyContent == null) if (bodyContent == null)
{ {
@ -128,7 +97,7 @@ public class StringPresenter extends DomPresenter
} }
else else
{ {
result = new StringBuffer (bodyContent); result = new StringBuffer(bodyContent);
} }
} }
@ -136,26 +105,47 @@ public class StringPresenter extends DomPresenter
return (result); return (result);
} }
/**
/*
* *
*/ */
static public StringBuffer doXid (String html, Data datas) throws Exception public void setSource(final String html)
{ {
return (doXid (html, datas.getIdsDataById ())); this.html = html;
this.doc = null;
} }
/**
*
*/
@Override
public String source()
{
String result;
/* result = this.html;
//
return (result);
}
/**
*
*/
static public StringBuffer doXid(final String html, final Data datas) throws Exception
{
return (doXid(html, datas.getIdsDataById()));
}
/**
* Xid a string with html in. * Xid a string with html in.
*/ */
static public StringBuffer doXid (String html, IdsDataById datas) throws Exception static public StringBuffer doXid(final String html, final IdsDataById datas) throws Exception
{ {
StringBuffer result; StringBuffer result;
StringPresenter presenter = new StringPresenter (html); StringPresenter presenter = new StringPresenter(html);
result = presenter.doXid (datas); result = presenter.doXid(datas);
// //
return (result); return (result);

View file

@ -13,18 +13,7 @@ class XidTest
{ {
public enum MONTHS public enum MONTHS
{ {
JANUARY, JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER, OCTOBER, NOVEMBRE, DECEMBRE
FEBRUARY,
MARCH,
APRIL,
MAY,
JUNE,
JULY,
AUGUST,
SEPTEMBER,
OCTOBER,
NOVEMBRE,
DECEMBRE
} }
static static
@ -104,8 +93,7 @@ class XidTest
System.out.println(exception.getMessage()); System.out.println(exception.getMessage());
html = null; html = null;
} }
System.out.println(check("content and attributes", html, System.out.println(check("content and attributes", html, "<div id=\"lastname\" style=\"background: blue;foreground: red;\" class=\"nameClass\">Spiderman</div>"));
"<div id=\"lastname\" style=\"background: blue;foreground: red;\" class=\"nameClass\">Spiderman</div>"));
// Populate attributes of Test 03. // Populate attributes of Test 03.
System.out.println("----------------------------"); System.out.println("----------------------------");
@ -159,12 +147,9 @@ class XidTest
html = null; html = null;
} }
System.out System.out.println(check("table 1 assertion 1", html, "<tr id=\"identity_0\"><td>noid</td><td id=\"nom_0\">Jemba</td><td id=\"prenom_0\">Epo</td></tr>"));
.println(check("table 1 assertion 1", html, "<tr id=\"identity_0\"><td>noid</td><td id=\"nom_0\">Jemba</td><td id=\"prenom_0\">Epo</td></tr>")); System.out.println(check("table 1 assertion 2", html, "<tr id=\"identity_1\"><td>noid</td><td id=\"nom_1\">Momon</td><td id=\"prenom_1\">Christian</td></tr>"));
System.out.println(check("table 1 assertion 2", html, System.out.println(check("table 1 assertion 3", html, "<tr id=\"identity_2\"><td>noid</td><td id=\"nom_2\">Tronche</td><td id=\"prenom_2\">Christophe</td></tr>"));
"<tr id=\"identity_1\"><td>noid</td><td id=\"nom_1\">Momon</td><td id=\"prenom_1\">Christian</td></tr>"));
System.out.println(check("table 1 assertion 3", html,
"<tr id=\"identity_2\"><td>noid</td><td id=\"nom_2\">Tronche</td><td id=\"prenom_2\">Christophe</td></tr>"));
/* /*
* // Populate attributes of Test 03. System.out.println * // Populate attributes of Test 03. System.out.println