You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by tv...@apache.org on 2010/07/29 17:46:30 UTC
svn commit: r980482 [1/4] - in /pivot/trunk: ./
core/src/org/apache/pivot/beans/ core/src/org/apache/pivot/json/
core/src/org/apache/pivot/util/ core/test/org/apache/pivot/json/test/
demos-server/ demos-server/src/org/apache/pivot/demos/rest/server/ de...
Author: tvolkert
Date: Thu Jul 29 15:46:23 2010
New Revision: 980482
URL: http://svn.apache.org/viewvc?rev=980482&view=rev
Log:
Updated svn props and LICENSE file
Modified:
pivot/trunk/LICENSE
pivot/trunk/core/src/org/apache/pivot/beans/DefaultProperty.java (props changed)
pivot/trunk/core/src/org/apache/pivot/beans/IDProperty.java (props changed)
pivot/trunk/core/src/org/apache/pivot/beans/NamespaceBinding.java (props changed)
pivot/trunk/core/src/org/apache/pivot/beans/Resolvable.java (props changed)
pivot/trunk/core/src/org/apache/pivot/json/package.html (props changed)
pivot/trunk/core/src/org/apache/pivot/util/MessageBus.java (props changed)
pivot/trunk/core/src/org/apache/pivot/util/MessageBusListener.java (props changed)
pivot/trunk/core/test/org/apache/pivot/json/test/BindTest.java (props changed)
pivot/trunk/core/test/org/apache/pivot/json/test/SampleBean.java (props changed)
pivot/trunk/demos-server/src/org/apache/pivot/demos/rest/server/RESTDemoServlet.java (props changed)
pivot/trunk/demos-server/web.xml (props changed)
pivot/trunk/demos/src/org/apache/pivot/demos/rest/RESTDemoTest.java (props changed)
pivot/trunk/demos/src/org/apache/pivot/demos/rest/contact.json (props changed)
pivot/trunk/demos/src/org/apache/pivot/demos/richtexteditor/RichTextEditorDemo.java (contents, props changed)
pivot/trunk/demos/src/org/apache/pivot/demos/richtexteditor/document.bxml (props changed)
pivot/trunk/demos/src/org/apache/pivot/demos/richtexteditor/richtexteditor.bxml (props changed)
pivot/trunk/demos/src/org/apache/pivot/demos/roweditor/AmountBindMapping.java (props changed)
pivot/trunk/demos/src/org/apache/pivot/demos/styles/ColorSchemeBuilder.java (props changed)
pivot/trunk/demos/src/org/apache/pivot/demos/styles/ColorSchemeBuilderWindow.java (props changed)
pivot/trunk/demos/src/org/apache/pivot/demos/styles/color_scheme_builder_window.bxml (props changed)
pivot/trunk/demos/src/org/apache/pivot/demos/styles/sample_content.bxml (props changed)
pivot/trunk/demos/src/org/apache/pivot/demos/styles/styles.json (props changed)
pivot/trunk/demos/src/org/apache/pivot/demos/styles/stylesheet_demo.bxml (props changed)
pivot/trunk/demos/www/color-scheme-builder.xml (props changed)
pivot/trunk/demos/www/favicon.ico (props changed)
pivot/trunk/eclipse/META-INF/MANIFEST.MF (props changed)
pivot/trunk/eclipse/build.properties (props changed)
pivot/trunk/eclipse/icons/logo-notext-16x16.png (props changed)
pivot/trunk/eclipse/plugin.xml (props changed)
pivot/trunk/eclipse/src/org/apache/pivot/eclipse/PivotApplicationLaunchShortcut.java (props changed)
pivot/trunk/eclipse/src/org/apache/pivot/eclipse/PivotPlugin.java (props changed)
pivot/trunk/eclipse/src/org/apache/pivot/eclipse/PivotScriptApplicationLaunchShortcut.java (props changed)
pivot/trunk/etc/pivot.keystore (props changed)
pivot/trunk/examples/src/org/apache/pivot/examples/displays/multiple_display_example.bxml (props changed)
pivot/trunk/examples/src/org/apache/pivot/examples/keyboard/ComponentKeyListenerExample.java (props changed)
pivot/trunk/examples/src/org/apache/pivot/examples/keyboard/component_key_listener_example.bxml (props changed)
pivot/trunk/examples/src/org/apache/pivot/examples/scripting/JavaWindow.java (props changed)
pivot/trunk/examples/src/org/apache/pivot/examples/scripting/ScalaWindow.scala (props changed)
pivot/trunk/examples/src/org/apache/pivot/examples/scripting/groovy_window.bxml (props changed)
pivot/trunk/examples/src/org/apache/pivot/examples/scripting/java_window.bxml (props changed)
pivot/trunk/examples/src/org/apache/pivot/examples/scripting/javascript_window.bxml (props changed)
pivot/trunk/examples/src/org/apache/pivot/examples/scripting/scala_window.bxml (props changed)
pivot/trunk/examples/src/org/apache/pivot/examples/sheets/EditGreetingSheet.java (props changed)
pivot/trunk/examples/src/org/apache/pivot/examples/sheets/EditGreetingSheet.json (props changed)
pivot/trunk/examples/src/org/apache/pivot/examples/sheets/SheetExampleWindow.java (props changed)
pivot/trunk/examples/src/org/apache/pivot/examples/sheets/SheetExampleWindow.json (props changed)
pivot/trunk/examples/src/org/apache/pivot/examples/sheets/edit_greeting_sheet.bxml (props changed)
pivot/trunk/examples/src/org/apache/pivot/examples/sheets/sheet_example_window.bxml (props changed)
pivot/trunk/examples/src/org/apache/pivot/examples/swing/SwingDemo.java (props changed)
pivot/trunk/examples/src/org/apache/pivot/examples/swing/pivot_window.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/BXMLDictionaryTest.java (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/NamespaceTest.java (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/accordion_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/action_mapping_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/activity_indicator_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/advanced_baseline_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/alert_prompt_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/application_handler_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/attached_property_element_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/baseline_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/border_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/bxml_dictionary_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/bxml_dictionary_test_include.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/calendar_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/card_pane_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/chinese_characters_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/color_chooser_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/color_list_button_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/context_menu_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/data_binding_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/drawing_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/expander_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/flow_pane_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/font_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/form_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/gridpane_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/image_view_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/include_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/include_test.content.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/label_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/layout_cache_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/list_selection_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/listview_test2.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/menu_bar_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/named_styles_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/namespace_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/namespace_test_content.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/paint_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/panel_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/panorama_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/pivot_507.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/pivot_552.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/preferred_aspect_ratio_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/print_dialog_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/resolve_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/sample_drawing.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/script_application_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/script_application_test.frame.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/size_limits_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/slider_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/spinner_focus_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/splitpane_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/suggestion_popup_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/table_pane_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/table_selection_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/table_view_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/table_view_test2.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/test_styles.json (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/text/ComponentNodeAdapter.java (contents, props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/text/document.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/text/text_area_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/text/unconstrained_text_area_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/textInputValidator_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/text_input_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/text_test.bxml (props changed)
pivot/trunk/tests/src/org/apache/pivot/tests/watermark_decorator_test.bxml (props changed)
pivot/trunk/tutorials-server/src/org/apache/pivot/tutorials/webqueries/server/Expense.java (props changed)
pivot/trunk/tutorials-server/src/org/apache/pivot/tutorials/webqueries/server/ExpenseServlet.java (props changed)
pivot/trunk/tutorials-server/src/org/apache/pivot/tutorials/webqueries/server/expenses.csv (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/alert.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/alerts.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/backgroundtasks/background_tasks.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/boundedrange/scroll_bars.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/boundedrange/sliders.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/boundedrange/spinners.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/buttons.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/buttons/checkboxes.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/buttons/link_buttons.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/buttons/push_buttons.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/buttons/radio_buttons.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/buttons/toggle_buttons.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/calendars.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/calendars/calendars.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/clipboard/clipboard.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/color_choosers.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/colorchoosers/color_choosers.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/databinding/PropertyBinding.java (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/databinding/data_binding.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/databinding/property_binding.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/dragdrop.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/dragdrop/drag_drop.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/drawing/simple_drawing.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/effects/decorators.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/effects/transitions.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/accordion.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/activity_indicator.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/border.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/box_pane.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/calendar.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/calendar_button.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/card_pane.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/checkbox.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/color_chooser.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/color_chooser_button.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/component_explorer_window.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/expander.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/file_browser.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/flow_pane.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/form.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/grid_pane.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/image_view.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/label.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/link_button.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/list_button.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/list_view.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/menu_bar.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/menu_button.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/meter.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/panel.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/panorama.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/push_button.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/radio_button.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/rollup.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/scroll_bar.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/scroll_pane.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/separator.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/slider.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/spinner.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/split_pane.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/stack_pane.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/tab_pane.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/table_pane.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/table_view.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/text_area.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/text_area.txt (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/text_input.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/tree_view.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/filebrowsing/file_browsing.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/hello.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/hello_javascript.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/kitchen_sink.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/labels/labels.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/borders.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/box_panes.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/flow_panes.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/forms.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/grid_panes.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/panels.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/simple_table_panes.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/split_panes.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/stack_panes.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/table_panes.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/table_panes_configure_cell.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/table_panes_configure_column.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/table_panes_configure_row.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/lists.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/lists/list_buttons.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/lists/list_views.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/localization/localization.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menu_bar.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menu_buttons.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menu_section.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/context_menus.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/document.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/menu_bars.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/menu_buttons.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/meters.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/accordions.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/address.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/card_panes.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/expanders.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/panoramas.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/payment.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/rollups.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/scroll_panes.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/shipping.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/stocks.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/summary.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/tab_panes.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/weather.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/progress/activity_indicators.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/progress/meters.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/scripting/scripting.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/separators/separators.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/spinners.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/splitters.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/tables.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/tableviews/basic_table_view.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/tableviews/custom_table_view.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/tableviews/json_table_view.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/suggestion_popups.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/text_areas.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/text_inputs.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/trees.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/treeviews/tree_data.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/treeviews/tree_views.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/AmountBindMapping.java (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/AmountValidator.java (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/DateBindMapping.java (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ExpenseSheet.java (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ExpenseSheet.json (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/Expenses.java (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ExpensesWindow.java (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ExpensesWindow.json (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/IDBindMapping.java (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/add.png (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/delete.png (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/expense_sheet.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/expenses_window.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/pencil.png (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/pencil_add.png (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/types.json (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/web_queries.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/windows/dialog.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/windows/frame.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/windows/palette.bxml (props changed)
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/windows/sheet.bxml (props changed)
pivot/trunk/tutorials/www/property-binding.xml (props changed)
pivot/trunk/tutorials/www/query-servlet.xml (props changed)
pivot/trunk/web-server/lib/servlet-api.jar (props changed)
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPanelSkin.java (props changed)
pivot/trunk/wtk/src/org/apache/pivot/wtk/ComponentStyleListener.java (props changed)
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkinBlockView.java (contents, props changed)
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkinBulletedListView.java (contents, props changed)
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkinComponentNodeView.java (contents, props changed)
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkinDocumentView.java (contents, props changed)
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkinElementView.java (contents, props changed)
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkinImageNodeView.java (contents, props changed)
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkinListItemView.java (contents, props changed)
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkinListView.java (contents, props changed)
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkinNodeView.java (contents, props changed)
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkinNumberedListView.java (contents, props changed)
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkinParagraphView.java (contents, props changed)
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkinSpanView.java (contents, props changed)
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkinTextNodeView.java (contents, props changed)
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkinVerticalElementView.java (contents, props changed)
pivot/trunk/wtk/src/org/apache/pivot/wtk/text/BlockListener.java (contents, props changed)
pivot/trunk/wtk/src/org/apache/pivot/wtk/text/BulletedListListener.java (contents, props changed)
pivot/trunk/wtk/src/org/apache/pivot/wtk/text/ComponentNode.java (contents, props changed)
pivot/trunk/wtk/src/org/apache/pivot/wtk/text/ComponentNodeListener.java (contents, props changed)
pivot/trunk/wtk/src/org/apache/pivot/wtk/text/NumberedListListener.java (contents, props changed)
Modified: pivot/trunk/LICENSE
URL: http://svn.apache.org/viewvc/pivot/trunk/LICENSE?rev=980482&r1=980481&r2=980482&view=diff
==============================================================================
--- pivot/trunk/LICENSE (original)
+++ pivot/trunk/LICENSE Thu Jul 29 15:46:23 2010
@@ -371,6 +371,10 @@ The following components are licensed un
tutorials/src/org/apache/pivot/tutorials/star.png
tutorials/src/org/apache/pivot/tutorials/stocktracker/add.png
tutorials/src/org/apache/pivot/tutorials/stocktracker/delete.png
+ tutorials/src/org/apache/pivot/tutorials/webqueries/add.png
+ tutorials/src/org/apache/pivot/tutorials/webqueries/delete.png
+ tutorials/src/org/apache/pivot/tutorials/webqueries/pencil.png
+ tutorials/src/org/apache/pivot/tutorials/webqueries/pencil_add.png
tutorials/src/org/apache/pivot/tutorials/windows/application_form.png
wtk-terra/src/org/apache/pivot/wtk/skin/terra/drive.png
wtk-terra/src/org/apache/pivot/wtk/skin/terra/folder_add.png
Propchange: pivot/trunk/core/src/org/apache/pivot/beans/DefaultProperty.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/core/src/org/apache/pivot/beans/IDProperty.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/core/src/org/apache/pivot/beans/NamespaceBinding.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/core/src/org/apache/pivot/beans/Resolvable.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/core/src/org/apache/pivot/json/package.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/core/src/org/apache/pivot/util/MessageBus.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/core/src/org/apache/pivot/util/MessageBusListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/core/test/org/apache/pivot/json/test/BindTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/core/test/org/apache/pivot/json/test/SampleBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/demos-server/src/org/apache/pivot/demos/rest/server/RESTDemoServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/demos-server/web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/demos/src/org/apache/pivot/demos/rest/RESTDemoTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/demos/src/org/apache/pivot/demos/rest/contact.json
------------------------------------------------------------------------------
svn:eol-style = native
Modified: pivot/trunk/demos/src/org/apache/pivot/demos/richtexteditor/RichTextEditorDemo.java
URL: http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/demos/richtexteditor/RichTextEditorDemo.java?rev=980482&r1=980481&r2=980482&view=diff
==============================================================================
--- pivot/trunk/demos/src/org/apache/pivot/demos/richtexteditor/RichTextEditorDemo.java (original)
+++ pivot/trunk/demos/src/org/apache/pivot/demos/richtexteditor/RichTextEditorDemo.java Thu Jul 29 15:46:23 2010
@@ -1,621 +1,621 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you 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 org.apache.pivot.demos.richtexteditor;
-
-import java.awt.Color;
-import java.awt.Font;
-import java.awt.GraphicsEnvironment;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintStream;
-
-import org.apache.pivot.beans.BXML;
-import org.apache.pivot.beans.BXMLSerializer;
-import org.apache.pivot.collections.ArrayList;
-import org.apache.pivot.collections.List;
-import org.apache.pivot.collections.Map;
-import org.apache.pivot.wtk.Alert;
-import org.apache.pivot.wtk.Application;
-import org.apache.pivot.wtk.Button;
-import org.apache.pivot.wtk.ButtonPressListener;
-import org.apache.pivot.wtk.Checkbox;
-import org.apache.pivot.wtk.ColorChooserButton;
-import org.apache.pivot.wtk.ColorChooserButtonSelectionListener;
-import org.apache.pivot.wtk.DesktopApplicationContext;
-import org.apache.pivot.wtk.Display;
-import org.apache.pivot.wtk.FileBrowserSheet;
-import org.apache.pivot.wtk.HorizontalAlignment;
-import org.apache.pivot.wtk.ListButton;
-import org.apache.pivot.wtk.ListButtonSelectionListener;
-import org.apache.pivot.wtk.ListView;
-import org.apache.pivot.wtk.PushButton;
-import org.apache.pivot.wtk.Sheet;
-import org.apache.pivot.wtk.SheetCloseListener;
-import org.apache.pivot.wtk.TextArea;
-import org.apache.pivot.wtk.Window;
-import org.apache.pivot.wtk.content.ListButtonDataRenderer;
-import org.apache.pivot.wtk.content.ListViewItemRenderer;
-import org.apache.pivot.wtk.content.NumericSpinnerData;
-import org.apache.pivot.wtk.text.Document;
-import org.apache.pivot.wtk.text.Element;
-import org.apache.pivot.wtk.text.Node;
-import org.apache.pivot.wtk.text.Paragraph;
-import org.apache.pivot.wtk.text.TextNode;
-
-/**
- * Demonstrates the use of the rich-text functionality in TextArea.
- */
-public class RichTextEditorDemo implements Application {
- private Window window = null;
- @BXML
- private TextArea textarea = null;
- @BXML
- private PushButton openFileButton = null;
- @BXML
- private PushButton saveFileButton = null;
- @BXML
- private PushButton boldButton = null;
- @BXML
- private PushButton italicButton = null;
- @BXML
- private PushButton underlineButton = null;
- @BXML
- private PushButton strikethroughButton = null;
- @BXML
- private ColorChooserButton foregroundColorChooserButton = null;
- @BXML
- private ColorChooserButton backgroundColorChooserButton = null;
- @BXML
- private ListButton fontFamilyListButton = null;
- @BXML
- private ListButton fontSizeListButton = null;
- @BXML
- private Checkbox wrapTextCheckbox = null;
- @BXML
- private PushButton alignLeftButton= null;
- @BXML
- private PushButton alignCentreButton= null;
- @BXML
- private PushButton alignRightButton= null;
-
- private File loadedFile = null;
-
- public RichTextEditorDemo() {
- }
-
- @Override
- public void startup(Display display, Map<String, String> properties) throws Exception {
- BXMLSerializer bxmlSerializer = new BXMLSerializer();
- window = (Window)bxmlSerializer.readObject(RichTextEditorDemo.class, "richtexteditor.bxml");
- bxmlSerializer.bind(this, RichTextEditorDemo.class);
-
- window.setTitle("Apache Pivot Rich Text Editor Demo");
-
- // make the text on the "bold" button bold
- Font boldButtonFont = (Font)boldButton.getStyles().get("font");
- boldButton.getStyles().put("font", boldButtonFont.deriveFont(Font.BOLD));
-
- // make the text on the "italic" button italic
- Font italicButtonFont = (Font)italicButton.getStyles().get("font");
- italicButton.getStyles().put("font", italicButtonFont.deriveFont(Font.ITALIC));
-
- fontFamilyListButton.setListData(new ArrayList<String>(
- GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()));
- fontSizeListButton.setSelectedItem(fontFamilyListButton.getListData().get(0));
- fontFamilyListButton.setItemRenderer(new ListViewItemRenderer() {
- @Override
- public void render(Object item, int index, ListView listView, boolean selected,
- boolean checked, boolean highlighted, boolean disabled) {
- super.render(item, index, listView, selected, checked, highlighted, disabled);
- if (item != null) {
- String fontFamilyName = (String)item;
- label.getStyles().put("font", Font.decode(fontFamilyName + "-12"));
- }
- }
- });
- fontFamilyListButton.setDataRenderer(new ListButtonDataRenderer() {
- @Override
- public void render(Object data, Button button, boolean highlight) {
- super.render(data, button, highlight);
- if (data != null) {
- String fontFamilyName = (String)data;
- label.getStyles().put("font", Font.decode(fontFamilyName + "-12"));
- }
- }
- });
-
- fontSizeListButton.setListData(new NumericSpinnerData(12, 30, 1));
- fontSizeListButton.setSelectedItem(12);
-
- openFileButton.getButtonPressListeners().add(new ButtonPressListener() {
- @Override
- public void buttonPressed(Button button) {
- final FileBrowserSheet fileBrowserSheet = new FileBrowserSheet();
-
- fileBrowserSheet.setMode(FileBrowserSheet.Mode.OPEN);
- fileBrowserSheet.open(window, new SheetCloseListener() {
- @Override
- public void sheetClosed(Sheet sheet) {
- if (sheet.getResult()) {
- loadedFile = fileBrowserSheet.getSelectedFile();
-
- try {
- StringBuilder buf = new StringBuilder();
- BufferedReader reader = new BufferedReader(new FileReader(
- loadedFile));
- while (reader.ready()) {
- buf.append(reader.readLine());
- buf.append("\n");
- }
- reader.close();
- textarea.setText(buf.toString());
- window.setTitle(loadedFile.getCanonicalPath());
- } catch (IOException ex) {
- ex.printStackTrace();
- Alert.alert(ex.getMessage(), window);
- }
- }
- }
- });
- }
- });
-
- saveFileButton.getButtonPressListeners().add(new ButtonPressListener() {
- @Override
- public void buttonPressed(Button button) {
- final FileBrowserSheet fileBrowserSheet = new FileBrowserSheet();
-
- if (loadedFile != null) {
- fileBrowserSheet.setMode(FileBrowserSheet.Mode.SAVE_TO);
- fileBrowserSheet.setSelectedFile(loadedFile);
- } else {
- fileBrowserSheet.setMode(FileBrowserSheet.Mode.SAVE_AS);
- }
- fileBrowserSheet.open(window, new SheetCloseListener() {
- @Override
- public void sheetClosed(Sheet sheet) {
- if (sheet.getResult()) {
- File selectedFile = fileBrowserSheet.getSelectedFile();
-
- try {
- String buf = textarea.getText();
- FileWriter writer = new FileWriter(selectedFile);
- writer.write(buf);
- writer.close();
- loadedFile = selectedFile;
- textarea.setText(buf.toString());
- window.setTitle(loadedFile.getCanonicalPath());
- } catch (IOException ex) {
- ex.printStackTrace();
- Alert.alert(ex.getMessage(), window);
- }
- }
- }
- });
- }
- });
-
- boldButton.getButtonPressListeners().add(new ButtonPressListener() {
- @Override
- public void buttonPressed(Button button) {
- applyStyleToSelection(new StyleApplicator() {
- @Override
- public void apply(org.apache.pivot.wtk.text.Span span) {
- if (span.getFont() != null) {
- Font font = span.getFont();
- if (font.getStyle() == Font.PLAIN) {
- font = font.deriveFont(Font.BOLD);
- } else if (font.getStyle() == Font.BOLD) {
- font = font.deriveFont(Font.PLAIN);
- } else {
- // the font is BOLD+ITALIC
- font = font.deriveFont(Font.ITALIC);
- }
- span.setFont(font);
- } else {
- span.setFont("Arial BOLD 12");
- }
- }
- });
- }
- });
-
- italicButton.getButtonPressListeners().add(new ButtonPressListener() {
- @Override
- public void buttonPressed(Button button) {
- applyStyleToSelection(new StyleApplicator() {
- @Override
- public void apply(org.apache.pivot.wtk.text.Span span) {
- if (span.getFont() != null) {
- Font font = span.getFont();
- if (font.getStyle() == Font.PLAIN) {
- font = font.deriveFont(Font.ITALIC);
- } else if (font.getStyle() == Font.ITALIC) {
- font = font.deriveFont(Font.PLAIN);
- } else {
- // the font is BOLD+ITALIC
- font = font.deriveFont(Font.BOLD);
- }
- span.setFont(font);
- } else {
- span.setFont("Arial ITALIC 12");
- }
- }
- });
- }
- });
-
- underlineButton.getButtonPressListeners().add(new ButtonPressListener() {
- @Override
- public void buttonPressed(Button button) {
- applyStyleToSelection(new StyleApplicator() {
- @Override
- public void apply(org.apache.pivot.wtk.text.Span span) {
- span.setUnderline(!span.isUnderline());
- }
- });
- }
- });
-
- strikethroughButton.getButtonPressListeners().add(new ButtonPressListener() {
- @Override
- public void buttonPressed(Button button) {
- applyStyleToSelection(new StyleApplicator() {
- @Override
- public void apply(org.apache.pivot.wtk.text.Span span) {
- span.setStrikethrough(!span.isStrikethrough());
- }
- });
- }
- });
-
- foregroundColorChooserButton.getColorChooserButtonSelectionListeners().add(
- new ColorChooserButtonSelectionListener() {
- @Override
- public void selectedColorChanged(ColorChooserButton colorChooserButton,
- Color previousSelectedColor) {
- applyStyleToSelection(new StyleApplicator() {
- @Override
- public void apply(org.apache.pivot.wtk.text.Span span) {
- span.setForegroundColor(foregroundColorChooserButton.getSelectedColor());
- }
- });
- }
- });
-
- backgroundColorChooserButton.getColorChooserButtonSelectionListeners().add(
- new ColorChooserButtonSelectionListener() {
- @Override
- public void selectedColorChanged(ColorChooserButton colorChooserButton,
- Color previousSelectedColor) {
- applyStyleToSelection(new StyleApplicator() {
- @Override
- public void apply(org.apache.pivot.wtk.text.Span span) {
- span.setBackgroundColor(backgroundColorChooserButton.getSelectedColor());
- }
- });
- }
- });
-
- ListButtonSelectionListener fontButtonPressListener = new ListButtonSelectionListener() {
- @Override
- public void selectedIndexChanged(ListButton listButton, int previousSelectedIndex) {
- int selectedFontSize = (Integer)fontSizeListButton.getSelectedItem();
- String selectedFontFamily = (String)fontFamilyListButton.getSelectedItem();
- final Font derivedFont = Font.decode(selectedFontFamily + " " + selectedFontSize);
-
- applyStyleToSelection(new StyleApplicator() {
- @Override
- public void apply(org.apache.pivot.wtk.text.Span span) {
- span.setFont(derivedFont);
- }
- });
- }
- };
- fontFamilyListButton.getListButtonSelectionListeners().add(fontButtonPressListener);
- fontSizeListButton.getListButtonSelectionListeners().add(fontButtonPressListener);
-
- wrapTextCheckbox.getButtonPressListeners().add(new ButtonPressListener() {
- @Override
- public void buttonPressed(Button button) {
- textarea.getStyles().put("wrapText", wrapTextCheckbox.isSelected());
- }
- });
-
- alignLeftButton.getButtonPressListeners().add(new ButtonPressListener() {
- @Override
- public void buttonPressed(Button button) {
- applyAlignmentStyle(HorizontalAlignment.LEFT);
- }
- });
-
- alignCentreButton.getButtonPressListeners().add(new ButtonPressListener() {
- @Override
- public void buttonPressed(Button button) {
- applyAlignmentStyle(HorizontalAlignment.CENTER);
- }
- });
-
- alignRightButton.getButtonPressListeners().add(new ButtonPressListener() {
- @Override
- public void buttonPressed(Button button) {
- applyAlignmentStyle(HorizontalAlignment.RIGHT);
- }
- });
-
- window.open(display);
- textarea.requestFocus();
- }
-
- private interface StyleApplicator {
- void apply(org.apache.pivot.wtk.text.Span span);
- }
-
- private void applyAlignmentStyle(HorizontalAlignment horizontalAlignment) {
- Node node = textarea.getDocument().getDescendantAt(textarea.getSelectionStart());
- while (node != null && !(node instanceof Paragraph)) {
- node = node.getParent();
- }
- if (node != null) {
- Paragraph paragraph = (Paragraph) node;
- paragraph.setHorizontalAlignment(horizontalAlignment);
- }
- }
-
- /** debugging tools */
- @SuppressWarnings("unused")
- private void dumpDocument() {
- dumpDocumentNode(textarea.getDocument(), System.out, 0);
- }
-
- /** debugging tools */
- private void dumpDocumentNode(Node node, PrintStream printStream, final int indent) {
- for (int i = 0; i < indent; i++) {
- printStream.append(" ");
- }
- printStream.append("<" + node.getClass().getSimpleName() + ">");
- if (node instanceof TextNode) {
- TextNode textNode = (TextNode)node;
- String text = textNode.getText();
- printStream.append(text);
- printStream.append("</" + node.getClass().getSimpleName() + ">");
- printStream.println();
- } else {
- printStream.println();
- if (node instanceof Element) {
- Element element = (Element)node;
-
- for (Node childNode : element) {
- dumpDocumentNode(childNode, printStream, indent + 1);
- }
- } else {
- String text = node.toString();
- printStream.append(text);
- }
- for (int i = 0; i < indent; i++) {
- printStream.append(" ");
- }
- printStream.append("</" + node.getClass().getSimpleName() + ">");
- printStream.println();
- }
- }
-
- private void applyStyleToSelection(StyleApplicator styleApplicator) {
- org.apache.pivot.wtk.Span span = textarea.getSelection();
- if (span == null) {
- return;
- }
- applyStyle(textarea.getDocument(), span, styleApplicator);
- }
-
- private void applyStyle(Document document, org.apache.pivot.wtk.Span selectionSpan,
- StyleApplicator styleApplicator) {
- // I can't apply the styles while iterating over the tree, because I
- // need to update the tree.
- // So first collect a list of all the nodes in the tree.
- List<Node> nodeList = new ArrayList<Node>();
- collectNodes(document, nodeList);
-
- final int selectionStart = textarea.getSelectionStart();
- final int selectionLength = textarea.getSelectionLength();
-
- for (Node node : nodeList) {
- if (node instanceof org.apache.pivot.wtk.text.Span) {
- org.apache.pivot.wtk.text.Span span = (org.apache.pivot.wtk.text.Span)node;
- int documentOffset = node.getDocumentOffset();
- int characterCount = node.getCharacterCount();
- org.apache.pivot.wtk.Span textSpan = new org.apache.pivot.wtk.Span(documentOffset,
- documentOffset + characterCount);
- if (selectionSpan.intersects(textSpan)) {
- applyStyleToSpanNode(selectionSpan, styleApplicator, span, characterCount,
- textSpan);
- }
- }
- if (node instanceof org.apache.pivot.wtk.text.TextNode) {
- org.apache.pivot.wtk.text.TextNode textNode = (org.apache.pivot.wtk.text.TextNode)node;
- int documentOffset = node.getDocumentOffset();
- int characterCount = node.getCharacterCount();
- org.apache.pivot.wtk.Span textSpan = new org.apache.pivot.wtk.Span(documentOffset,
- documentOffset + characterCount);
- if (selectionSpan.intersects(textSpan)) {
- applyStyleToTextNode(selectionSpan, styleApplicator, textNode, characterCount,
- textSpan);
- }
- }
- }
-
- // maintain the selected range
- textarea.setSelection(selectionStart, selectionLength);
- }
-
- private void applyStyleToTextNode(org.apache.pivot.wtk.Span selectionSpan,
- StyleApplicator styleApplicator, org.apache.pivot.wtk.text.TextNode textNode,
- int characterCount, org.apache.pivot.wtk.Span textSpan) {
- if (selectionSpan.contains(textSpan)) {
- // if the text-node is contained wholly inside the selection, remove
- // the text-node, replace it with a Span, and apply the style
- Element parent = textNode.getParent();
- org.apache.pivot.wtk.text.Span newSpanNode = new org.apache.pivot.wtk.text.Span();
- newSpanNode.add(new TextNode(textNode.getText()));
- styleApplicator.apply(newSpanNode);
- int index = parent.remove(textNode);
- parent.insert(newSpanNode, index);
- } else if (selectionSpan.start <= textSpan.start) {
- // if the selection covers the first part of the text-node, split
- // off the first part of the text-node, and apply the style to it
- int intersectionLength = selectionSpan.end - textSpan.start;
- String part1 = textNode.getSubstring(0, intersectionLength);
- String part2 = textNode.getSubstring(intersectionLength, characterCount);
-
- org.apache.pivot.wtk.text.Span newSpanNode = new org.apache.pivot.wtk.text.Span();
- newSpanNode.add(new TextNode(part1));
- styleApplicator.apply(newSpanNode);
-
- Element parent = textNode.getParent();
- int index = parent.remove(textNode);
- parent.insert(newSpanNode, index);
- parent.insert(new TextNode(part2), index + 1);
- } else if (selectionSpan.end >= textSpan.end) {
- // if the selection covers the last part of the text-node, split off
- // the last part of the text-node, and apply the style to
- // it
- int intersectionStart = selectionSpan.start - textSpan.start;
- String part1 = textNode.getSubstring(0, intersectionStart);
- String part2 = textNode.getSubstring(intersectionStart, characterCount);
-
- org.apache.pivot.wtk.text.Span newSpanNode = new org.apache.pivot.wtk.text.Span();
- newSpanNode.add(new TextNode(part2));
- styleApplicator.apply(newSpanNode);
-
- Element parent = textNode.getParent();
- int index = parent.remove(textNode);
- parent.insert(new TextNode(part1), index);
- parent.insert(newSpanNode, index + 1);
- } else {
- // if the selection covers an internal part of the text-node, split
- // the
- // text-node into 3 parts, and apply the style to the second part
- int part2Start = selectionSpan.start - textSpan.start;
- int part2End = selectionSpan.end - textSpan.start + 1;
- String part1 = textNode.getSubstring(0, part2Start);
- String part2 = textNode.getSubstring(part2Start, part2End);
- String part3 = textNode.getSubstring(part2End, characterCount);
-
- org.apache.pivot.wtk.text.Span newSpanNode = new org.apache.pivot.wtk.text.Span();
- newSpanNode.add(new TextNode(part2));
- styleApplicator.apply(newSpanNode);
-
- Element parent = textNode.getParent();
- int index = parent.remove(textNode);
- parent.insert(new TextNode(part1), index);
- parent.insert(newSpanNode, index + 1);
- parent.insert(new TextNode(part3), index + 2);
- }
- }
-
- private void applyStyleToSpanNode(org.apache.pivot.wtk.Span selectionSpan,
- StyleApplicator styleApplicator, org.apache.pivot.wtk.text.Span spanNode,
- int characterCount, org.apache.pivot.wtk.Span textSpan) {
- if (selectionSpan.contains(textSpan)) {
- // if the span-node is contained wholly inside the
- // selection, apply the style
- styleApplicator.apply(spanNode);
- } else if (selectionSpan.start <= textSpan.start) {
- // if the selection covers the first part of the span-node, split
- // off the first part of the span-node, and apply the style to it
- int intersectionLength = selectionSpan.end - textSpan.start;
- org.apache.pivot.wtk.text.Span node1 = spanNode.getRange(0, intersectionLength);
- styleApplicator.apply(node1);
- Node node2 = spanNode.getRange(intersectionLength, characterCount - intersectionLength);
- Element parent = spanNode.getParent();
- int index = parent.remove(spanNode);
- parent.insert(node1, index);
- parent.insert(node2, index + 1);
- } else if (selectionSpan.end >= textSpan.end) {
- // if the selection covers the last part of the span-node, split off
- // the last part of the span-node, and apply the style to it
- int intersectionStart = selectionSpan.start - textSpan.start;
- org.apache.pivot.wtk.text.Span part1 = spanNode.getRange(0, intersectionStart);
- org.apache.pivot.wtk.text.Span part2 = spanNode.getRange(intersectionStart,
- characterCount - intersectionStart);
-
- styleApplicator.apply(part2);
-
- Element parent = spanNode.getParent();
- int index = parent.remove(spanNode);
- parent.insert(part1, index);
- parent.insert(part2, index + 1);
- } else {
- // if the selection covers an internal part of the span-node, split
- // the
- // span-node into 3 parts, and apply the style to the second part
- int part2Start = selectionSpan.start - textSpan.start;
- int part2End = selectionSpan.end - textSpan.start;
- org.apache.pivot.wtk.text.Span part1 = spanNode.getRange(0, part2Start);
- org.apache.pivot.wtk.text.Span part2 = spanNode.getRange(part2Start, part2End
- - part2Start);
- org.apache.pivot.wtk.text.Span part3 = spanNode.getRange(part2End, characterCount
- - part2End);
-
- styleApplicator.apply(part2);
-
- Element parent = spanNode.getParent();
- int index = parent.remove(spanNode);
- parent.insert(part1, index);
- parent.insert(part2, index + 1);
- parent.insert(part3, index + 2);
- }
- }
-
- private void collectNodes(org.apache.pivot.wtk.text.Node node, List<Node> nodeList) {
- // don't worry about the text-nodes that are children of Span nodes.
- if (node instanceof org.apache.pivot.wtk.text.Span) {
- return;
- }
- if (node instanceof org.apache.pivot.wtk.text.Element) {
- Element element = (Element)node;
- for (Node child : element) {
- nodeList.add(child);
- collectNodes(child, nodeList);
- }
- }
- }
-
- @Override
- public boolean shutdown(boolean optional) {
- if (window != null) {
- window.close();
- }
-
- return false;
- }
-
- @Override
- public void suspend() {
- }
-
- @Override
- public void resume() {
- }
-
- public static void main(String[] args) {
- DesktopApplicationContext.main(RichTextEditorDemo.class, args);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you 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 org.apache.pivot.demos.richtexteditor;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.GraphicsEnvironment;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintStream;
+
+import org.apache.pivot.beans.BXML;
+import org.apache.pivot.beans.BXMLSerializer;
+import org.apache.pivot.collections.ArrayList;
+import org.apache.pivot.collections.List;
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.wtk.Alert;
+import org.apache.pivot.wtk.Application;
+import org.apache.pivot.wtk.Button;
+import org.apache.pivot.wtk.ButtonPressListener;
+import org.apache.pivot.wtk.Checkbox;
+import org.apache.pivot.wtk.ColorChooserButton;
+import org.apache.pivot.wtk.ColorChooserButtonSelectionListener;
+import org.apache.pivot.wtk.DesktopApplicationContext;
+import org.apache.pivot.wtk.Display;
+import org.apache.pivot.wtk.FileBrowserSheet;
+import org.apache.pivot.wtk.HorizontalAlignment;
+import org.apache.pivot.wtk.ListButton;
+import org.apache.pivot.wtk.ListButtonSelectionListener;
+import org.apache.pivot.wtk.ListView;
+import org.apache.pivot.wtk.PushButton;
+import org.apache.pivot.wtk.Sheet;
+import org.apache.pivot.wtk.SheetCloseListener;
+import org.apache.pivot.wtk.TextArea;
+import org.apache.pivot.wtk.Window;
+import org.apache.pivot.wtk.content.ListButtonDataRenderer;
+import org.apache.pivot.wtk.content.ListViewItemRenderer;
+import org.apache.pivot.wtk.content.NumericSpinnerData;
+import org.apache.pivot.wtk.text.Document;
+import org.apache.pivot.wtk.text.Element;
+import org.apache.pivot.wtk.text.Node;
+import org.apache.pivot.wtk.text.Paragraph;
+import org.apache.pivot.wtk.text.TextNode;
+
+/**
+ * Demonstrates the use of the rich-text functionality in TextArea.
+ */
+public class RichTextEditorDemo implements Application {
+ private Window window = null;
+ @BXML
+ private TextArea textarea = null;
+ @BXML
+ private PushButton openFileButton = null;
+ @BXML
+ private PushButton saveFileButton = null;
+ @BXML
+ private PushButton boldButton = null;
+ @BXML
+ private PushButton italicButton = null;
+ @BXML
+ private PushButton underlineButton = null;
+ @BXML
+ private PushButton strikethroughButton = null;
+ @BXML
+ private ColorChooserButton foregroundColorChooserButton = null;
+ @BXML
+ private ColorChooserButton backgroundColorChooserButton = null;
+ @BXML
+ private ListButton fontFamilyListButton = null;
+ @BXML
+ private ListButton fontSizeListButton = null;
+ @BXML
+ private Checkbox wrapTextCheckbox = null;
+ @BXML
+ private PushButton alignLeftButton= null;
+ @BXML
+ private PushButton alignCentreButton= null;
+ @BXML
+ private PushButton alignRightButton= null;
+
+ private File loadedFile = null;
+
+ public RichTextEditorDemo() {
+ }
+
+ @Override
+ public void startup(Display display, Map<String, String> properties) throws Exception {
+ BXMLSerializer bxmlSerializer = new BXMLSerializer();
+ window = (Window)bxmlSerializer.readObject(RichTextEditorDemo.class, "richtexteditor.bxml");
+ bxmlSerializer.bind(this, RichTextEditorDemo.class);
+
+ window.setTitle("Apache Pivot Rich Text Editor Demo");
+
+ // make the text on the "bold" button bold
+ Font boldButtonFont = (Font)boldButton.getStyles().get("font");
+ boldButton.getStyles().put("font", boldButtonFont.deriveFont(Font.BOLD));
+
+ // make the text on the "italic" button italic
+ Font italicButtonFont = (Font)italicButton.getStyles().get("font");
+ italicButton.getStyles().put("font", italicButtonFont.deriveFont(Font.ITALIC));
+
+ fontFamilyListButton.setListData(new ArrayList<String>(
+ GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()));
+ fontSizeListButton.setSelectedItem(fontFamilyListButton.getListData().get(0));
+ fontFamilyListButton.setItemRenderer(new ListViewItemRenderer() {
+ @Override
+ public void render(Object item, int index, ListView listView, boolean selected,
+ boolean checked, boolean highlighted, boolean disabled) {
+ super.render(item, index, listView, selected, checked, highlighted, disabled);
+ if (item != null) {
+ String fontFamilyName = (String)item;
+ label.getStyles().put("font", Font.decode(fontFamilyName + "-12"));
+ }
+ }
+ });
+ fontFamilyListButton.setDataRenderer(new ListButtonDataRenderer() {
+ @Override
+ public void render(Object data, Button button, boolean highlight) {
+ super.render(data, button, highlight);
+ if (data != null) {
+ String fontFamilyName = (String)data;
+ label.getStyles().put("font", Font.decode(fontFamilyName + "-12"));
+ }
+ }
+ });
+
+ fontSizeListButton.setListData(new NumericSpinnerData(12, 30, 1));
+ fontSizeListButton.setSelectedItem(12);
+
+ openFileButton.getButtonPressListeners().add(new ButtonPressListener() {
+ @Override
+ public void buttonPressed(Button button) {
+ final FileBrowserSheet fileBrowserSheet = new FileBrowserSheet();
+
+ fileBrowserSheet.setMode(FileBrowserSheet.Mode.OPEN);
+ fileBrowserSheet.open(window, new SheetCloseListener() {
+ @Override
+ public void sheetClosed(Sheet sheet) {
+ if (sheet.getResult()) {
+ loadedFile = fileBrowserSheet.getSelectedFile();
+
+ try {
+ StringBuilder buf = new StringBuilder();
+ BufferedReader reader = new BufferedReader(new FileReader(
+ loadedFile));
+ while (reader.ready()) {
+ buf.append(reader.readLine());
+ buf.append("\n");
+ }
+ reader.close();
+ textarea.setText(buf.toString());
+ window.setTitle(loadedFile.getCanonicalPath());
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ Alert.alert(ex.getMessage(), window);
+ }
+ }
+ }
+ });
+ }
+ });
+
+ saveFileButton.getButtonPressListeners().add(new ButtonPressListener() {
+ @Override
+ public void buttonPressed(Button button) {
+ final FileBrowserSheet fileBrowserSheet = new FileBrowserSheet();
+
+ if (loadedFile != null) {
+ fileBrowserSheet.setMode(FileBrowserSheet.Mode.SAVE_TO);
+ fileBrowserSheet.setSelectedFile(loadedFile);
+ } else {
+ fileBrowserSheet.setMode(FileBrowserSheet.Mode.SAVE_AS);
+ }
+ fileBrowserSheet.open(window, new SheetCloseListener() {
+ @Override
+ public void sheetClosed(Sheet sheet) {
+ if (sheet.getResult()) {
+ File selectedFile = fileBrowserSheet.getSelectedFile();
+
+ try {
+ String buf = textarea.getText();
+ FileWriter writer = new FileWriter(selectedFile);
+ writer.write(buf);
+ writer.close();
+ loadedFile = selectedFile;
+ textarea.setText(buf.toString());
+ window.setTitle(loadedFile.getCanonicalPath());
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ Alert.alert(ex.getMessage(), window);
+ }
+ }
+ }
+ });
+ }
+ });
+
+ boldButton.getButtonPressListeners().add(new ButtonPressListener() {
+ @Override
+ public void buttonPressed(Button button) {
+ applyStyleToSelection(new StyleApplicator() {
+ @Override
+ public void apply(org.apache.pivot.wtk.text.Span span) {
+ if (span.getFont() != null) {
+ Font font = span.getFont();
+ if (font.getStyle() == Font.PLAIN) {
+ font = font.deriveFont(Font.BOLD);
+ } else if (font.getStyle() == Font.BOLD) {
+ font = font.deriveFont(Font.PLAIN);
+ } else {
+ // the font is BOLD+ITALIC
+ font = font.deriveFont(Font.ITALIC);
+ }
+ span.setFont(font);
+ } else {
+ span.setFont("Arial BOLD 12");
+ }
+ }
+ });
+ }
+ });
+
+ italicButton.getButtonPressListeners().add(new ButtonPressListener() {
+ @Override
+ public void buttonPressed(Button button) {
+ applyStyleToSelection(new StyleApplicator() {
+ @Override
+ public void apply(org.apache.pivot.wtk.text.Span span) {
+ if (span.getFont() != null) {
+ Font font = span.getFont();
+ if (font.getStyle() == Font.PLAIN) {
+ font = font.deriveFont(Font.ITALIC);
+ } else if (font.getStyle() == Font.ITALIC) {
+ font = font.deriveFont(Font.PLAIN);
+ } else {
+ // the font is BOLD+ITALIC
+ font = font.deriveFont(Font.BOLD);
+ }
+ span.setFont(font);
+ } else {
+ span.setFont("Arial ITALIC 12");
+ }
+ }
+ });
+ }
+ });
+
+ underlineButton.getButtonPressListeners().add(new ButtonPressListener() {
+ @Override
+ public void buttonPressed(Button button) {
+ applyStyleToSelection(new StyleApplicator() {
+ @Override
+ public void apply(org.apache.pivot.wtk.text.Span span) {
+ span.setUnderline(!span.isUnderline());
+ }
+ });
+ }
+ });
+
+ strikethroughButton.getButtonPressListeners().add(new ButtonPressListener() {
+ @Override
+ public void buttonPressed(Button button) {
+ applyStyleToSelection(new StyleApplicator() {
+ @Override
+ public void apply(org.apache.pivot.wtk.text.Span span) {
+ span.setStrikethrough(!span.isStrikethrough());
+ }
+ });
+ }
+ });
+
+ foregroundColorChooserButton.getColorChooserButtonSelectionListeners().add(
+ new ColorChooserButtonSelectionListener() {
+ @Override
+ public void selectedColorChanged(ColorChooserButton colorChooserButton,
+ Color previousSelectedColor) {
+ applyStyleToSelection(new StyleApplicator() {
+ @Override
+ public void apply(org.apache.pivot.wtk.text.Span span) {
+ span.setForegroundColor(foregroundColorChooserButton.getSelectedColor());
+ }
+ });
+ }
+ });
+
+ backgroundColorChooserButton.getColorChooserButtonSelectionListeners().add(
+ new ColorChooserButtonSelectionListener() {
+ @Override
+ public void selectedColorChanged(ColorChooserButton colorChooserButton,
+ Color previousSelectedColor) {
+ applyStyleToSelection(new StyleApplicator() {
+ @Override
+ public void apply(org.apache.pivot.wtk.text.Span span) {
+ span.setBackgroundColor(backgroundColorChooserButton.getSelectedColor());
+ }
+ });
+ }
+ });
+
+ ListButtonSelectionListener fontButtonPressListener = new ListButtonSelectionListener() {
+ @Override
+ public void selectedIndexChanged(ListButton listButton, int previousSelectedIndex) {
+ int selectedFontSize = (Integer)fontSizeListButton.getSelectedItem();
+ String selectedFontFamily = (String)fontFamilyListButton.getSelectedItem();
+ final Font derivedFont = Font.decode(selectedFontFamily + " " + selectedFontSize);
+
+ applyStyleToSelection(new StyleApplicator() {
+ @Override
+ public void apply(org.apache.pivot.wtk.text.Span span) {
+ span.setFont(derivedFont);
+ }
+ });
+ }
+ };
+ fontFamilyListButton.getListButtonSelectionListeners().add(fontButtonPressListener);
+ fontSizeListButton.getListButtonSelectionListeners().add(fontButtonPressListener);
+
+ wrapTextCheckbox.getButtonPressListeners().add(new ButtonPressListener() {
+ @Override
+ public void buttonPressed(Button button) {
+ textarea.getStyles().put("wrapText", wrapTextCheckbox.isSelected());
+ }
+ });
+
+ alignLeftButton.getButtonPressListeners().add(new ButtonPressListener() {
+ @Override
+ public void buttonPressed(Button button) {
+ applyAlignmentStyle(HorizontalAlignment.LEFT);
+ }
+ });
+
+ alignCentreButton.getButtonPressListeners().add(new ButtonPressListener() {
+ @Override
+ public void buttonPressed(Button button) {
+ applyAlignmentStyle(HorizontalAlignment.CENTER);
+ }
+ });
+
+ alignRightButton.getButtonPressListeners().add(new ButtonPressListener() {
+ @Override
+ public void buttonPressed(Button button) {
+ applyAlignmentStyle(HorizontalAlignment.RIGHT);
+ }
+ });
+
+ window.open(display);
+ textarea.requestFocus();
+ }
+
+ private interface StyleApplicator {
+ void apply(org.apache.pivot.wtk.text.Span span);
+ }
+
+ private void applyAlignmentStyle(HorizontalAlignment horizontalAlignment) {
+ Node node = textarea.getDocument().getDescendantAt(textarea.getSelectionStart());
+ while (node != null && !(node instanceof Paragraph)) {
+ node = node.getParent();
+ }
+ if (node != null) {
+ Paragraph paragraph = (Paragraph) node;
+ paragraph.setHorizontalAlignment(horizontalAlignment);
+ }
+ }
+
+ /** debugging tools */
+ @SuppressWarnings("unused")
+ private void dumpDocument() {
+ dumpDocumentNode(textarea.getDocument(), System.out, 0);
+ }
+
+ /** debugging tools */
+ private void dumpDocumentNode(Node node, PrintStream printStream, final int indent) {
+ for (int i = 0; i < indent; i++) {
+ printStream.append(" ");
+ }
+ printStream.append("<" + node.getClass().getSimpleName() + ">");
+ if (node instanceof TextNode) {
+ TextNode textNode = (TextNode)node;
+ String text = textNode.getText();
+ printStream.append(text);
+ printStream.append("</" + node.getClass().getSimpleName() + ">");
+ printStream.println();
+ } else {
+ printStream.println();
+ if (node instanceof Element) {
+ Element element = (Element)node;
+
+ for (Node childNode : element) {
+ dumpDocumentNode(childNode, printStream, indent + 1);
+ }
+ } else {
+ String text = node.toString();
+ printStream.append(text);
+ }
+ for (int i = 0; i < indent; i++) {
+ printStream.append(" ");
+ }
+ printStream.append("</" + node.getClass().getSimpleName() + ">");
+ printStream.println();
+ }
+ }
+
+ private void applyStyleToSelection(StyleApplicator styleApplicator) {
+ org.apache.pivot.wtk.Span span = textarea.getSelection();
+ if (span == null) {
+ return;
+ }
+ applyStyle(textarea.getDocument(), span, styleApplicator);
+ }
+
+ private void applyStyle(Document document, org.apache.pivot.wtk.Span selectionSpan,
+ StyleApplicator styleApplicator) {
+ // I can't apply the styles while iterating over the tree, because I
+ // need to update the tree.
+ // So first collect a list of all the nodes in the tree.
+ List<Node> nodeList = new ArrayList<Node>();
+ collectNodes(document, nodeList);
+
+ final int selectionStart = textarea.getSelectionStart();
+ final int selectionLength = textarea.getSelectionLength();
+
+ for (Node node : nodeList) {
+ if (node instanceof org.apache.pivot.wtk.text.Span) {
+ org.apache.pivot.wtk.text.Span span = (org.apache.pivot.wtk.text.Span)node;
+ int documentOffset = node.getDocumentOffset();
+ int characterCount = node.getCharacterCount();
+ org.apache.pivot.wtk.Span textSpan = new org.apache.pivot.wtk.Span(documentOffset,
+ documentOffset + characterCount);
+ if (selectionSpan.intersects(textSpan)) {
+ applyStyleToSpanNode(selectionSpan, styleApplicator, span, characterCount,
+ textSpan);
+ }
+ }
+ if (node instanceof org.apache.pivot.wtk.text.TextNode) {
+ org.apache.pivot.wtk.text.TextNode textNode = (org.apache.pivot.wtk.text.TextNode)node;
+ int documentOffset = node.getDocumentOffset();
+ int characterCount = node.getCharacterCount();
+ org.apache.pivot.wtk.Span textSpan = new org.apache.pivot.wtk.Span(documentOffset,
+ documentOffset + characterCount);
+ if (selectionSpan.intersects(textSpan)) {
+ applyStyleToTextNode(selectionSpan, styleApplicator, textNode, characterCount,
+ textSpan);
+ }
+ }
+ }
+
+ // maintain the selected range
+ textarea.setSelection(selectionStart, selectionLength);
+ }
+
+ private void applyStyleToTextNode(org.apache.pivot.wtk.Span selectionSpan,
+ StyleApplicator styleApplicator, org.apache.pivot.wtk.text.TextNode textNode,
+ int characterCount, org.apache.pivot.wtk.Span textSpan) {
+ if (selectionSpan.contains(textSpan)) {
+ // if the text-node is contained wholly inside the selection, remove
+ // the text-node, replace it with a Span, and apply the style
+ Element parent = textNode.getParent();
+ org.apache.pivot.wtk.text.Span newSpanNode = new org.apache.pivot.wtk.text.Span();
+ newSpanNode.add(new TextNode(textNode.getText()));
+ styleApplicator.apply(newSpanNode);
+ int index = parent.remove(textNode);
+ parent.insert(newSpanNode, index);
+ } else if (selectionSpan.start <= textSpan.start) {
+ // if the selection covers the first part of the text-node, split
+ // off the first part of the text-node, and apply the style to it
+ int intersectionLength = selectionSpan.end - textSpan.start;
+ String part1 = textNode.getSubstring(0, intersectionLength);
+ String part2 = textNode.getSubstring(intersectionLength, characterCount);
+
+ org.apache.pivot.wtk.text.Span newSpanNode = new org.apache.pivot.wtk.text.Span();
+ newSpanNode.add(new TextNode(part1));
+ styleApplicator.apply(newSpanNode);
+
+ Element parent = textNode.getParent();
+ int index = parent.remove(textNode);
+ parent.insert(newSpanNode, index);
+ parent.insert(new TextNode(part2), index + 1);
+ } else if (selectionSpan.end >= textSpan.end) {
+ // if the selection covers the last part of the text-node, split off
+ // the last part of the text-node, and apply the style to
+ // it
+ int intersectionStart = selectionSpan.start - textSpan.start;
+ String part1 = textNode.getSubstring(0, intersectionStart);
+ String part2 = textNode.getSubstring(intersectionStart, characterCount);
+
+ org.apache.pivot.wtk.text.Span newSpanNode = new org.apache.pivot.wtk.text.Span();
+ newSpanNode.add(new TextNode(part2));
+ styleApplicator.apply(newSpanNode);
+
+ Element parent = textNode.getParent();
+ int index = parent.remove(textNode);
+ parent.insert(new TextNode(part1), index);
+ parent.insert(newSpanNode, index + 1);
+ } else {
+ // if the selection covers an internal part of the text-node, split
+ // the
+ // text-node into 3 parts, and apply the style to the second part
+ int part2Start = selectionSpan.start - textSpan.start;
+ int part2End = selectionSpan.end - textSpan.start + 1;
+ String part1 = textNode.getSubstring(0, part2Start);
+ String part2 = textNode.getSubstring(part2Start, part2End);
+ String part3 = textNode.getSubstring(part2End, characterCount);
+
+ org.apache.pivot.wtk.text.Span newSpanNode = new org.apache.pivot.wtk.text.Span();
+ newSpanNode.add(new TextNode(part2));
+ styleApplicator.apply(newSpanNode);
+
+ Element parent = textNode.getParent();
+ int index = parent.remove(textNode);
+ parent.insert(new TextNode(part1), index);
+ parent.insert(newSpanNode, index + 1);
+ parent.insert(new TextNode(part3), index + 2);
+ }
+ }
+
+ private void applyStyleToSpanNode(org.apache.pivot.wtk.Span selectionSpan,
+ StyleApplicator styleApplicator, org.apache.pivot.wtk.text.Span spanNode,
+ int characterCount, org.apache.pivot.wtk.Span textSpan) {
+ if (selectionSpan.contains(textSpan)) {
+ // if the span-node is contained wholly inside the
+ // selection, apply the style
+ styleApplicator.apply(spanNode);
+ } else if (selectionSpan.start <= textSpan.start) {
+ // if the selection covers the first part of the span-node, split
+ // off the first part of the span-node, and apply the style to it
+ int intersectionLength = selectionSpan.end - textSpan.start;
+ org.apache.pivot.wtk.text.Span node1 = spanNode.getRange(0, intersectionLength);
+ styleApplicator.apply(node1);
+ Node node2 = spanNode.getRange(intersectionLength, characterCount - intersectionLength);
+ Element parent = spanNode.getParent();
+ int index = parent.remove(spanNode);
+ parent.insert(node1, index);
+ parent.insert(node2, index + 1);
+ } else if (selectionSpan.end >= textSpan.end) {
+ // if the selection covers the last part of the span-node, split off
+ // the last part of the span-node, and apply the style to it
+ int intersectionStart = selectionSpan.start - textSpan.start;
+ org.apache.pivot.wtk.text.Span part1 = spanNode.getRange(0, intersectionStart);
+ org.apache.pivot.wtk.text.Span part2 = spanNode.getRange(intersectionStart,
+ characterCount - intersectionStart);
+
+ styleApplicator.apply(part2);
+
+ Element parent = spanNode.getParent();
+ int index = parent.remove(spanNode);
+ parent.insert(part1, index);
+ parent.insert(part2, index + 1);
+ } else {
+ // if the selection covers an internal part of the span-node, split
+ // the
+ // span-node into 3 parts, and apply the style to the second part
+ int part2Start = selectionSpan.start - textSpan.start;
+ int part2End = selectionSpan.end - textSpan.start;
+ org.apache.pivot.wtk.text.Span part1 = spanNode.getRange(0, part2Start);
+ org.apache.pivot.wtk.text.Span part2 = spanNode.getRange(part2Start, part2End
+ - part2Start);
+ org.apache.pivot.wtk.text.Span part3 = spanNode.getRange(part2End, characterCount
+ - part2End);
+
+ styleApplicator.apply(part2);
+
+ Element parent = spanNode.getParent();
+ int index = parent.remove(spanNode);
+ parent.insert(part1, index);
+ parent.insert(part2, index + 1);
+ parent.insert(part3, index + 2);
+ }
+ }
+
+ private void collectNodes(org.apache.pivot.wtk.text.Node node, List<Node> nodeList) {
+ // don't worry about the text-nodes that are children of Span nodes.
+ if (node instanceof org.apache.pivot.wtk.text.Span) {
+ return;
+ }
+ if (node instanceof org.apache.pivot.wtk.text.Element) {
+ Element element = (Element)node;
+ for (Node child : element) {
+ nodeList.add(child);
+ collectNodes(child, nodeList);
+ }
+ }
+ }
+
+ @Override
+ public boolean shutdown(boolean optional) {
+ if (window != null) {
+ window.close();
+ }
+
+ return false;
+ }
+
+ @Override
+ public void suspend() {
+ }
+
+ @Override
+ public void resume() {
+ }
+
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(RichTextEditorDemo.class, args);
+ }
+}
Propchange: pivot/trunk/demos/src/org/apache/pivot/demos/richtexteditor/RichTextEditorDemo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/demos/src/org/apache/pivot/demos/richtexteditor/document.bxml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/demos/src/org/apache/pivot/demos/richtexteditor/richtexteditor.bxml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/demos/src/org/apache/pivot/demos/roweditor/AmountBindMapping.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/demos/src/org/apache/pivot/demos/styles/ColorSchemeBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/demos/src/org/apache/pivot/demos/styles/ColorSchemeBuilderWindow.java
------------------------------------------------------------------------------
svn:eol-style = native