# HG changeset patch # User dpodwall # Date 1263323873 21600 # Node ID 61163b28edca2a31aae8be2c130314040f3263fb initial EPL conversion diff -r 000000000000 -r 61163b28edca creatorextension/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/build.xml Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + basic + codesize + coupling + design + strictexception + strings + sunsecure + unusedcode + junit + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.carbide.extension.creator/build.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.carbide.extension.creator/build.properties Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,18 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# +bin.includes = feature.xml,\ + license.txt diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.carbide.extension.creator/feature.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.carbide.extension.creator/feature.xml Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,63 @@ + + + + + Creator Script Editor is an editor for creating scripts to S60 RnD +application Creator. + + + + Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. License: http://www.eclipse.org/legal/epl-v10.html. + + + +Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +All rights reserved. +This component and the accompanying materials are made available +under the terms of "Eclipse Public License v1.0" +which accompanies this distribution, and is available +at the URL "http://www.eclipse.org/legal/epl-v10.html". + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.carbide.extension.creator/license.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.carbide.extension.creator/license.txt Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,6 @@ +Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +All rights reserved. +This component and the accompanying materials are made available +under the terms of "Eclipse Public License v1.0" +which accompanies this distribution, and is available +at the URL "http://www.eclipse.org/legal/epl-v10.html". diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/META-INF/MANIFEST.MF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/META-INF/MANIFEST.MF Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,11 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Carbide.c++ Extensions - Creator Help Plug-in +Bundle-SymbolicName: com.nokia.s60tools.creator.help;singleton:=true +Bundle-Version: 1.2.0 +Bundle-Vendor: Nokia +Bundle-Activator: com.nokia.s60tools.creator.CreatorActivator +Bundle-ActivationPolicy: lazy +Require-Bundle: org.eclipse.help, + org.eclipse.core.runtime, + org.eclipse.ui diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/about.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/about.html Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,18 @@ + + + +About + + + +

About This Content

+ +

February 5, 2009

+ +

Copyright

+ +

Copyright © 2007-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
+License: http://www.eclipse.org/legal/epl-v10.html.

+ + + diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/book.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/book.css Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,185 @@ +/* + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + License: http://www.eclipse.org/legal/epl-v10.html. +*/ + +/* Add whitespace around entire display to avoid crowding edges of view */ +/* 20070523-Removed top margin size to close gap between location breadcrumbs and page title */ +html { + margin: 0px 10px 10px 10px; + } + +/* Set default font to serif style, 12-pt and plain */ +body, p, table { + font-family: Georgia, "Times New Roman", Times, serif; + font-size: 12px; + font-weight: normal; +} + +/* Use sans-serif fonts for all title styles */ +h1, h2, h3, h4, h5, h6, strong, em { + font-family: Helvetica, sans-serif; + color: #000000; + } + +h1 { font-size:20px } +h2 { font-size:18px } +h3 { font-size:16px } +h4 { font-size:14px } +h5 { font-size:12px } +h6 { font-size:10px } + +/* For headlines at the top of a view, add space */ +/* 20070522-added gradiant to background to update visual style of docs */ +h1, h2, h3 { + background-image: url(html/images/green_fade_left_68_165_28.png); + background-repeat: no-repeat; + padding:10px 0px 10px 12px; + } + +li { + margin-bottom:8px; + margin-top:8px; + } + +/* Footer includes space and a gray line above the company logo */ +#footer { + padding-top:10px; + margin-top:20px; + border-top:1px solid #999; + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 10px; + color: #03C; + } + +.listing { + font-family: "Courier New", Courier, mono; + color: #009; + background-color: #EEE; + padding: 10px 0px; + margin: 10px 0px; + } + +.code, pre { + font-family: "Courier New", Courier, mono; + font-size: 11px; + color: #333; + } + +.step { + /* background-color: #EEE; */ + /* margin: 10px 0px; */ + color: #333; + border-bottom:2px solid #EEE; + } + +.substep { + background-color: #EEE; + } + + +/* Figure/Listing/Table titles are centered and gray */ +p.table { + color: #999; + font-weight: bold; + padding-top: 5px; + } + +table { + border: solid #999 1px; + table-layout: auto; + font-size: 12px; + } + +td, th { + border: solid #999 1px; + padding: 5px; + vertical-align:top; + } + +/* 20070522-replaced gray with green background to match gradiant color for title */ +th { + background-color:#ACD79B; + /* background-color:#999; + color:#FFF; */ + } + +div.ol.p { + margin-left: 3em; + } + +/* Make all ordered/unordered list items appear in bold gray */ +div ol > li, div ul > li { + font-weight:bold; + color: #333; + } + +div ol > p, div ul > p, div li > p { + font-weight:normal; + } + +/* Make all H4 and H5 items appear in bold gray against a light green background */ +div h5, div h4 { + padding:5px 0px 5px 12px; + background-color:#ECFBEA; + /* background-color: #EEE; */ + font-weight:bold; + color: #333; + } + + +/* Notes stand out using a light top & bottom borders with dark gray text */ +p.note { + /* color: #03C; */ + /* background-color: #FFFF99; */ + color: #333; + padding: 5px; + margin-left: 1em; + margin-right: 1em; + border-top: solid #BBB thin; + border-bottom: solid #BBB thin; + } + + +/* Figure/Listing/Table titles are centered and gray */ +p.figure { + color: #333; + text-align: center; + font-weight: bold; + } + +/* highly visible red background and white text for things that need fixing before release */ +/* SHOULD NOT BE PRESENT IN RELEASED PRODUCTS */ +.fix { + background-color: red; + font-weight: bold; + color: white; + } + +.question { + font-style:italic; + font-weight:bold; + color: #555; + } + +.titleSmall { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 10px; + } + + +.plain { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 12px; + font-style: normal; + line-height: normal; + font-weight: normal; + font-variant: normal; + color: #000000; + text-decoration: none; + } + +a:link { color: #0033CC } +a:visited { color: #555555 } +a:hover { color: #0033CC } + diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/build.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/build.properties Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,5 @@ +bin.includes = META-INF/,\ + html/,\ + plugin.xml,\ + book.css,\ + about.html diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/concepts/components.htm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/concepts/components.htm Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,56 @@ + + + + +Components + + + + +

Components

+

The scripts created with Creator Carbide.c++ Extension contain various types of components, such as phonebook items (contacts and contact groups), messages, notes, bookmarks, files, and appointments.

+

You can add as many components to the scripts as needed. See the following example of the component view in the Creator Script Editor:

+

+

For more information on the specific issues related to component types, see the following references:

+ + +

Random component values

+

You have two choices for entering component information in Creator Script Editor. You can either directly type in the values of your choice in the Item value field, or select them from the Mode drop-down list. The number of choices in the Mode field depends on the type of the value:

+ +

Using random values means that when the script file is run on the device, the S60 Creator tool randomly generates the component values (such as contact names, phone numbers or to-do items), using a pre-defined resource file.

+

The length of an entry for random values can be selected as follows in the Mode drop-down list:

+ +

In each component dialog, you can save time by applying random values (Edit mode, Random – Default length, Random – Custom length, Random – Max length) for all items and let Creator generate the test data.

+

Note: When filling in the values manually, ensure that you enter the data in correct format due to a limited data validation in this tool.

+ +
Related concepts
+ + +
Related tasks
+ + + + + \ No newline at end of file diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/concepts/concepts.htm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/concepts/concepts.htm Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,20 @@ + + + + +Concepts + + + + +

Concepts

+

The following topic provides information on the basic component-related concepts in Creator:

+ + + + + \ No newline at end of file diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/concepts/contact_set.htm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/concepts/contact_set.htm Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,31 @@ + + + + +Contact set + + + + +

Contact set

+

In Creator, contact set is a technical term that is not visible on actual S60 devices. Contact sets can be created for associating contacts with contact groups, message items and calendar items. For creating new Contact sets, there is an Add new Contact-set button in the Creator Script Editor.

+

The practical use of the contact set element is to enable the creation of advanced test data combinations. You can, for example, associate contacts as senders or recipients of a message, or associate them as the attendees in an appointment entry. You can create as many contact sets as needed for different purposes. Each contact set is identified by a unique ID number that is generated automatically. See the following figure for an example:

+

+

For more information on using contact sets with components, see the reference topics Contact components, Message components, and Calendar components.

+ +
Related tasks
+ + +
Related concepts
+ + + + + \ No newline at end of file diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/concepts/screenshots/Thumbs.db Binary file creatorextension/com.nokia.s60tools.creator.help/html/concepts/screenshots/Thumbs.db has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/concepts/screenshots/contact_set.png Binary file creatorextension/com.nokia.s60tools.creator.help/html/concepts/screenshots/contact_set.png has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/concepts/screenshots/random_box.png Binary file creatorextension/com.nokia.s60tools.creator.help/html/concepts/screenshots/random_box.png has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/concepts/screenshots/sample_view.png Binary file creatorextension/com.nokia.s60tools.creator.help/html/concepts/screenshots/sample_view.png has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/contexts.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/contexts.xml Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,122 @@ + + + + + + + + + Creator TOC + + + + + + + Adding components + + + + + + Modifying components + + + + + + Creating the script file + + + + + + + + + Editing Calendars + + + + + + + + Editing Contacts + + + + + + + Editing Messages + + + + + + + + Editing components + + + + + + + + Components + + + + + + + Editing random values + + + + + + + Understanding Contact sets + + + + + + + Setting Creator preferences + + + + + + Running script in device + + + + + diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/gettingstarted/GS_index.htm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/gettingstarted/GS_index.htm Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,21 @@ + + + + +Getting started + + + + +

Getting started

+

The information in this section will help you get started quickly using the basic features of the Creator extension for Carbide.c++.

+

Topics in this section include:

+ + + + + \ No newline at end of file diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/gettingstarted/overview.htm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/gettingstarted/overview.htm Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,24 @@ + + + + +Overview + + + + +

Overview

+

The Creator Carbide.c++ Extension is a useful application for any software developer who needs to create test data into a device. The data can be, for example, contacts, SMS messages, bookmarks, appointments and to-dos).

+

In specific, the Creator tool simplifies the creation of certain types of test data such as Access Points, which may be time-consuming to create manually. It also can save time in test data creation when, for example:

+ +

Test data configurations are stored as an XML-format script file, identified by .creatorxml file extension. The .creatorxml file is used as input for the S60 Creator tool that works on an S60 device or an emulator. You can transfer the Creator file into the device in the same way as any other file, for example, via a USB cable or a Bluetooth connection. On the device, the default location of the .creatorxml file is in c:\data, or at the root of the memory card.

+

To make the creation of data entries faster in the Creator Script Editor, you can define all or some of the field values to be Random instead of typing in the values manually. With this option, the S60 Creator tool will randomly pick the needed values based on a pre-defined resource file.

For more information on the script usage in the device, see S60 Creator User's Guide available in the S60 platform releases under: \s60\tools\commontools\creator\doc

+ + + + \ No newline at end of file diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/gettingstarted/walk_through.htm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/gettingstarted/walk_through.htm Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,24 @@ + + + + +Basic walk-through + + + + +

Basic walk-through

+

You can start the Creator Carbide.c++ Extension by selecting File > New > Other > Carbide Extensions > Creator script file or Carbide > Creator Script Editor.

+

The basic steps for using Creator are:

+
    +
  1. Create the script file as part of your project in Carbide.c++.
  2. +
  3. Add components (for example, contacts, messages, to-do items) into the script.
  4. +
  5. Upload the .creatorxml script file to a target device and run the script in the device, or just send the .creatorxml file to the device (for example, via a Bluetooth or USB cable connection) and run it using the Creator S60 device application.
  6. +
+

You can edit scripts in the Creator tool at any time by modifying the component data or removing one or more components. For instructions, see Modifying components.

+

Tip: Script files that have already been created are listed in the Project Explorer view of your workspace. In this case, you can also start the tool by right-clicking the XML file and selecting Open With > Creator Script Editor.

+ + + + \ No newline at end of file diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/images/Thumbs.db Binary file creatorextension/com.nokia.s60tools.creator.help/html/images/Thumbs.db has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/images/green_fade_left_68_165_28.png Binary file creatorextension/com.nokia.s60tools.creator.help/html/images/green_fade_left_68_165_28.png has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/index.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/index.xml Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/legal.htm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/legal.htm Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,21 @@ + + + + + + License Information + + + + +

License Information

+ +
COPYRIGHT
+

Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. This component and the accompanying materials are made available under the terms of "Eclipse Public License v1.0" which accompanies this distribution and is available at the URL http://www.eclipse.org/legal/epl-v10.html.

+

Initial Contributors:
+Nokia Corporation - initial contribution

+ + + + \ No newline at end of file diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/nokia.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/nokia.css Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,165 @@ +/* + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + License: "http://www.eclipse.org/legal/epl-v10.html". +*/ + +/* Add whitespace around entire display to avoid crowding edges of view */ +html { + margin: 10px; + /* fixes gray backgrounds when displayed in external browsers */ + background-color:#FFFFFF; + } + +/* Set default font to serif style, 12-pt and plain */ +body { + font-family: Georgia, "Times New Roman", Times, serif; + font-size: 12px; + font-weight: plain; +} + +/* Use sans-serif fonts for all title styles and Nokia blue */ +h1, h2, h3, h4, h5, h6, strong, em { + font-family: Arial, Helvetica, sans-serif; + color: #333; + } + +strong{ + color: #333; + } + +/* For headlines at the top of a view, add space and a gray line underneath */ +h2, h3 { + padding:10px 0px; + border-bottom:1px solid #BBB; + } + +li { + margin-bottom:8px; + margin-top:8px; + } + + +/* Footer includes space and a gray line above the company logo */ +#footer { + padding-top:10px; + margin-top:20px; + border-top:1px solid #999; + font-family: Arial, Helvetica, sans-serif; + font-size: 11px; + color: #333; + } + +.listing { + font-family: "Courier New", Courier, mono; + color: #009; + background-color: #EEE; + padding: 10px 0px; + margin: 10px 0px; + } + +.code, pre { + font-family: "Courier New", Courier, mono; + font-size: 12px; + color: #333; + } + +.step { + /* background-color: #EEE; */ + /* margin: 10px 0px; */ + color: #333; + border-bottom:2px solid #EEE; + } + +.substep { + background-color: #EEE; + } + + +/* Figure/Listing/Table titles are centered and gray */ +p.table { + color: #999; + font-weight: bold; + padding-top: 5px; + } + +table { + border: 1px solid #999; + table-layout: auto; + } + +td, th { + border: 1px solid #999; + padding: 5px; + vertical-align:top; + } + +th { + background-color:#999; + color:#FFF; + } + +div.ol.p { + margin-left: 3em; + } + +/* Make all ordered/unordered list items appear in bold gray */ +div ol > li, div ul > li { + font-weight:bold; + color: #333; + } + +/* Make all H4 and H5 items appear in bold gray against a light gray background */ +div h5, div h4 { + padding: 5px; + background-color: #EEE; + font-weight:bold; + color: #333; + } + + +/* Notes stand out using a light top & bottom borders with dark gray text */ +p.note { + /* color: #03C; */ + /* background-color: #FFFF99; */ + color: #333; + padding: 5px; + margin-left: 1em; + margin-right: 1em; + border-top:1px solid #BBB; + border-bottom:1px solid #BBB; +} + + +/* Figure/Listing/Table titles are centered and gray */ +p.figure { + color: #333; + text-align: center; + font-weight: bold; +} + +/* red background and white text for things that need fixing before release */ +.fix { + background-color: red; + font-weight: bold; + color: white; + } + +.question { + font-style:italic; + font-weight:bold; + color: #333; + } + +.titleSmall { + font-family: Arial, Helvetica, sans-serif; + font-size: 10px; + } + +.copyrightStatement { + font-size: 11px; + color: #006699; /* Symbian blue */ + } + +div.Footer table, div.Footer td, div.Footer th { + border: 0px none #000; + } diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/plugin.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/plugin.xml Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/reference/calendar.htm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/reference/calendar.htm Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,62 @@ + + + + +Calendar components + + + + +

Calendar components

+

The Calendar component types are:

+ +

You can either type in the needed values directly into the fields or select the Random options to let the S60 Creator tool generate message items randomly.

Note the following specifics about calendar items:

+ +++ + + + + + + + + + + +
Date, time +
    +
  • In date and time fields, the data should be entered as: +
      +
    • YYYY-MM-DD (for year-month-date),
    • +
    • T (a separator between date and time),
    • +
    • HH:MM:SS (for hour-minute-second).
    • +
    +
  • +
  • For example: 2008-03-03T12:45:30
  • +
Appointment
    +
  • Attendee: defines the contact names to be used as meeting attendees. In this field, the attendee email is mandatory, whereas the attendee name is optional. To use both of them, enter them in the following format:
    attendee email | attendee common name
    john.smith@company.com | John Smith
  • +
  • Attendee Contact set ID: takes the attendees from a specific Contact set ID.
  • +
+ +
Related concepts
+ + +
Related references
+ + + + + \ No newline at end of file diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/reference/contacts.htm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/reference/contacts.htm Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,63 @@ + + + + +Contact components + + + + +

Contact components

+

The Contact component types are:

+ +

These describe the contact items that should be created into the device’s database. You can either type in the needed values directly into the fields or select the Random options to let the S60 Creator tool generate contact items randomly.

Tip: Instead of creating these items separately, you can also use the contact data that already exist in the Phonebook of your device.

Note the following specifics about contacts and contact sets:

+ +++ + + + + + + + + + + + + + + +
Contact
    +
  • Contact set ID: links this contact to a specific Contact set ID. +
  • +
  • A contact can have several fields of the same type, for example, multiple Email fields.
  • +
Contact Group
    +
  • Contact set ID: members of the group are taken from the defined +contact set ID.
  • +
Contact set

Note: The Contact set concept is a technical term that is only used to link contacts with messages and calendar items. It has no equivalent on the device.

    +
  • Number of existing contacts: uses contacts that already exist in the device's Phonebook. For example, value 5 here will include the first five Phonebook entries in the test data.
  • +
  • ID numbers for contact sets are assigned automatically.
  • +
  • On the Creator Script Editor view, each contact set is on a row of its own and does not contain other data except for the ID and Number of existing contacts.
  • +
+

You can add new contact sets by clicking the Add new Contact-set button in the Creator Script Editor.

+ +
Related concepts
+ + +
Related references
+ + + + + \ No newline at end of file diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/reference/generic_items.htm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/reference/generic_items.htm Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,79 @@ + + + + +Generic component reference + + + + +

Generic component reference

+

The following fields are included for all component types in Creator Script Editor:

+ + +++ + + + + + + + + + + +
Amount

Defines how many entries of the selected component are created on the script. If this field is empty, the default is one entry.

Set all values as random with length

Defines how the S60 Creator tool will randomly pick the values for all items:

    +
  • Default: the typical length of an item, for example, the length of a contact's name.
  • +
  • Maximum: S60 Creator tool will generate as much data as allowed for a given component type.
  • +
  • Custom length: the value is show in the Item value field. You can add the custom length manually in the Item value field, or select from the Mode drop-down list.
  • +
+

+

The following table provides more information on specific handling of some fields. Note that it is important to enter data in the correct format, unless you use random values.

+

Tip: For additional guidance, follow the instructions available on the Creator component dialogs.

+ + +++ + + + + + + + + + + + + + + +
Date time

In date and time fields, the data should be entered as:

    +
  • YYYY-MM-DD (for year-month-date),
  • +
  • T (a separator between date and time),
  • +
  • HH:MM:SS (for hour-minute-second).
  • +

For example: 2008-03-03T12:45:30

Landmark

For the geographical coordinates of the location, enter the numerical values in the following format: -nn.nnnn - nn.nnnn, which is used in XML.

    +
  • Latitude: positive value means North, negative value means South, and zero is the Equator.
  • +
  • Longitude: positive value means East, negative value means West, and zero is the Prime Meridian.
  • +
  • Altitude: zero point is the sea level.
  • +

For example: 139.9194 35.6361

Files
    +
  • Directory: defines which types of files are created to the device. By default, the directory path is c:\data. To change the location, type the new directory here.
  • +
  • Type: defines the file format and identification for the file types created on the device. For example, in the case of the JPEG file format, three different identifications are possible: 200kB, 25kB and 500kB. For a list of supported file types in the current release, see the Release Notes. You can also add DRM encryption to files in the Item type field. Note! For the Accumulated and Interval fields, only the following format for duration is supported: PnYnMnDTnHnMnS. For example, "P3Y6M4DT12H30M5S" represents a duration of "three years, six months, four days, twelve hours, thirty minutes, and five seconds".
  • +
  • If you leave the Type field empty, an empty directory is created. +
  • +
+ +
Related references
+ + + + + \ No newline at end of file diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/reference/messages.htm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/reference/messages.htm Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,67 @@ + + + + +Message components + + + + +

Message components

+

The Message component types are:

+ +

You can either type in the needed values directly into the fields or select the Random component value options to let the S60 Creator tool generate message items randomly.

You can choose the Item values from the Mode field:

+ +

Note the following specifics about file usage and contact sets:

+ +++ + + + + + + + + + + +
SMS
Smart messages
IR messages
BT messages +
+
    +
  • From (sender) and To (recipient): data can be taken from Contact sets.
  • +
MMS
AMS
Email
    +
  • Attachment path defines the path from which an attached file is created on the device (by default, c:\data).
  • +
  • Attachment file ID: defines the format and identification for the attached file that is created on the device. For example, in the case of the JPEG file format, three different identifications are possible: 200kB, 25kB and 500kB. For a list of supported file types in the current release, see the Release Notes.
  • +
  • From (sender) and To (recipient): data can be taken from Contact sets.
  • +
+ +
Related concepts
+ + +
Related references
+ + + + + \ No newline at end of file diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/reference/references.htm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/reference/references.htm Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,22 @@ + + + + +References + + + + +

References

+

The following references are available for this tool.

Note: The handling of Contact, Message and Calendar components is a special case due to their linkage to the Contact set concept. For the remaining component types, the generic guidelines apply.

+ + + + + \ No newline at end of file diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/release_notes.htm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/release_notes.htm Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,147 @@ + + + + +Release notes + + + + + +

Release notes

+ +

Creator Carbide.c++ Extension – Version 1.2.0

+

Released 27th November 2009

+ + +

Product description

+

The Creator tool is used to create different kinds of test data (for example, contacts, messages or calendar entries) into a device. Creator is a useful tool for testing situations where a device is saving high amounts of data, or the data is either saved to a device several times or to multiple devices at the same time.

+

The test data itself is contained in XML scripts, identified by the .creatorxml file extension. The Creator Carbide.c++ Extension automates and simplifies the creation of these scripts by enabling you to add components such as contacts, messages, notes, and files in the Carbide IDE. You can also create advanced test data combinations that associate, for example, contact data with messaging data.

+

The Creator extension can be started by selecting File > New > Other > Carbide Extensions > Creator script file or Carbide > Creator Script Editor.

+ +

Main features

+ + +

What's new

+ + +

Installation notes

+
How to upgrade from the older versions
+

New version of the extension comes with the updated versions of common utility plug-ins. Once you have installed the new set of plug-ins, perform the following steps:

+
    +
  1. Open 'Command Prompt'.
  2. +
  3. Go to the Carbide.c++ installation directory (for example C:\Program Files\Nokia\Carbide.c++ v2.0).
  4. +
  5. Start Carbide.c++ with the following command line: "Carbide.c++.exe" -clean
  6. +
+

The starting of Carbide.c++ with the clean option ensures that the latest versions of plug-ins are loaded.

+ +

System requirements

+

Basic requirements:

+ +

Additional requirements:

+ + +

Compatibility issues

+ + +

Known issues

+ +

Version history

+
Version 1.2.0 – 5th February 2009
+ + +
Version 1.1.0 – 3rd November 2008
+ + +
Version 1.0.0 – 29th April 2008
+

The first version.

+ + + + \ No newline at end of file diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tasks/adding_components.htm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/tasks/adding_components.htm Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,62 @@ + + + + +Adding components + + + + +

Adding components

+ +
Before you start
+

In general, you can add as many components (for example, contacts, messages, to-dos, appointments and so on) to the script as needed. Note the following things:

+ +

To add components to the script, follow these basic steps:

+
    +
  1. From the Select component to add list box, select the item of your choice.

  2. +
  3. Click Add.

    The dialog for the selected component type is displayed.

  4. +
  5. In the Amount field, type in the amount of entries you want to create of this component type.

    If you leave this field empty, one entry +is created by default.

  6. +
  7. (Optional), add new contact set by clicking the Add new Contact-set button.

    Note: Dialogs for components that can have reference to Contact-set has this button for creating Contact-Sets. Those components are: Contact, Messages (SMS, MMS, AMS, Email, Smart Message, IR message, BT message), Appointment, and Contact Group.

  8. +
  9. To enter the component values, do any of the following: + +
  10. +
  11. To save the script, select File > Save.
  12. +
+ +
Useful to know
+

The .creatorxml file is used as input for the S60 Creator tool that works on an S60 device or an emulator. You can transfer the Creator file into the device in the same way as any other file, for example, via a USB cable or a Bluetooth connection. On the device, the default location of the file is in c:\data, or at the root of the memory card.

+ +
Related tasks
+ + +
Related references
+ + + + + \ No newline at end of file diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tasks/creating_xml_file.htm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/tasks/creating_xml_file.htm Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,24 @@ + + + + +Creating the script file + + + + +

Creating the script file

+

To create a new XML script file as part of your project in Carbide, do the following:

+
    +
  1. Select File > New > Other > Carbide Extensions > Creator script file or Carbide > Creator Script Editor.
  2. +
  3. Click Next.
  4. +
  5. In the Project field, click Browse to locate your project.
  6. +
  7. In the File name field, enter a name for the .creatorxml file, as shown in the following example:

    +

  8. +
  9. Click Finish.

    The Creator Script Editor tab opens and you can now start adding components to the script.

    For the next steps, see Adding components.

  10. +
+ + + + \ No newline at end of file diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tasks/modifying_components.htm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/tasks/modifying_components.htm Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,42 @@ + + + + +Modifying components + + + + +

Modifying components

+

You can modify the .creatorxml files in Creator Script Editor at any time, by editing the values of individual components or removing components from the script. Also note that the Editor view may not show all the details defined for a component. To view the full details, click Edit to open the component's dialog.

+

+ +

Editing component values

+

To edit a component:

+
    +
  1. Select it from the list in the Script Editor and click Edit.
  2. +
  3. The component-specific dialog is displayed, in which you can do any of +the following: +
  4. +
  5. Click OK to save.
  6. +
+ +

Removing components

+

To remove components from the script, select one or more components from the list and click Remove.

+ +
Related references
+ + + + + \ No newline at end of file diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tasks/run_in_device.htm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/tasks/run_in_device.htm Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,32 @@ + + + + +Running script in device + + + + +

Running script in device

+ +
Before you start
+

Make sure that you have a .creatorxml script file you want to run in a target device, and that you have an HTI connection to the target device. For more instructions on configuring the HTI connection, see the HTI Connection Help.

+

Check also the version of the Creator S60 device application. The Run in device functionality requires version 5.0.3 or newer. Note: It is suggested to always use the latest version of Creator S60 device application.

+ +

To upload and run script files in a target device, do the following:

+
    +
  1. Prepare and select a script file in the Creator Script Editor, and connect to the target device via HTI.
  2. +
  3. Click Run in device via HTI. This uploads the script file to the target device folder specified in the Creator preferences.
  4. +
  5. If prompted, confirm to run the script in the device.
  6. +
+ +
Related tasks
+ + + + + \ No newline at end of file diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/Thumbs.db Binary file creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/Thumbs.db has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/add_components.png Binary file creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/add_components.png has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/adding_comp.png Binary file creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/adding_comp.png has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/contact_set_id.png Binary file creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/contact_set_id.png has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/container.png Binary file creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/container.png has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/creator_preferences.png Binary file creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/creator_preferences.png has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/edit_components.png Binary file creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/edit_components.png has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/file_type.png Binary file creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/file_type.png has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/landmark.png Binary file creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/landmark.png has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/log.png Binary file creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/log.png has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/mailbox.png Binary file creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/mailbox.png has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/mode1.png Binary file creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/mode1.png has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/project_.png Binary file creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/project_.png has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/random_.png Binary file creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/random_.png has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/random_box.png Binary file creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/random_box.png has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/set_random.png Binary file creatorextension/com.nokia.s60tools.creator.help/html/tasks/screenshots/set_random.png has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tasks/setting_creator_preferences.htm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/tasks/setting_creator_preferences.htm Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,30 @@ + + + + +Setting Creator preferences + + + + +

Setting Creator preferences

+

In the Creator Preferences dialog, you can set a default target folder for uploading script files to a target device.

To modify the settings, do the following:

+
    +
  1. Go to Window > Preferences > Carbide Extensions > Creator Script Editor Preferences. +

    Creator Script Editor Preferences

  2. +
  3. In Upload scripts in S60 device to folder:, enter a folder in the target device. The default folder is c:\data.When you after this select Run in device in the Creator Script Editor Carbide.c++ Extension, the selected script file will be uploaded to this folder in the target device.
  4. +
  5. If you want to replace files without a confirmation, select the option Always replace existing file in S60 device without confirmation.
  6. +
  7. If you do not want Creator to show an information dialog when a script is executed, select the option Don't show an information dialog when script is executed.
  8. +
  9. If you want the Creator S60 application to close without a confirmation dialog, select the options Always close Creator application in S60 device without confirmation.
  10. +
  11. Click OK.
  12. +
+ +
Related tasks
+ + + + + \ No newline at end of file diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tasks/tasks.htm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/tasks/tasks.htm Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,23 @@ + + + + + +Tasks + + + +

Tasks

+

The following tasks are available for this tool:

+ + + + + \ No newline at end of file diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/toc.htm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/toc.htm Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,48 @@ + + + + + + Table of Contents + + + + +

Creator Online Help

+

Release notes

+ +

Getting started +

+ +

Concepts +

+ +

Tasks +

+ +

References +

+ +

Legal

+ + + + \ No newline at end of file diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tocConcepts.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/tocConcepts.xml Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,11 @@ + + + + + + + + + + + diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tocGettingStarted.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/tocGettingStarted.xml Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,9 @@ + + + + + + + + + diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tocReference.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/tocReference.xml Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/tocTasks.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/tocTasks.xml Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/html/toolTOC.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/html/toolTOC.xml Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator.help/plugin.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator.help/plugin.xml Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/.classpath --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/.classpath Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,7 @@ + + + + + + + diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/.settings/org.eclipse.jdt.core.prefs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/.settings/org.eclipse.jdt.core.prefs Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,7 @@ +#Fri Sep 12 16:56:45 EEST 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/META-INF/MANIFEST.MF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/META-INF/MANIFEST.MF Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,20 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Carbide.c++ Extensions - Creator Script Editor +Bundle-SymbolicName: com.nokia.s60tools.creator; singleton:=true +Bundle-Version: 1.2.0 +Bundle-Activator: com.nokia.s60tools.creator.CreatorActivator +Bundle-Vendor: Nokia +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.jface.text, + org.eclipse.core.resources, + org.eclipse.ui.editors, + org.eclipse.ui.workbench.texteditor, + org.eclipse.ui.ide, + com.nokia.s60tools.ui, + com.nokia.s60tools.util, + com.nokia.s60tools.hticonnection;bundle-version="1.0.0";resolution:=optional, + com.nokia.carbide.cdt.builder;bundle-version="2.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/about.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/about.html Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,18 @@ + + + +About + + + +

About This Content

+ +

January 9, 2009

+ +

Copyright

+ +

Copyright © 2007-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
+License: http://www.eclipse.org/legal/epl-v10.html.

+ + + diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/about.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/about.ini Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,43 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# +# about.ini +# contains information about a feature +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# "%key" are externalized strings defined in about.properties +# This file does not need to be translated. + +# Property "aboutText" contains blurb for "About" dialog (translated) +# This text is shown in Feature Details -dialog when feature is selected. +aboutText=%productBlurb + +# Property "windowImage" contains path to window icon (16x16) +# needed for primary features only + +# Property "featureImage" contains path to feature image (32x32) +# Not using this in here because we do not want the icon to +# show on about dialog. Only using aboutText above. +#featureImage=icons/appdep.png + +# Property "aboutImage" contains path to product image (500x330 or 115x164) +# needed for primary features only + +# Property "appName" contains name of the application (translated) +# needed for primary features only + +# Property "welcomePerspective" contains the id of the perspective in which the +# welcome page is to be opened. +# optional diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/about.mappings --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/about.mappings Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,24 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# +# about.mappings +# contains fill-ins for about.properties +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# This file does not need to be translated. + +# The following should contain the build version. +# e.g. "0=20020612" +0=0 diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/about.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/about.properties Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,31 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# +# about.properties +# contains externalized strings for about.ini +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# fill-ins are supplied by about.mappings +# This file should be translated. + +productBlurb=Carbide.c++ Extensions - Creator Script Editor \n\ +\n\ +Version: 1.2\n\ +Build id: {0}\n\ +\n\ +\n\ +Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).\n\ +All rights reserved. License: "http://www.eclipse.org/legal/epl-v10.html".\n\ +\n\ diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/build.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/build.properties Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,28 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + icons/,\ + about.html,\ + about.mappings,\ + about.properties,\ + about.ini +javacSource=1.5 +javacTarget=1.5 diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/ccbuild.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/ccbuild.xml Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,267 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + basic + codesize + coupling + design + strictexception + strings + sunsecure + unusedcode + junit + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/icons/creator_16x16.png Binary file creatorextension/com.nokia.s60tools.creator/icons/creator_16x16.png has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/icons/creator_55x46.png Binary file creatorextension/com.nokia.s60tools.creator/icons/creator_55x46.png has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/icons/empty_banner.png Binary file creatorextension/com.nokia.s60tools.creator/icons/empty_banner.png has changed diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/plugin.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/plugin.xml Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + Create a Creator script file + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/CreatorActivator.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/CreatorActivator.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,225 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +package com.nokia.s60tools.creator; + +import java.io.File; +import java.io.IOException; +import java.net.URL; + +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +import com.nokia.s60tools.creator.common.ProductInfoRegistry; +import com.nokia.s60tools.ui.UiUtils; + + +/** + * The activator class controls the plug-in life cycle + */ +public class CreatorActivator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "com.nokia.s60tools.creator"; + + public static final String CREATOR_SCRIPT_EDITOR_ICON = "creator_16x16.png"; + public static final String NOKIA_TOOLS_BANNER = "empty_banner.png"; + public static final String CREATOR_SCRIPT_LARGE_ICON = "creator_55x46.png"; + + // The shared instance + private static CreatorActivator plugin; + + /** + * Storing preferences + */ + private static IPreferenceStore prefsStore; + + /** + * Plugin installation location. + */ + private static String pluginInstallLocation; + + /** + * The constructor + */ + public CreatorActivator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + + pluginInstallLocation = getPluginInstallPath(); + //This startup debug println has been left into the code in purpose + System.out.println("pluginInstallLocation: " + pluginInstallLocation); //$NON-NLS-1$ + + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static CreatorActivator getDefault() { + return plugin; + } + + /** + * Gets images path relative to given plugin install path. + * @return Path were image resources are located. + */ + private String getImagesPath(){ + return pluginInstallLocation + + File.separatorChar + + ProductInfoRegistry.getImagesDirectoryName(); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry) + */ + protected void initializeImageRegistry(ImageRegistry imgReg) { + + // + // Storing images to plugin's image registry + // + Display disp = Display.getCurrent(); + Image img = null; + + img = new Image( disp, getImagesPath() + "\\" +CREATOR_SCRIPT_EDITOR_ICON ); //$NON-NLS-1$ + imgReg.put( CREATOR_SCRIPT_EDITOR_ICON, img ); + + img = new Image( disp, getImagesPath() + "\\" +NOKIA_TOOLS_BANNER ); //$NON-NLS-1$ + imgReg.put( NOKIA_TOOLS_BANNER, img ); + + img = new Image( disp, getImagesPath() + "\\" +CREATOR_SCRIPT_LARGE_ICON); //$NON-NLS-1$ + imgReg.put( CREATOR_SCRIPT_LARGE_ICON, img ); + + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + + /** + * Returns image descriptor for the given key from the plugin's image registry. + * @param key Key to search descriptor for. + * @return Image descriptor for the given key from the plugin's image registry. + */ + public static ImageDescriptor getImageDescriptorForKey( String key ){ + ImageRegistry imgReg = getDefault().getImageRegistry(); + return imgReg.getDescriptor( key ); + } + + /** + * Returns image for the given key from the plugin's image registry. + * @param key Key to search image for. + * @return Image for the given key from the plugin's image registry. + */ + public static Image getImageForKey( String key ){ + ImageRegistry imgReg = getDefault().getImageRegistry(); + return imgReg.get(key); + } + + + /** + * @return path where plug-in is installed + * @throws IOException + */ + public String getPluginInstallPath() throws IOException{ + // URL to the plugin's root ("/") + URL relativeURL = getBundle().getEntry("/"); //$NON-NLS-1$ + // Converting into local path + URL localURL = FileLocator.toFileURL(relativeURL); + // Getting install location in correct form + File f = new File(localURL.getPath()); + String pluginInstallLocation = f.getAbsolutePath(); + + return pluginInstallLocation; + } + + /** + * This must be called from UI thread. If called + * from non-ui thread this returns null. + * @return Currently active workbench page. + */ + public static IWorkbenchPage getCurrentlyActivePage(){ + return getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage(); + } + + /** + * This must be called from UI thread. If called + * from non-ui thread this returns null. + * @return The shell of the currently active workbench window.. + */ + public static Shell getCurrentlyActiveWbWindowShell(){ + IWorkbenchPage page = getCurrentlyActivePage(); + if(page != null){ + return page.getWorkbenchWindow().getShell(); + } + return null; + } + + /** + * Get Wizard icon with banner + * @return + */ + public static ImageDescriptor getWizardImage() { + return UiUtils.getBannerImageDescriptor(getImageDescriptorForKey(CREATOR_SCRIPT_LARGE_ICON)); + + } + + /** + * Returns the PreferenceStore where plugin preferences are stored + * + * @return the PreferenceStore where plugin preferences are stored + */ + public static IPreferenceStore getPrefsStore(){ + if (prefsStore == null){ + prefsStore = getDefault().getPreferenceStore(); + } + + return prefsStore; + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/CreatorHelpContextIDs.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/CreatorHelpContextIDs.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +package com.nokia.s60tools.creator; + + +/** + * IDs for context sensitive help. + * @see contexts.xml -file IDs links to + */ +public class CreatorHelpContextIDs { + + /** + * The plug-in ID. Copy from CreatorActivator.PLUGIN_ID + * to here to avoid runtime dependency to help project + */ + private static final String CREATOR_HELP_PROJECT_PLUGIN_ID = "com.nokia.s60tools.creator.help"; + + + /** + * ID to Metadata Editor Help TOC + */ + public static final String CREATOR_HELP_TOC = + CREATOR_HELP_PROJECT_PLUGIN_ID +".CREATOR_HELP_TOC"; + + /** + * ID to Editing a component + */ + public static final String CREATOR_HELP_MODIFY_COMPONENT = + CREATOR_HELP_PROJECT_PLUGIN_ID +".CREATOR_HELP_MODIFY_COMPONENT"; + + /** + * ID to Adding and component + */ + public static final String CREATOR_HELP_ADD_COMPONENT = + CREATOR_HELP_PROJECT_PLUGIN_ID +".CREATOR_HELP_ADD_COMPONENT"; + + + /** + * ID to Contacts + */ + public static final String CREATOR_HELP_CONTACTS = + CREATOR_HELP_PROJECT_PLUGIN_ID +".CREATOR_HELP_CONTACTS"; + + + /** + * ID to Contact set + */ + public static final String CREATOR_HELP_CONTACT_SET = + CREATOR_HELP_PROJECT_PLUGIN_ID +".CREATOR_HELP_CONTACT_SET"; + + /** + * ID to Calendar + */ + public static final String CREATOR_HELP_CALENDAR = + CREATOR_HELP_PROJECT_PLUGIN_ID +".CREATOR_HELP_CALENDAR"; + + /** + * ID to Messages + */ + public static final String CREATOR_HELP_MESSAGES = + CREATOR_HELP_PROJECT_PLUGIN_ID +".CREATOR_HELP_MESSAGES"; + + /** + * ID to generic component + */ + public static final String CREATOR_HELP_GENERIC_COMPONENT = + CREATOR_HELP_PROJECT_PLUGIN_ID +".CREATOR_HELP_GENERIC_COMPONENT"; + + /** + * ID to create new script (With wizard) + */ + public static final String CREATOR_HELP_CREATE_SCRIPT = + CREATOR_HELP_PROJECT_PLUGIN_ID +".CREATOR_HELP_CREATE_SCRIPT"; + + /** + * ID to random values + */ + public static final String CREATOR_HELP_RANDOM_VALUES = + CREATOR_HELP_PROJECT_PLUGIN_ID +".CREATOR_HELP_RANDOM_VALUES"; + + /** + * ID to components + */ + public static final String CREATOR_HELP_COMPONENTS = + CREATOR_HELP_PROJECT_PLUGIN_ID +".CREATOR_HELP_COMPONENTS"; + + + /** + * ID to preference page + */ + public static final String PREF_PAGE = CREATOR_HELP_PROJECT_PLUGIN_ID +".CREATOR_HELP_PREFERENCES"; + + /** + * ID to run in device + */ + public static final String RUN_IN_DEVICE_PAGE = CREATOR_HELP_PROJECT_PLUGIN_ID +".CREATOR_HELP_RUN_IN_DEVICE"; + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/common/Product.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/common/Product.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +package com.nokia.s60tools.creator.common; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class Product { + + private static final String BUNDLE_NAME = "com.nokia.s60tools.creator.common.product"; //$NON-NLS-1$ + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle + .getBundle(BUNDLE_NAME); + + private Product() { + } + + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/common/ProductInfoRegistry.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/common/ProductInfoRegistry.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +package com.nokia.s60tools.creator.common; + +/** + * This class stores product information such as product name, + * version, console view name etc. + * The idea is to have the product information in one place. + */ +public class ProductInfoRegistry { + + private static final String PRODUCT_NAME = Product.getString("ProductInfoRegistry.Product_Name"); //$NON-NLS-1$ + private static final String CONSOLE_WINDOW_NAME = PRODUCT_NAME + " " + Product.getString("ProductInfoRegistry.Console_Window_Name_Postfix"); //$NON-NLS-1$ //$NON-NLS-2$ + private static final String IMAGES_DIRECTORY = Product.getString("ProductInfoRegistry.Images_Directory"); //$NON-NLS-1$ + private static final String RESOURCES_RELATIVE_PATH = Product.getString("ProductInfoRegistry.Resources_Relative_Path"); //$NON-NLS-1$ + private static final String DATA_DIRECTORY = Product.getString("ProductInfoRegistry.Data_Directory"); //$NON-NLS-1$ + private static final String PROPERTIES_FILE_NAME = Product.getString("ProductInfoRegistry.Properties_File_Name"); //$NON-NLS-1$ + private static final String CREATOR_TEMPLATE_FILE_NAME = Product.getString("ProductInfoRegistry.Creator_Template_File_Name"); //$NON-NLS-1$ + + + /** + * @return Returns the CONSOLE_WINDOW_NAME. + */ + public static String getConsoleWindowName() { + return CONSOLE_WINDOW_NAME; + } + /** + * @return Returns the PRODUCT_NAME. + */ + public static String getProductName() { + return PRODUCT_NAME; + } + + /** + * @return Returns the IMAGES_DIRECTORY. + */ + public static String getImagesDirectoryName() { + return IMAGES_DIRECTORY; + } + /** + * @return Returns the RESOURCES_RELATIVE_PATH. + */ + public static String getResourcesRelativePath() { + return RESOURCES_RELATIVE_PATH; + } + + /** + * @return Returns the CREATOR_TEMPLATE_FILE_NAME. + */ + public static String getCreatorTemplateFileName() { + return CREATOR_TEMPLATE_FILE_NAME; + } + + /** + * @return Returns the DATA_DIRECTORY. + */ + public static String getDataDirectoryName() { + return DATA_DIRECTORY; + } + /** + * @return Returns the PROPERTIES_FILE_NAME. + */ + public static String getPropertiesFileName() { + return PROPERTIES_FILE_NAME; + } + /** + * @return Returns the Creator Symbian executable name. + */ + public static String getCreatorSymbianExcecutableName() { + return Product.getString("ProductInfoRegistry.CreatorSymbianExecutableName"); //$NON-NLS-1$; + } + + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/common/product.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/common/product.properties Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,24 @@ +# +# Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# +ProductInfoRegistry.Product_Name=Creator Script Editor +ProductInfoRegistry.Console_Window_Name_Postfix=Console +ProductInfoRegistry.Images_Directory=icons +ProductInfoRegistry.Data_Directory=data +ProductInfoRegistry.Properties_File_Name=creator.properties +ProductInfoRegistry.Resources_Relative_Path=resources +ProductInfoRegistry.Metadata_Template_File_Name=creator_template.creatorxml +ProductInfoRegistry.CreatorSymbianExecutableName=creator diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/AbstractComponent.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/AbstractComponent.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,508 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components; + +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; +import java.util.Vector; + +import com.nokia.s60tools.creator.components.AbstractValue.ModeTypes; +import com.nokia.s60tools.creator.components.contact.ContactValue; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + + + + +/** + * Abstract entry base class that contains only id for the + * entry and method that are common for all entry types. + * + * To be subclassed in order to create concrete entry types. + */ +public abstract class AbstractComponent { + + /** + * White space + */ + public static final String WHITE_SPACE = " "; + /** + * Separator for components ("|") + */ + public static final String COMPONENT_TYPE_SEPARATOR = " | "; + /** + * Separator for items (comma ",") + */ + public static final String COMPONENT_ITEM_SEPARATOR = ", "; + /** + * Separator for between component label and value ("=") + */ + public static final String COMPONENT_LABEL_VALUE_SEPARATOR = "="; + + /** + * ID what is not set + */ + public static final int NULL_ID = 0; + /** + * If Max Occur for item is not defined, it's unbounded (infinite). + * Value for is -1. + */ + public static final int MAX_OCCURS_UNBOUNDED = -1; + /** + * Id for type + */ + public static final String TYPE_PARAMETER_ID = "type"; + /** + * ID for id + */ + public static final String ID_PARAMETER_ID = "id"; + /** + * ID for name + */ + public static final String NAME_PARAMETER_ID = "name"; + /** + * incvalueforeachcopy value in XML. + * @see AbstractValue#RANDOM_TEXT_INC_FOR_EACH_COPY + */ + public static final String INCVALUEFOREACHCOPY_PARAMETER_ID = "incvalueforeachcopy"; + /** + * String value for true + */ + public static final String TRUE = "true"; + /** + * ID for number of existing contacts + */ + public static final String NUMBER_OF_EXISTING_CONTACTS_PARAMETER_ID ="numberofexistingcontacts"; + /** + * UI text for Contacts (amount) + */ + public static final String NUMBER_OF_EXISTING_CONTACTS = "Contacts (amount)"; + + /** + * UI text for adding existing contacts to contact-set + */ + public static final String NUMBER_OF_EXISTING_CONTACTS_DIALOG_TEXT = "Add existing contacts in device to this Contact-set (amount):"; + /** + * User configurable id for the entry. The entries + * are identified by there unique id per search method + * configuration storage. + */ + private int id; + + /** + * Storage for attributes + */ + private Map> attributes; + + + /** + * Amount + */ + private int amount; + + + /** + * If component has additional parameters, like type + */ + private MapadditionalParameters = null; + + /** + * If component have a reference to another component + */ + private AbstractComponent referenceToAnotherComponent = null; + + /** + * Constructor + * @param id Entry id.that is unique per search method. + * @param isSelected Is the entry used for queries by default. + */ + protected AbstractComponent(int id){ + this.id = id; + this.amount = 0; + } + + + /** + * @return the id for the entry. + */ + public int getId() { + return id; + } + + + + /** + * Notifies storage object that this entry has been modified. + * @param eventType Event type of the modification. + */ + protected void notifyModification(int eventType){ + } + + + /** + * Get Component type + * @return type + */ + public abstract String getType(); + + /** + * Get Component type used in XML + * @return type + */ + public abstract String getXMLElementName(); + + + /** + * Get all attributes + * @return attributes + */ + public Map> getAttributes() { + if(attributes == null){ + attributes = new LinkedHashMap>(); + } + return attributes; + } + + /** + * Set all attributes + * @param attributes + */ + public void setAttributes(Map> attributes) { + this.attributes = attributes; + } + + /** + * Set one attribute to attributes + * @param key + * @param value + */ + public void setAttribute(String key, Vector value){ + getAttributes().put(key, value); + } + + /** + * Get one attribute + * @param key + * @return value, null if not found or value is empty + */ + public Vector getAttribute(String key) { + return getAttributes().get(key); + } + + + /** + * Get component keys (e.g. entry item labels) + * @return a key (label) + */ + public Set getKeys() { + return getAttributes().keySet(); + } + + + /** + * Check if component is valid or not. + * @return trie od + */ + public abstract boolean isValid(); + + + + /** + * Get amount attribute in component. + * + * @return amount + */ + public int getAmount() { + return amount; + } + + + /** + * Set amount attribute in component. + * + * @param amount + */ + public void setAmount(int amount) { + this.amount = amount; + } + + /** + * Get number of attributes (items) added to this component + * @return count + */ + public int getAttributeCount(){ + return getAttributes().size(); + } + + /** + * Get showable UI value by XML element name + * @param id -element name in XML + * @return value -element name in UI + */ + public abstract String getValueById(String id); + + /** + * Get XML element name by showable UI value + * @param value -element name in UI + * @return id -element name in XML + */ + public abstract String getIdByValue (String value); + + + /** + * Component type must be separated from other data with COMPONENT_TYPE_SEPARATOR, and before + * COMPONENT_TYPE_SEPARATOR there must not be any other information than component type. + * @return component String. Format: + * COMPONENT_TYPE_SEPARATOR =, =... + */ + public String toString() { + + Set componentKeys = getKeys(); + //Collection values = comp.getAttributes().values(); + + StringBuffer allFieldsB = new StringBuffer(); + allFieldsB.append(getType()); + allFieldsB.append( COMPONENT_TYPE_SEPARATOR); + + //reference to another component + if(hasReferenceToAnotherComponent()){ + allFieldsB.append( referenceToAnotherComponent.getType() ); + allFieldsB.append( WHITE_SPACE ); + allFieldsB.append( ID_PARAMETER_ID ); + allFieldsB.append(COMPONENT_LABEL_VALUE_SEPARATOR ); + allFieldsB.append( referenceToAnotherComponent.getId() ); + allFieldsB.append( COMPONENT_TYPE_SEPARATOR); + } + + //Amount (how many of this component will be added) + if(getAmount() > 0){ + allFieldsB.append(" amount="); + allFieldsB.append(getAmount()); + allFieldsB.append(COMPONENT_ITEM_SEPARATOR); + } + + + String itemlabel = new String(); + Vector itemValue; + //Looping through one component, founding all fields from that component + for (Iterator compValuesIt = componentKeys.iterator(); compValuesIt.hasNext();) { + itemlabel = (String) compValuesIt.next(); + itemValue = getAttribute(itemlabel); + //get all values from values vector + for (Iterator iterator = itemValue.iterator(); iterator.hasNext();) { + AbstractValue val = iterator.next(); + + allFieldsB.append(itemlabel); + allFieldsB.append(COMPONENT_LABEL_VALUE_SEPARATOR); + //If value is random value, showing in UI only short description () + if(val.isRandom()){ + allFieldsB.append(ContactValue.RANDOM_TEXT); + }else{ + + //Add value + allFieldsB.append(val.getValue()); + //adding incvalueforeachcopy parameter + if(val.getModeType() == ModeTypes.ModeTypeIncValueForEachCopy){ + allFieldsB.append(" "); + allFieldsB.append(AbstractValue.RANDOM_TEXT_INC_FOR_EACH_COPY_SHORT); + } + } + allFieldsB.append(COMPONENT_ITEM_SEPARATOR); + } + + } + //deleting last ", " from list + if(allFieldsB.toString().endsWith(COMPONENT_ITEM_SEPARATOR)){ + allFieldsB.delete(allFieldsB.length()-COMPONENT_ITEM_SEPARATOR.length(), allFieldsB.length()); + } + return CreatorEditorSettings.getInstance().replaceEntitiesWithChars(allFieldsB.toString()); + } + + + /** + * Get additional parameters + * @return additionalParameters + */ + public Map getAdditionalParameters() { + if(additionalParameters == null){ + additionalParameters = new LinkedHashMap(); + } + return additionalParameters; + } + + + /** + * Set additional parameters + * @param additionalParameters + */ + public void setAdditionalParameters(Map additionalParameters) { + this.additionalParameters = additionalParameters; + } + + + /** + * Add one additional parameter + * @param type + * @param value + */ + public void addAdditionalParameter(String type, String value) { + getAdditionalParameters().put(type, CreatorEditorSettings.getInstance().replaceForbiddenChars(value)); + } + + /** + * Get additional parameter + * @param type + * @return value, or null if not exist + */ + public String getAdditionalParameter(String type) { + return getAdditionalParameters().get(type); + } + + /** + * Does this component have some additional parameters + * @return true if this component has some additional parameter, false otherwise + */ + public boolean hasAdditionalParameters(){ + return additionalParameters != null && getAdditionalParameters().size() > 0 ? true : false; + } + + /** + * Removes all additional parameters + * Note: attributes is not going to be removed. Use {@link AbstractComponent#removeAllAttributes()} + */ + public void removeAdditionalParameters() { + additionalParameters = new LinkedHashMap(); + } + + /** + * Set this contact belong to contact set + * @param reference + */ + public void setReferenceToAnotherComponent(AbstractComponent reference) { + this.referenceToAnotherComponent = reference; + } + + + /** + * Get contact set which this contact belongs to + * @return + */ + public AbstractComponent getReferenceToAnotherComponent() { + return referenceToAnotherComponent; + } + + /** + * + * @return true if component has a reference to another component + */ + public boolean hasReferenceToAnotherComponent(){ + return referenceToAnotherComponent != null; + } + + + /** + * Set component id + * @param id + */ + public void setId(int id) { + this.id = id; + } + + + /** + * Removes all existing attributes. + * Note: Additional parameters is not going to be removed. Use {@link AbstractComponent#removeAdditionalParameters()} + */ + public void removeAllAttributes() { + attributes = new LinkedHashMap>(); + } + + + /** + * Get fixed values for itemType + * @param itemType + * @return possible values for item or null if item has no fixed values + */ + public abstract String[] getValuesForItemType(String itemType); + + + /** + * Check if type is supporting incvalueforeachcopy parameter. + * Default implementation return allways false, overwrite in component if + * real implementation is needed, in other words, if in component there is some + * type that supports incvalueforeachcopy parameter. + * @param type + * @return true if incvalueforeachcopy is supported false othewise. + */ + public boolean isTypeSupportingIncValueForEachCopy(String type) { + + return false; + + } + + + /** + * Items max occurrence count in one script. Default implementation is + * unbounded and {@link AbstractComponent#MAX_OCCURS_UNBOUNDED} is returned. + * Component can overwrite this implementation if has items that have limited number + * of items occurrences in one script. + * @param itemName + * @return item max occurrence if defined or {@link AbstractComponent#MAX_OCCURS_UNBOUNDED}. + */ + public int itemMaxOccur(String itemName) { + return MAX_OCCURS_UNBOUNDED; + } + + + /** + * Get variables for that component. + * @return variables of that component type. + */ + public abstract AbstractVariables getVariables(); + + + /** + * Check if this type and value has some limitations to other values. + * + * @see AbstractComponent#isTypeDisabledByTypeAndValue(String, String, String) + * + * @param type + * @param value + * @return false as default. Extending components may overwrite this if needed. + */ + public boolean hasTypeLimitationsForOtherValues(String type, String value) { + return false; + } + + /** + * Check that is a type disabled by some other type and value. + * + * @see AbstractComponent#hasTypeLimitationsForOtherValues(String, String) + * + * @param selectedType type that may disable some other type + * @param selectedValue value of type that may disable some other type + * @param typeToDisable type to be disabled by selected type and value + * @return false as default. Extending components may overwrite this if needed. + */ + public boolean isTypeDisabledByTypeAndValue(String selectedType, String selectedValue, String typeToDisable) { + return false; + } + + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/AbstractValue.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/AbstractValue.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,487 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components; + +import java.util.LinkedHashMap; +import java.util.Map; + +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + + + +/** + * Abstract class for all Values, e.g. one contact can have n. values for field phone number. + */ + +public abstract class AbstractValue { + + /** + * Empty value for int + */ + public static final int NULL_VALUE = 0; + /** + * Empty string + */ + public static final String EMPTY_STRING = ""; + /** + * UI text for random value + */ + public static final String RANDOM_TEXT = ""; + + /** + * UI text for edit mode + */ + public static final String RANDOM_TEXT_NOT_RANDOM = "Edit mode"; + + /** + * UI text for incvalueforeachcopy XML value + * @see AbstractComponent#INCVALUEFOREACHCOPY_PARAMETER_ID + */ + public static final String RANDOM_TEXT_INC_FOR_EACH_COPY = "Increase for each copy";// incvalueforeachcopy" + /** + * Short UI text for incvalueforeachcopy XML value + */ + public static final String RANDOM_TEXT_INC_FOR_EACH_COPY_SHORT = "(Inc=true)";// incvalueforeachcopy" + /** + * UI text for random max length + */ + public static final String RANDOM_TEXT_MAX_LENGTH = "Random - Max length"; + /** + * UI text for random default length + */ + public static final String RANDOM_TEXT_DEFAULT_LENGTH = "Random - Default length"; + /** + * UI text for random custom length + */ + public static final String RANDOM_TEXT_USER_DEFINED_LENGTH = "Random - Custom length"; + /** + * Default value for user defined length for custom random length + */ + public static final int USER_DEFINED_DEFAULT_LENGTH = 100; + + /** + * Long UI text for random max length + */ + public static final String RANDOM_TEXT_MAX_LENGTH_LONG = "Random value, max length"; + /** + * Long UI text for random custom length + */ + public static final String RANDOM_TEXT_DEFAULT_LENGTH_LONG = "Random value, default length"; + /** + * Long UI text for random custom length + */ + public static final String RANDOM_TEXT_USER_DEFINED_LENGTH_LONG = "Random value, custom length"; + + + /** + * Value + */ + private String value; + /** + * Type + */ + private String type; + /** + * Is this value random + */ + private boolean isRandom; + /** + * Amount of this value + */ + private int amount; + /** + * ID of this value + */ + private int id; + /** + * Max amount of this value + */ + private int maxAmount; + /** + * Random type of this value + */ + private ModeTypes randomType; + /** + * Custom random value length of this value + */ + private int randomValueLength; + /** + * Is this value a contact set reference + */ + private boolean isContactSetReference = false; + + /** + * If component has additional parameters, like type + */ + private MapadditionalParameters = null; + + /** + * Enumeration for different mode types + */ + public enum ModeTypes{ + RandomTypeNotRandom, + RandomTypeDefaultLength, + RandomTypeMaxLength, + RandomTypeUserDefinedLength, + ModeTypeIncValueForEachCopy + } + + @SuppressWarnings("unused") + private AbstractValue(){ + //No empty constructor always have to have type for value + } + + /** + * Creates new Value. + * Attributes is set by default; + * - random value is set to RandomTypes.RandomTypeNormalLenght + * - random is set to true + * - value is set to EMPTY_STRING + * - amount is set to 0. + */ + protected AbstractValue(String type){ + setType(type); + setValue(EMPTY_STRING); + setRandom(true); + setModeType(ModeTypes.RandomTypeDefaultLength); + setAmount(NULL_VALUE); + setRandomValueLenght(NULL_VALUE); + setId(NULL_VALUE); + setMaxAmount(NULL_VALUE); + } + + /** + * Get String values for random value selection, used e.g. as CCombo values + * + * @return random values + */ + public static String[] getModeValues(){ + String [] values = new String[]{ + RANDOM_TEXT_NOT_RANDOM, + RANDOM_TEXT_DEFAULT_LENGTH, + RANDOM_TEXT_MAX_LENGTH, + RANDOM_TEXT_USER_DEFINED_LENGTH}; + return values; + } + /** + * Get String values for random value selection, used e.g. as CCombo values + * + * @return random values + */ + public static String[] getModeValuesForFixedValues(){ + String [] values = new String[]{ + RANDOM_TEXT_NOT_RANDOM, + RANDOM_TEXT_DEFAULT_LENGTH}; + return values; + } + + /** + * Get String values for random value selection, used e.g. as CCombo values + * + * @return random values + */ + public static String[] getModeValuesForSupportingIncValueForeEachCopy(){ + String [] values = new String[]{ + RANDOM_TEXT_NOT_RANDOM, + RANDOM_TEXT_DEFAULT_LENGTH, + RANDOM_TEXT_MAX_LENGTH, + RANDOM_TEXT_USER_DEFINED_LENGTH, + RANDOM_TEXT_INC_FOR_EACH_COPY + }; + return values; + } + + /** + * get value + * @return value + */ + public String getValue() { + return value; + } + + /** + * Set the value, will remove forbidden characters for XML content by using + * CreatorXML.removeForbiddenChars(String) + * @param value + */ + public void setValue(String value) { + this.value = CreatorEditorSettings.getInstance().replaceForbiddenChars(value); + } + + /** + * Is this value random or not + * @return true if it is a random value + */ + public boolean isRandom() { + return isRandom; + } + + /** + * Setting this value as random or not random. + * @param isRandom if false also sets this.randomType = RandomTypes.RandomTypeNotRandom + */ + public void setRandom(boolean isRandom) { + this.isRandom = isRandom; + if(!isRandom){ + this.randomType = ModeTypes.RandomTypeNotRandom; + } + } + + /** + * Get amout of this value + * @return amount + */ + public int getAmount() { + return amount; + } + + /** + * Set amount of this value + * @param amount + */ + public void setAmount(int amount) { + this.amount = amount; + } + + /** + * Get random type of this value + * @return randomtype + */ + public ModeTypes getModeType() { + return randomType; + } + + /** + * Set random type. + * @param modeType if RandomTypes.RandomTypeNotRandom given + * also value set to not random, otherwise also set to random. + */ + public void setModeType(ModeTypes modeType) { + this.randomType = modeType; + if(modeType == ModeTypes.RandomTypeNotRandom || modeType == ModeTypes.ModeTypeIncValueForEachCopy){ + this.isRandom = false; + } + else{ + this.isRandom = true; + } + } + + /** + * Get random value text by this value random type + * @return text to show in UI + */ + public String getModeValueText(){ + String txt ; + switch (getModeType()) { + case RandomTypeNotRandom: + txt = RANDOM_TEXT_NOT_RANDOM; + break; + case RandomTypeDefaultLength: + txt = RANDOM_TEXT_DEFAULT_LENGTH; + break; + case RandomTypeMaxLength: + txt = RANDOM_TEXT_MAX_LENGTH; + break; + case RandomTypeUserDefinedLength: + txt = RANDOM_TEXT_USER_DEFINED_LENGTH; + break; + case ModeTypeIncValueForEachCopy: + txt = RANDOM_TEXT_INC_FOR_EACH_COPY; + break; + default: + txt = EMPTY_STRING; + break; + } + return txt; + } + + /** + * Get random type by random type text + * @param mode + * @return random type + */ + public static ModeTypes getModeTypeByText(String mode) { + + if(mode == null || mode.equals(RANDOM_TEXT_NOT_RANDOM)){ + return ModeTypes.RandomTypeNotRandom; + } + else if(mode.equals(RANDOM_TEXT_DEFAULT_LENGTH) || mode.equals(RANDOM_TEXT_DEFAULT_LENGTH_LONG) ){ + return ModeTypes.RandomTypeDefaultLength; + } + else if(mode.equals(RANDOM_TEXT_MAX_LENGTH) || mode.equals(RANDOM_TEXT_MAX_LENGTH_LONG) ){ + return ModeTypes.RandomTypeMaxLength; + } + else if(mode.equals(RANDOM_TEXT_USER_DEFINED_LENGTH) || mode.equals(RANDOM_TEXT_USER_DEFINED_LENGTH_LONG)){ + return ModeTypes.RandomTypeUserDefinedLength; + } + else if(mode.equals(RANDOM_TEXT_INC_FOR_EACH_COPY)){ + return ModeTypes.ModeTypeIncValueForEachCopy; + } + else{ + return ModeTypes.RandomTypeNotRandom; + } + + } + + /** + * Get user defined value for random length + * @return random value length + */ + public int getRandomValueLenght() { + return randomValueLength; + } + + /** + * Setting user defined length to random value + * @param randomValueLenght if set to > 0 random type is also set to RandomTypes.RandomTypeUserSetLength + * if set to <= random type is also set to RandomTypes.RandomTypeDefaultLenght + */ + public void setRandomValueLenght(int randomValueLenght) { + this.randomValueLength = randomValueLenght; + if(randomValueLenght > 0){ + setModeType(ModeTypes.RandomTypeUserDefinedLength); + }else{ + //value len cannot be 0, so setting default len instead + setModeType(ModeTypes.RandomTypeDefaultLength); + } + } + + + /** + * Get type + * @return type of this value + */ + public String getType() { + return type; + } + + /** + * Set type + * @param type + */ + public void setType(String type) { + this.type = type; + } + + /** + * Get ID + * @return id of this value + */ + public int getId() { + return id; + } + + /** + * Set ID + * @param id of this value + */ + public void setId(int id) { + this.id = id; + } + + /** + * Get max amount + * @return maxAmount of this value + */ + public int getMaxAmount() { + return maxAmount; + } + + /** + * Set Max amount + * @param maxAmount of this value + */ + public void setMaxAmount(int maxAmount) { + this.maxAmount = maxAmount; + } + + /** + * Set this value to contact set reference + * @param isContactSetReference true if this value is contact set reference + * false otherwise. + */ + public void setContactSetReference(boolean isContactSetReference) { + this.isContactSetReference = isContactSetReference; + + } + + /** + * Is this value a contact set referece + * @return true if its a contact set reference, false otherwise. + */ + public boolean isContactSetReference() { + return isContactSetReference; + } + + /** + * Get additional parameters + * @return additionalParameters + */ + public Map getAdditionalParameters() { + if(additionalParameters == null){ + additionalParameters = new LinkedHashMap(); + } + return additionalParameters; + } + + + /** + * Set additional parameters + * @param additionalParameters + */ + public void setAdditionalParameters(Map additionalParameters) { + this.additionalParameters = additionalParameters; + } + + + /** + * Add one additional parameter + * @param type + * @param value + */ + public void addAdditionalParameter(String type, String value) { + getAdditionalParameters().put(type, CreatorEditorSettings.getInstance().replaceForbiddenChars(value)); + } + + /** + * Get additional parameter + * @param type + * @return value, or null if not exist + */ + public String getAdditionalParameter(String type) { + return getAdditionalParameters().get(type); + } + + /** + * Does this component have some additional parameters + * @return true if this component has some additional parameter, false otherwise + */ + public boolean hasAdditionalParameters(){ + return additionalParameters != null && getAdditionalParameters().size() > 0 ? true : false; + } + + /** + * Removes all additional parameters + * Note: attributes is not going to be removed. Use {@link AbstractComponent#removeAllAttributes()} + */ + public void removeAdditionalParameters() { + additionalParameters = new LinkedHashMap(); + } + + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/AbstractVariables.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/AbstractVariables.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,285 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components; + +import java.util.Collection; +import java.util.Iterator; +import java.util.Map; + +/** + * Abstract super class for variables of one type. + */ +public abstract class AbstractVariables { + + /** + * ID for max random length + */ + public static final String RANDOM_LEN_MAX_XML_VALUE = "max"; + + /** + * ID for default random length + */ + public static final String RANDOM_LEN_DEFAULT_XML_VALUE = "default"; + + /** + * "yes" and "no" values + */ + public static final String YES_NO_TYPES_AS_COMMA_SEPARATED_STRING [] = {"yes", "no"}; + + /** + * UI help text for date time format + */ + public static final String DATE_TIME_FORMAT = "YYYY-MM-DDTHH:MM:SS"; + + /** + * UI help text for date format + */ + public static final String DATE_FORMAT = "YYYY-MM-DD"; + + /** + * UI Help text for date and date time usage + */ + public static final String DATE_TIME_AND_DATE_FORMAT_HELP_TEXT = "For date time fields use format: '" + +DATE_TIME_FORMAT +"' and for date fields use format: '" +DATE_FORMAT +"'."; + + /** + * UI Help text for date usage + */ + public static final String DATE_FORMAT_HELP_TEXT = "For date fields use format: '" + +DATE_FORMAT +"'."; + + /** + * UI help text for coordinate format + */ + public static final String COORDINATE_FORMAT = "-nn.nnnn – nn.nnnn"; + + /** + * UI help text for coordinate format usage + */ + public static final String COORDINATE_FORMAT_HELP_TEXT = "For latitude, longitude and altitude use format: '" +COORDINATE_FORMAT +"'." + +" Positive latitude means north and negative south, zero point is Equator. " + + "Positive longitude means east and negative west, zero point is Prime Meridian. " + + "For altitude zero point is sea level."; + + + /** + * Storage for component items to be shown in UI. + * First String is key to XML element name and second String is shown in UI. + */ + protected Map items = null; + + /** + * Storage for additional items, not to be shown in UI. But even when these items are not shown in UI + * they are allowed to add to script. Most likely those are XML structure elements when XML is hidden + * from user to. Or XML typing information what's hidden from user. + */ + protected Map additionalItems = null; + + /** + * Storage for fixed values of certain item type to be shown in UI. + * First String is key to XML element name and second String table is values able to set to element. + * Values are set as they appear in XML and UI. + */ + protected Map itemsValues = null; + + /** + * Storage for max occurs of certain item type in one script. + */ + protected Map maxOccur; + + /** + * Storage for Tip Texts of certain item type. + */ + protected Map tipTexts; + + + /** + * Get Singleton instance of variables + * @return a component class implementing {@link AbstractVariables} + */ + protected abstract AbstractVariables getInstanceImpl(); + + + /** + * Get XML element name by value + * @param value + * @return key if found, null otherwise + */ + public String getIdByValue(String value) { + + if(value == null){ + return null; + } + + Collection keys = getItemIDs(); + for (Iterator iterator = keys.iterator(); iterator.hasNext();) { + String key = (String) iterator.next(); + String _value = getInstanceImpl().items.get(key); + if (_value.equals(value)) { + return key; + } + } + + //If there is additional items added, checkin also it there is value + if(getInstanceImpl().additionalItems != null){ + //If value is null, it might be sub value e.g. email in ... + Collection subkeys = getInstanceImpl().additionalItems.keySet(); + for (Iterator iterator = subkeys.iterator(); iterator.hasNext();) { + String key = (String) iterator.next(); + String _value = getInstanceImpl().additionalItems.get(key); + if (_value.equals(value)) { + return key; + } + } + } + //Or if id was not found at all, its not a supported value/id + return null; + + } + + /** + * Get item ID:s (match to element name in XML ) + * + * @return item ID:s + */ + public Collection getItemIDs() { + + return getInstanceImpl().items.keySet(); + + } + + /** + * Get Item values (showable names) + * @return item names + */ + public Collection getItemValues() { + + return getInstanceImpl().items.values(); + } + + /** + * Get item ID:s (match to element name in XML ) + * + * @return item ID:s + */ + public String[] getItemIDsAsString() { + return (String[]) getItemIDs().toArray(new String[0]); + } + + /** + * Get Item values (showable names) + * @return item names + */ + public String[] getItemValuesAsString() { + Collection col = getItemValues(); + String[] arr = (String[]) col.toArray(new String[0]); + return arr; + } + + /** + * Get value by XML element name + * @param id + * @return value + */ + public String getValueById(String id) { + if(id == null){ + return null; + } + String id_ = id.toLowerCase(); + String value = getInstanceImpl().items.get(id_); + //If value is null, it might be sub value e.g. email in ... + if (value == null && getInstanceImpl().additionalItems != null){ + value = getInstanceImpl().additionalItems.get(id_); + } + return value; + } + + /** + * Get fixed values for type. E.g. Message can have values "read" and "new" for item "status". + * @param id - ID of the item (element type in XML). + * @return possible values or null if item type has no + * fixed values or item type was not found. + */ + public String[] getValuesForItemType(String itemType){ + if(getInstanceImpl().itemsValues == null || getValueById(itemType) == null){ + return null; + } + else{ + String [] values = getInstanceImpl().itemsValues.get(itemType); + if(values == null || values.length < 1){ + return null; + }else{ + return values; + } + } + } + + /** + * Items max occurrence count in one script. Default implementation is + * unbounded and {@link AbstractComponent#MAX_OCCURS_UNBOUNDED} is returned. + * Component can overwrite this implementation if has items that have limited number + * of items occurrences in one script. + * @param itemName + * @return item max occurrence if defined or {@link AbstractComponent#MAX_OCCURS_UNBOUNDED}. + */ + public int itemMaxOccur(String itemName) { + + if(maxOccur == null){ + return AbstractComponent.MAX_OCCURS_UNBOUNDED; + }else{ + Integer maxOcc = maxOccur.get(itemName); + if(maxOcc != null){ + int occ = maxOcc.intValue(); + if(occ > 0){ + return occ; + } + } + } + return AbstractComponent.MAX_OCCURS_UNBOUNDED; + } + + + /** + * Get Tip Text to item type. + * @param itemType + * @return TipText or null if not set. + */ + public String getTipText(String itemType) { + + if(tipTexts == null || itemType == null){ + return null; + }else{ + return tipTexts.get(itemType); + } + + } + + + /** + * Check if mode is enabled for key. Default implementation return true, + * component variables can overwrite this if special handling is needed. + * @param key + * @return true if mode is enabled. + */ + public boolean isModeEnabledForKey(String key) { + return true; + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/ComponentServices.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/ComponentServices.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,193 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components; + +import com.nokia.s60tools.creator.components.bookmark.Bookmark; +import com.nokia.s60tools.creator.components.bookmark.BookmarkFolder; +import com.nokia.s60tools.creator.components.bookmark.BookmarkFolderValue; +import com.nokia.s60tools.creator.components.bookmark.BookmarkValue; +import com.nokia.s60tools.creator.components.calendar.Calendar; +import com.nokia.s60tools.creator.components.calendar.CalendarValue; +import com.nokia.s60tools.creator.components.connectionmethod.ConnectionMethod; +import com.nokia.s60tools.creator.components.connectionmethod.ConnectionMethodValue; +import com.nokia.s60tools.creator.components.contact.Contact; +import com.nokia.s60tools.creator.components.contact.ContactGroup; +import com.nokia.s60tools.creator.components.contact.ContactGroupValue; +import com.nokia.s60tools.creator.components.contact.ContactSet; +import com.nokia.s60tools.creator.components.contact.ContactSetValue; +import com.nokia.s60tools.creator.components.contact.ContactValue; +import com.nokia.s60tools.creator.components.filetype.FileType; +import com.nokia.s60tools.creator.components.filetype.FileTypeValue; +import com.nokia.s60tools.creator.components.impsserver.IMPSServer; +import com.nokia.s60tools.creator.components.impsserver.IMPSServerValue; +import com.nokia.s60tools.creator.components.landmark.Landmark; +import com.nokia.s60tools.creator.components.landmark.LandmarkValue; +import com.nokia.s60tools.creator.components.log.Log; +import com.nokia.s60tools.creator.components.log.LogValue; +import com.nokia.s60tools.creator.components.messaging.MailBox; +import com.nokia.s60tools.creator.components.messaging.MailBoxValue; +import com.nokia.s60tools.creator.components.messaging.Message; +import com.nokia.s60tools.creator.components.messaging.MessageValue; +import com.nokia.s60tools.creator.components.note.Note; +import com.nokia.s60tools.creator.components.note.NoteValue; +import com.nokia.s60tools.creator.components.savedpage.SavedPage; +import com.nokia.s60tools.creator.components.savedpage.SavedPageFolder; +import com.nokia.s60tools.creator.components.savedpage.SavedPageFolderValue; +import com.nokia.s60tools.creator.components.savedpage.SavedPageValue; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + +/** + * Helper class to get a real implementing class of {@link AbstractComponent} + * and {@link AbstractValue} -classes. + */ +public class ComponentServices { + + /** + * Get a component by String in XML file () + * @param componentType + * @return a Component, null if not found or elementName was null, + * a UnknownCompoment if component was unknown + */ + public static AbstractComponent getComponentByXMLElementName(String componentType){ + + if(componentType == null){ + return null; + } + + if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_CONTACT_XML_ELEMENT)){ + return new Contact(AbstractComponent.NULL_ID); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_NOTE_XML_ELEMENT)){ + return new Note(AbstractComponent.NULL_ID); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_BOOKMARK_XML_ELEMENT)){ + return new Bookmark(AbstractComponent.NULL_ID); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_BOOKMARK_FOLDER_XML_ELEMENT)){ + return new BookmarkFolder(AbstractComponent.NULL_ID); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_SAVED_PAGE_XML_ELEMENT)){ + return new SavedPage(AbstractComponent.NULL_ID); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_SAVED_PAGE_FOLDER_XML_ELEMENT)){ + return new SavedPageFolder(AbstractComponent.NULL_ID); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_LOG_XML_ELEMENT)){ + return new Log(AbstractComponent.NULL_ID); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_IMPS_SERVER_XML_ELEMENT)){ + return new IMPSServer(AbstractComponent.NULL_ID); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_CONNECTION_METHOD_XML_ELEMENT)){ + return new ConnectionMethod(AbstractComponent.NULL_ID); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_CALENDAR_XML_ELEMENT)){ + return new Calendar(AbstractComponent.NULL_ID); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_MAIL_BOX_XML_ELEMENT)){ + return new MailBox(AbstractComponent.NULL_ID); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_MESSAGE_XML_ELEMENT)){ + return new Message(AbstractComponent.NULL_ID); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_CONTACT_SET_XML_ELEMENT)){ + return new ContactSet(AbstractComponent.NULL_ID); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_CONTACT_GROUP_XML_ELEMENT)){ + return new ContactGroup(AbstractComponent.NULL_ID); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_LANDMARK_XML_ELEMENT)){ + return new Landmark(AbstractComponent.NULL_ID); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_FILE_XML_ELEMENT)){ + return new FileType(AbstractComponent.NULL_ID); + } + else{ + return new UnknownCompoment(AbstractComponent.NULL_ID); + } + + } + + /** + * Get a component by String in XML file () + * @param componentType + * @return a Component, null if not found or elementName was null, + * a UnknownValue if component was unknown + */ + public static AbstractValue getValueByXMLElementName(String componentType){ + + + if(componentType == null){ + return null; + } + + if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_CONTACT_XML_ELEMENT)){ + return new ContactValue(); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_NOTE_XML_ELEMENT)){ + return new NoteValue(); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_BOOKMARK_XML_ELEMENT)){ + return new BookmarkValue(); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_BOOKMARK_FOLDER_XML_ELEMENT)){ + return new BookmarkFolderValue(); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_SAVED_PAGE_XML_ELEMENT)){ + return new SavedPageValue(); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_SAVED_PAGE_FOLDER_XML_ELEMENT)){ + return new SavedPageFolderValue(); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_LOG_XML_ELEMENT)){ + return new LogValue(); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_IMPS_SERVER_XML_ELEMENT)){ + return new IMPSServerValue(); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_CONNECTION_METHOD_XML_ELEMENT)){ + return new ConnectionMethodValue(); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_CALENDAR_XML_ELEMENT)){ + return new CalendarValue(); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_MAIL_BOX_XML_ELEMENT)){ + return new MailBoxValue(); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_MESSAGE_XML_ELEMENT)){ + return new MessageValue(); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_CONTACT_SET_XML_ELEMENT)){ + return new ContactSetValue(); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_CONTACT_GROUP_XML_ELEMENT)){ + return new ContactGroupValue(); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_LANDMARK_XML_ELEMENT)){ + return new LandmarkValue(); + } + else if(componentType.trim().equalsIgnoreCase(CreatorEditorSettings.TYPE_FILE_XML_ELEMENT)){ + return new FileTypeValue(); + } + else{ + return new UnknownValue(); + } + + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/Components.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/Components.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,290 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components; + +import java.util.Collection; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; +import java.util.Vector; + +import com.nokia.s60tools.creator.core.CreatorEditorSettings; +import com.nokia.s60tools.creator.xml.CreatorXML; + +/** + * Class for holding components in UI + */ +public class Components implements IComponentServices { + + private LinkedHashMap> components; + private String fileName; + private String filePath; + + + + /** + * @return all components + */ + public Map> getComponents() { + if(components == null){ + components = new LinkedHashMap>(); + } + return components; + } + + /** + * Get Components of selected type + * @param compoentType, component type as it is in {@link AbstractComponent} subclasses. Use + * AbstractComponent.getType() to get component id. + * @return a component, null if not exist + */ + public Vector getComponents(String type) { + + return getComponents().get(type); + } + + + /** + * Add one component to components + * @param component + */ + public void addComponent(AbstractComponent component) { + Vector v = getComponents(component.getType()); + if(v == null){ + v = new Vector(); + } + if(v.contains(component)){ + v.remove(component); + v.add(component); + }else{ + v.add(component); + } + + getComponents().put(component.getType(), v); + } + + /** + * Get keys to components added + * @return Keys (Types) + */ + public Set getComponentTypes() { + return getComponents().keySet(); + } + + /** + * Get Component by type and component String + * @param componentType + * @param componentToString + * @return a Component or null if not found + */ + public AbstractComponent getComponentByTypeAndComponentString( + String componentType, String componentToString) { + + AbstractComponent wantedComponent = null; + + Vector comps = getComponents(componentType); + //Looping through all components and seek wanted component + for (Iterator iterator = comps.iterator(); iterator.hasNext();) { + AbstractComponent comp = (AbstractComponent) iterator + .next(); + if(componentToString.equals(comp.toString())){ + wantedComponent = comp; + break; + } + } + + return wantedComponent; + } + + /** + * Get Component by type and component String + * @param componentToString + * @return a Component or null if not found + */ + public AbstractComponent getComponentByComponentString(String componentToString) { + + AbstractComponent wantedComponent = null; + + Set keys = getComponentTypes(); + for (Iterator typesIt = keys.iterator(); typesIt.hasNext();) { + String type = (String) typesIt.next(); + Vector comps = getComponents(type); + //Looping through all components and seek wanted component + for (Iterator iterator = comps.iterator(); iterator.hasNext();) { + AbstractComponent comp = (AbstractComponent) iterator + .next(); + if(componentToString.equals(comp.toString())){ + wantedComponent = comp; + break; + } + } + } + + return wantedComponent; + } + + + /** + * Removes component from list + * @param component + */ + public void remove(AbstractComponent component) { + Vector v = getComponents(component.getType()); + if(v == null){ + return; + } + v.remove(component); + + } + + /** + * Get components as XML String + * @return components + */ + public String toXMLString() { + CreatorXML xml = new CreatorXML(this); + return xml.toString(); + } + + /** + * Update existing component + * @param oldComp old existing component + * @param editedComp new edited component + */ + public void updateComponent(AbstractComponent oldComp, + AbstractComponent editedComp) + { + + Vector v = getComponents(oldComp.getType()); + if(v == null){ + v = new Vector(); + } + + if(v.contains(oldComp)){ + v.remove(oldComp); + v.add(editedComp); + }else{ + v.add(editedComp); + } + + + getComponents().put(editedComp.getType(), v); + + } + + /** + * Has this set of components one or more Contact Sets. + * @return true if at least one contact set is found + */ + public boolean hasContactSets() { + return getComponents(CreatorEditorSettings.TYPE_CONTACT_SET) != null + && getComponents(CreatorEditorSettings.TYPE_CONTACT_SET).size() > 0 ? true : false; + } + + /** + * Removes all references to component + * @param component + */ + public void removeReferencesToComponent(AbstractComponent component) { + + //All components + Collection> values = getComponents().values(); + + //Looping through all components + for (Iterator> iterator = values.iterator(); iterator.hasNext();) { + //found all component types + Vector componentsByType = (Vector) iterator + .next(); + //looping through all component types and found all components by that type + for (Iterator iterator2 = componentsByType.iterator(); iterator2 + .hasNext();) { + //Found a component + AbstractComponent comp = (AbstractComponent) iterator2 + .next(); + //IF that component has a reference to component which references wanted to remove, removing + if(comp.hasReferenceToAnotherComponent()){ + if(comp.getReferenceToAnotherComponent().equals(component)){ + comp.setReferenceToAnotherComponent(null); + } + } + } + } + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.IComponentServices#isReferencedByAnotherComponent(com.nokia.s60tools.creator.components.AbstractComponent) + */ + public boolean isReferencedByAnotherComponent(AbstractComponent component) { + + //All components + Collection> values = getComponents().values(); + + //Looping through all components + for (Iterator> iterator = values.iterator(); iterator.hasNext();) { + //found all component types + Vector componentsByType = (Vector) iterator + .next(); + //looping through all component types and found all components by that type + for (Iterator iterator2 = componentsByType.iterator(); iterator2 + .hasNext();) { + //Found a component + AbstractComponent comp = (AbstractComponent) iterator2 + .next(); + //IF that component has a reference to component which references wanted to remove, removing + if(comp.hasReferenceToAnotherComponent()){ + if(comp.getReferenceToAnotherComponent().equals(component)){ + return true; + } + } + } + } + return false; + } + + /** + * Set the name of the script file + * @param fileName + */ + public void setFileName(String fileName) { + this.fileName = fileName; + } + /** + * Get the name of the script file. + * @return fileName + */ + public String getFileName(){ + return fileName; + } + + /** + * Set the full path of the script file + * @param filePath + */ + public void setFilePath(String filePath) { + this.filePath = filePath; + } + /** + * Get the full path of the script file. + * @return fileName + */ + public String getFilePath(){ + return filePath; + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/IComponentServices.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/IComponentServices.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components; + +import java.util.Map; +import java.util.Vector; + +/** + * Interface to implement some component related functions + */ +public interface IComponentServices { + + /** + * If that component is referenced by any other component + * @param component + * @return true if any other component references to this component + */ + public abstract boolean isReferencedByAnotherComponent( + AbstractComponent component); + + /** + * @return all components + */ + public Map> getComponents(); + + /** + * Get Component by type and component String + * @param componentToString + * @return a Component or null if not found + */ + public AbstractComponent getComponentByComponentString( + String componentToString); + + /** + * Get Components of selected type + * @param compoentType, component type as it is in {@link AbstractComponent} subclasses. Use + * AbstractComponent.getType() to get component id. + * @return a component, null if not exist + */ + public Vector getComponents(String type); + +} \ No newline at end of file diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/UnknownCompoment.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/UnknownCompoment.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components; + +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + +/** + * Component type representing unknown component level element in XML Script. + * E.g. In XML, there was component, added by user manually (without Creator Script Editor) + * that is not supported with Creator Script Editor. + * + * This component type exist, because of error messages can be then full filled with detailed information. + */ +public class UnknownCompoment extends AbstractComponent { + + /** + * Construction + * @param id of component + */ + protected UnknownCompoment(int id) { + super(id); + } + + /** + * Not implemented + */ + public String getIdByValue(String value) { + return value; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getType() + */ + public String getType() { + return CreatorEditorSettings.TYPE_UNKNOWN; + } + + /** + * Not implemented + */ + public String getValueById(String id) { + return id; + } + + /** + * Not implemented + */ + public String getXMLElementName() { + return null; + } + + /** + * Not implemented + */ + public boolean isValid() { + return false; + } + + + /** + * Not implemented + */ + public void updateEntryTypeSpecificDataFields( + AbstractComponent entryWithUpdatedData) { + } + + /* Returns allways null. + * (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValuesForItemType(java.lang.String) + */ + public String[] getValuesForItemType(String itemType) { + return null; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getVariables() + */ + public AbstractVariables getVariables(){ + return null; + } +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/UnknownValue.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/UnknownValue.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components; + +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + +/** + * Component value representing unknown component value in {@link UnknownCompoment} at XML Script. + * E.g. In XML, there was component, added by user manually (without Creator Script Editor) + * that is not supported with Creator Script Editor. + * + * This component type value exist, because of error messages can be then full filled with detailed information. + */ +public class UnknownValue extends AbstractValue { + + /** + * Default construction + */ + public UnknownValue(){ + super(CreatorEditorSettings.TYPE_UNKNOWN); + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/bookmark/Bookmark.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/bookmark/Bookmark.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.bookmark; + + +import com.nokia.s60tools.creator.components.AbstractComponent; +import com.nokia.s60tools.creator.components.AbstractVariables; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + + +/** + * Class representing bookmark + */ +public class Bookmark extends AbstractComponent { + + + public Bookmark(int id) { + super(id); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.config.AbstractComponent#getType() + */ + public String getType() { + return CreatorEditorSettings.TYPE_BOOKMARK; + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#isValid() + */ + public boolean isValid() { + return true; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getIdByValue(java.lang.String) + */ + public String getIdByValue(String value) { + return BookmarkVariables.getInstance().getIdByValue(value); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValueById(java.lang.String) + */ + public String getValueById(String id) { + return BookmarkVariables.getInstance().getValueById(id); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getXMLElementName() + */ + public String getXMLElementName() { + return CreatorEditorSettings.TYPE_BOOKMARK_XML_ELEMENT; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValuesForItemType(java.lang.String) + */ + public String[] getValuesForItemType(String itemType) { + //If there is not this type of item at all + String idByValue = getIdByValue(itemType); + if(idByValue == null){ + return null; + } + return BookmarkVariables.getInstance().getValuesForItemType(idByValue); + + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getVariables() + */ + public AbstractVariables getVariables(){ + return BookmarkVariables.getInstance(); + } +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/bookmark/BookmarkFolder.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/bookmark/BookmarkFolder.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.bookmark; + + +import com.nokia.s60tools.creator.components.AbstractComponent; +import com.nokia.s60tools.creator.components.AbstractVariables; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + + +/** + * Class representing Bookmark folder + */ +public class BookmarkFolder extends AbstractComponent { + + + public BookmarkFolder(int id) { + super(id); + } + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.config.AbstractComponent#getType() + */ + public String getType() { + return CreatorEditorSettings.TYPE_BOOKMARK_FOLDER; + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#isValid() + */ + public boolean isValid() { + return true; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getIdByValue(java.lang.String) + */ + public String getIdByValue(String value) { + return BookmarkFolderVariables.getInstance().getIdByValue(value); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValueById(java.lang.String) + */ + public String getValueById(String id) { + return BookmarkFolderVariables.getInstance().getValueById(id); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getXMLElementName() + */ + public String getXMLElementName() { + return CreatorEditorSettings.TYPE_BOOKMARK_FOLDER_XML_ELEMENT; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValuesForItemType(java.lang.String) + */ + public String[] getValuesForItemType(String itemType) { + //If there is not this type of item at all + String idByValue = getIdByValue(itemType); + if(idByValue == null){ + return null; + } + return BookmarkFolderVariables.getInstance().getValuesForItemType(idByValue); + + } + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getVariables() + */ + public AbstractVariables getVariables(){ + return BookmarkFolderVariables.getInstance(); + } +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/bookmark/BookmarkFolderValue.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/bookmark/BookmarkFolderValue.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.bookmark; + +import com.nokia.s60tools.creator.components.AbstractValue; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + +/** + * One row of data of bookmark folder + */ +public class BookmarkFolderValue extends AbstractValue { + + /** + * Creates new Value. + * @param value + * @param randomType + * @param amount + */ + public BookmarkFolderValue(String value, ModeTypes randomType, int amount) { + this(); + setValue(value); + setModeType(randomType); + setAmount(amount); + } + + /** + * Creates new Value. + * @param value + * @param amount + */ + public BookmarkFolderValue(String value, int amount) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(amount); + } + + + /** + * Creates new Value. + * + * @param value + * @param isRandom if false, random type is set to {@link ModeTypes#RandomTypeNotRandom} + * if true random type is set to {@link ModeTypes#RandomTypeDefaultLength} + * @param amount + */ + public BookmarkFolderValue(String value, boolean isRandom, int amount) { + this(); + if(!isRandom){ + setModeType(ModeTypes.RandomTypeNotRandom); + } + else{ + setModeType(ModeTypes.RandomTypeDefaultLength); + } + setValue(value); + setAmount(amount); + } + + /** + * Creates new Value with no random and no amount. + * random value is set to {@link ModeTypes#RandomTypeNotRandom} and + * amount is set to 0. + * @param value + */ + public BookmarkFolderValue(String value) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(0); + } + + /** + * Creates new Value. + * Attributes is set by default; + * - random value is set to {@link ModeTypes#RandomTypeDefaultLength} + * - random is set to true + * - value is set to EMPTY_STRING + * - amount is set to 0. + */ + public BookmarkFolderValue() { + super(CreatorEditorSettings.TYPE_BOOKMARK_FOLDER); + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/bookmark/BookmarkFolderVariables.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/bookmark/BookmarkFolderVariables.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.bookmark; + +import java.util.LinkedHashMap; + +import com.nokia.s60tools.creator.components.AbstractVariables; + +/** + * Variables for bookmar folder + */ +public class BookmarkFolderVariables extends AbstractVariables { + + + private static BookmarkFolderVariables instance; + + /** + * Get Singleton instance of variables + * @return + */ + public static BookmarkFolderVariables getInstance() { + + if(instance == null){ + instance = new BookmarkFolderVariables(); + } + + return instance; + } + + private BookmarkFolderVariables(){ + init(); + } + + + /** + * UI text "Name" + */ + public static final String NAME = "Name"; + + private void init() { + + items = new LinkedHashMap(1); + items.put("name",NAME); + + } + + protected AbstractVariables getInstanceImpl() { + return instance; + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/bookmark/BookmarkValue.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/bookmark/BookmarkValue.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.bookmark; + +import com.nokia.s60tools.creator.components.AbstractValue; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + +/** + * One row of data of bookmark + */ +public class BookmarkValue extends AbstractValue { + + /** + * Creates new Value. + * @param value + * @param randomType + * @param amount + */ + public BookmarkValue(String value, ModeTypes randomType, int amount) { + this(); + setValue(value); + setModeType(randomType); + setAmount(amount); + } + + /** + * Creates new Value. + * @param value + * @param amount + */ + public BookmarkValue(String value, int amount) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(amount); + } + + + /** + * Creates new Value. + * + * @param value + * @param isRandom if false, random type is set to {@link ModeTypes#RandomTypeNotRandom} + * if true random type is set to {@link ModeTypes#RandomTypeDefaultLength} + * @param amount + */ + public BookmarkValue(String value, boolean isRandom, int amount) { + this(); + if(!isRandom){ + setModeType(ModeTypes.RandomTypeNotRandom); + } + else{ + setModeType(ModeTypes.RandomTypeDefaultLength); + } + setValue(value); + setAmount(amount); + } + + /** + * Creates new Value with no random and no amount. + * random value is set to {@link ModeTypes#RandomTypeNotRandom} and + * amount is set to 0. + * @param value + */ + public BookmarkValue(String value) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(0); + } + + /** + * Creates new Value. + * Attributes is set by default; + * - random value is set to {@link ModeTypes#RandomTypeDefaultLength} + * - random is set to true + * - value is set to EMPTY_STRING + * - amount is set to 0. + */ + public BookmarkValue() { + super(CreatorEditorSettings.TYPE_BOOKMARK); + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/bookmark/BookmarkVariables.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/bookmark/BookmarkVariables.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.bookmark; + +import java.util.LinkedHashMap; + +import com.nokia.s60tools.creator.components.AbstractVariables; + +public class BookmarkVariables extends AbstractVariables { + + + private static BookmarkVariables instance; + + /** + * Get Singleton instance of variables + * @return + */ + public static BookmarkVariables getInstance() { + + if(instance == null){ + instance = new BookmarkVariables(); + } + + return instance; + } + + private BookmarkVariables(){ + init(); + } + + // + // Items (rows) for component + // + public static final String NAME = "Name"; + public static final String URL = "URL"; + public static final String USERNAME = "Username"; + public static final String PASSWORD = "Password"; + + private void init() { + + items = new LinkedHashMap(4); + items.put("name",NAME); + items.put("url",URL); + items.put("username",USERNAME); + items.put("password",PASSWORD); + + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractVariables#getInstanceImpl() + */ + protected AbstractVariables getInstanceImpl() { + return instance; + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/calendar/Calendar.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/calendar/Calendar.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,220 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.calendar; + + +import java.util.Iterator; +import java.util.Set; +import java.util.Vector; + +import com.nokia.s60tools.creator.components.AbstractComponent; +import com.nokia.s60tools.creator.components.AbstractValue; +import com.nokia.s60tools.creator.components.AbstractVariables; +import com.nokia.s60tools.creator.components.contact.ContactValue; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + + +/** + * Class representing Calendar + */ +public class Calendar extends AbstractComponent { + + public Calendar(int id) { + super(id); + } + + public Calendar(int id, String eventType) { + this(id); + setEventType(eventType); + } + + + /** + * Get type for this Calendar event + * @return + */ + public String getEventType() { + return getAdditionalParameter(TYPE_PARAMETER_ID); + } + + + + /** + * Set event type for this calendar event + * @param eventType + */ + public void setEventType(String eventType) { + addAdditionalParameter(TYPE_PARAMETER_ID, eventType); + } + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.config.AbstractComponent#getType() + */ + public String getType() { + return CreatorEditorSettings.TYPE_CALENDAR; + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#isValid() + */ + public boolean isValid() { + // Calendar must have type + return getEventType() != null; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getIdByValue(java.lang.String) + */ + public String getIdByValue(String value) { + return CalendarVariables.getInstance().getIdByValue(value); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValueById(java.lang.String) + */ + public String getValueById(String id) { + return CalendarVariables.getInstance().getValueById(id); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getXMLElementName() + */ + public String getXMLElementName() { + return CreatorEditorSettings.TYPE_CALENDAR_XML_ELEMENT; + } + + /** + * Component type must be separated from other data with COMPONENT_TYPE_SEPARATOR, and before + * COMPONENT_TYPE_SEPARATOR there must not be any other information than component type. + * @return component String. Format: + * COMPONENT_TYPE_SEPARATOR =, =... + */ + public String toString() { + + Set componentKeys = getKeys(); + //Collection values = comp.getAttributes().values(); + + StringBuffer allFieldsB = new StringBuffer(); + allFieldsB.append(getValueById( getEventType())); + allFieldsB.append( COMPONENT_TYPE_SEPARATOR); + + //Amount (how many of this component will be added) + if(getAmount() > 0){ + allFieldsB.append(" Amount="); + allFieldsB.append(getAmount()); + allFieldsB.append(COMPONENT_ITEM_SEPARATOR); + } + + //Store all attendees found to here + Vector attendees = new Vector(); + + String itemlabel = new String(); + Vector itemValue; + //Looping through one component, founding all fields from that component + for (Iterator compValuesIt = componentKeys.iterator(); compValuesIt.hasNext();) { + itemlabel = (String) compValuesIt.next(); + itemValue = getAttribute(itemlabel); + //get all values from values vector + for (Iterator iterator = itemValue.iterator(); iterator.hasNext();) { + AbstractValue absVal = iterator.next(); + CalendarValue calVal = (CalendarValue)absVal; + + //if value is not attendee, its a regular value + if(!calVal.isAttendee()){ + addOneItemToBuffer(allFieldsB, itemlabel, calVal); + } + //for attendee values, collecting them and gathering in the end all together + else{ + attendees.add(calVal); + } + + } + + } + + //If ther is attendees, adding them + if(attendees.size() > 0){ + allFieldsB.append(CalendarVariables.ATTENDEES); + allFieldsB.append(COMPONENT_LABEL_VALUE_SEPARATOR); + for (Iterator iterator = attendees.iterator(); iterator.hasNext();) { + CalendarValue val = (CalendarValue) iterator.next(); + allFieldsB.append(val.getValue()); + allFieldsB.append(COMPONENT_ITEM_SEPARATOR); + } + } + + + //deleting last ", " from list + if(allFieldsB.toString().endsWith(COMPONENT_ITEM_SEPARATOR)){ + allFieldsB.delete(allFieldsB.length()-COMPONENT_ITEM_SEPARATOR.length(), allFieldsB.length()); + } + return CreatorEditorSettings.getInstance().replaceEntitiesWithChars(allFieldsB.toString()); + } + + + + private void addOneItemToBuffer(StringBuffer allFieldsB, String itemlabel, + CalendarValue calVal) { + allFieldsB.append(itemlabel); + allFieldsB.append(COMPONENT_LABEL_VALUE_SEPARATOR); + //If value is random value, showing in UI only short description () + if(calVal.isRandom()){ + allFieldsB.append(ContactValue.RANDOM_TEXT); + }else{ + allFieldsB.append(calVal.getValue()); + } + allFieldsB.append(COMPONENT_ITEM_SEPARATOR); + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValuesForItemType(java.lang.String) + */ + public String[] getValuesForItemType(String itemType) { + //If there is not this type of item at all + String idByValue = getIdByValue(itemType); + if(idByValue == null){ + return null; + } + return CalendarVariables.getInstance().getValuesForItemType(idByValue); + + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#itemMaxOccur(java.lang.String) + */ + public int itemMaxOccur(String itemName) { + return CalendarVariables.getInstance().itemMaxOccur(itemName); + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getVariables() + */ + public AbstractVariables getVariables(){ + return CalendarVariables.getInstance(); + } +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/calendar/CalendarValue.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/calendar/CalendarValue.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,241 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.calendar; + +import com.nokia.s60tools.creator.components.AbstractComponent; +import com.nokia.s60tools.creator.components.AbstractValue; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + +/** + * One row of data of calendar + */ +public class CalendarValue extends AbstractValue { + + private boolean isAttendee = false; + private String attendeeEmail = null; + private String attendeeCommonName = null; + + /** + * @param value + * @param randomType + * @param amount + */ + public CalendarValue(String type, String value, ModeTypes randomType, int amount) { + this(); + setValue(type, value); + setModeType(randomType); + setAmount(amount); + } + + + /** + * Set amount and also maxamount as amount + * For now in calendar there is no any other possible amount fields in calendar than maxamount in contact-set reference + * So using always amount also as maxamount. If there is new requirement for amount in calendar, reimplement. + * + * @param amount -for amount and maxamount + */ + public void setAmount(int amount) { + super.setAmount(amount); + super.setMaxAmount(amount); + } + + /** + * + * @param value + * @param amount + */ + public CalendarValue(String type, String value, int amount) { + this(); + setValue(type, value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(amount); + } + + + /** + * Creates new Value. + * + * @param value + * @param isRandom if false, random type is set to {@link ModeTypes#RandomTypeNotRandom} + * if true random type is set to {@link ModeTypes#RandomTypeDefaultLength} + * @param amount + */ + public CalendarValue(String type, String value, boolean isRandom, int amount) { + this(); + if(!isRandom){ + setModeType(ModeTypes.RandomTypeNotRandom); + } + else{ + setModeType(ModeTypes.RandomTypeDefaultLength); + } + setValue(type, value); + setAmount(amount); + } + + /** + * Creates new Value with no random and no amount. + * random value is set to {@link ModeTypes#RandomTypeNotRandom} and + * amount is set to 0. + * @param value + */ + public CalendarValue(String type, String value) { + this(); + setValue(type, value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(0); + } + + /** + * Creates new Value. + * Attributes is set by default; + * - random value is set to {@link ModeTypes#RandomTypeDefaultLength} + * - random is set to true + * - value is set to EMPTY_STRING + * - amount is set to 0. + */ + public CalendarValue() { + super(CreatorEditorSettings.TYPE_CALENDAR); + } + + /** + * Is this value an attendee value + * @return true if this is attendee false otherwise + */ + public boolean isAttendee() { + return isAttendee; + } + + /** + * Set this value to be an attendee value + * @param isAttendee true if this is attendee, false otherwise + */ + public void setAttendee(boolean isAttendee) { + this.isAttendee = isAttendee; + } + + /** + * Get attendee email + * @return attendee email + */ + public String getAttendeeEmail() { + return attendeeEmail; + } + + /** + * Get attendee common nane + * @return attendeee common name + */ + public String getAttendeeCommonName() { + return attendeeCommonName; + } + + + /** + * Set value by type. If type is "Attendee" using setAttendeeValue(value) + * otherwise using setValue(String) + * @param value + * @param type as in ZML + */ + public void setValue(String type, String value) { + + if (type != null) { + setType(type); + if (type.equalsIgnoreCase(CalendarVariables.ATTENDEEEMAIL_XML_ELEMENT) + || type.equalsIgnoreCase(CalendarVariables.ATTENDEEEMAIL)) { + this.attendeeEmail = value; + setAttendee(true); + } else if (type.equalsIgnoreCase(CalendarVariables.ATTENDEECOMMONNAME_XML_ELEMENT) + || type.equalsIgnoreCase(CalendarVariables.ATTENDEECOMMONNAME)) { + this.attendeeCommonName = value; + setAttendee(true); + }else if (type.equalsIgnoreCase(CalendarVariables.ATTENDEE) + || type.equalsIgnoreCase(CalendarVariables.ATTENDEE_XML_ELEMENT)) { + setAttendeeValue(value); + }else { + setValue(value); + } + + } else { + setValue(value); + } + + } + + /** + * Set attendee value, calling this will also set this object as attendee by using setAttendee(true) + * @param attendeeEmail - null not allowed. + * @param attendeeCommonName or null if not set + */ + public void setAttendeeValue(String attendeeEmail, String attendeeCommonName) { + setAttendee(true); + + this.attendeeEmail = attendeeEmail; + this.attendeeCommonName = attendeeCommonName; + + } + + /** + * Set attendee value, calling this will also set this object as attendee by using setAttendee(true) + * @param attendee with email and optional common name separated with '|' + */ + public void setAttendeeValue(String attendee) { + + if(attendee != null){ + + setAttendee(true); + + int separatorIndex = attendee.indexOf("|") ; + if(separatorIndex != -1){ + this.attendeeEmail = attendee.substring(0,separatorIndex).trim(); + this.attendeeCommonName = attendee.substring(separatorIndex +1).trim();; + + }else{ + this.attendeeEmail = attendee; + } + } + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractValue#getValue() + */ + public String getValue() { + + //In case of Attendee, there is two parameters in one value + if(isAttendee()){ + if(getAttendeeCommonName() == null){ + return getAttendeeEmail(); + }else{ + return getAttendeeEmail() + AbstractComponent.COMPONENT_TYPE_SEPARATOR + +getAttendeeCommonName(); + } + + } + //In case of contact set reference, value is not set, but id is + else if(isContactSetReference()){ + return ""+getId(); + } + else{ + return super.getValue(); + } + } + + + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/calendar/CalendarVariables.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/calendar/CalendarVariables.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,259 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.calendar; + +import java.util.LinkedHashMap; + +import com.nokia.s60tools.creator.components.AbstractVariables; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + +/** + * Variables for calendar + */ +public class CalendarVariables extends AbstractVariables { + + public static final String STATUS_XML_ELEMENT = "status"; + + public static final String RECURRENTFREQUENCY_XML_ELEMENT = "recurrentfrequency"; + + public static final String ORGANIZEREMAIL_XML_ELEMENT = "organizeremail"; + + private static CalendarVariables instance; + + /** + * Get Singleton instance of variables + * @return + */ + public static CalendarVariables getInstance() { + + if (instance == null) { + instance = new CalendarVariables(); + } + + return instance; + } + + private CalendarVariables() { + init(); + initFixedValues(); + initMaxOccurValues(); + } + + + + // + // Variables + // + public static final String SUMMARY = "Summary"; + public static final String LOCATION = "Location"; + public static final String DESCRIPTION = "Description"; + public static final String STARTTIME = "Start time"; + public static final String ENDTIME = "End time"; + + public static final String CREATION_PERIOD_START_DATE = "Creation period start date"; + public static final String CREATION_PERIOD_END_DATE = "Creation period end date"; + + + public static final String ALARMTIME = "Alarm time"; + public static final String DATE = "Date"; + + public static final String RECURRENTFREQUENCY = "Recurrent frequency"; + public static final String RECURRENTINTERVAL = "Recurrent interval"; + public static final String RECURRENTFROM = "Recurrent from"; + public static final String RECURRENTTO = "Recurrent to"; + + public static final String SYNCHRONIZATION = "Synchronization"; + + public static final String ORGANIZERNAME = "Organizer name"; + public static final String ORGANIZEREMAIL = "Organizer email"; + + public static final String ATTENDEES = "Attendees"; + public static final String ATTENDEE = "Attendee"; + public static final String ATTENDEE_XML_ELEMENT = "attendee"; + public static final String ATTENDEECOMMONNAME = "Commonname"; + public static final String ATTENDEEEMAIL = "Email"; + + public static final String ATTENDEECOMMONNAME_XML_ELEMENT = "commonname"; + public static final String ATTENDEEEMAIL_XML_ELEMENT = "email"; + + public static final String SYNCHRONIZATION_XML_ELEMENT = "Synchronization"; + + public static final String STATUS = "Status"; + + public static final String PRIORITY = "Priority"; + + public static final String ATTENDEE_CONTACT_SET_REFERENCE = "Attendee Contact Set ID"; + + public static final String RECURRENTFREQUENCY_POSSIBLE_VALUES_AS_COMMA_SEPARATED [] = {"not-repeated", "daily", "weekly", "monthly", "yearly"} ; + public static final String RECURRENTFREQUENCY_POSSIBLE_VALUES_HELP_TEXT = "To do every second week occurrence calendar event, set '" + +RECURRENTFREQUENCY+"' to \"weekly\" and set '" +RECURRENTINTERVAL +"' to 2"; + public static final String STATUS_POSSIBLE_VALUES_AS_COMMA_SEPARATED [] = {"tentative", "confirmed", "cancelled", "todoneedsaction", "todocompleted", "todoinprocess"}; + public static final String PRIORITY_POSSIBLE_VALUES_HELP_TEXT = "high, normal, low, or integer values between 0 and 255. Integer values: high = 1, normal = 2, low = 3"; + + private void init() { + + items = new LinkedHashMap(13); + items.put("summary", SUMMARY); + items.put("description", DESCRIPTION); + items.put("location", LOCATION); + items.put("starttime", STARTTIME); + items.put("endtime", ENDTIME); + + items.put("creationperiodstartdate", CREATION_PERIOD_START_DATE); + items.put("creationperiodenddate", CREATION_PERIOD_END_DATE); + + items.put("alarmtime", ALARMTIME); + + items.put(RECURRENTFREQUENCY_XML_ELEMENT, RECURRENTFREQUENCY); + items.put("recurrentinterval", RECURRENTINTERVAL); + items.put("recurrentfrom", RECURRENTFROM); + items.put("recurrentto", RECURRENTTO); + + items.put("synchronization", SYNCHRONIZATION); + + items.put("organizername", ORGANIZERNAME); + items.put(ORGANIZEREMAIL_XML_ELEMENT, ORGANIZEREMAIL); + + items.put(ATTENDEE_XML_ELEMENT, ATTENDEE); + + items.put(CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE_XML_ELEMENT, ATTENDEE_CONTACT_SET_REFERENCE); + + + //Sub items (xml elements) is collected to own table, so they are not shown in UI + + additionalItems = new LinkedHashMap(13); + additionalItems.put("attendees", ATTENDEES); + additionalItems.put(ATTENDEECOMMONNAME_XML_ELEMENT, ATTENDEECOMMONNAME); + additionalItems.put(ATTENDEEEMAIL_XML_ELEMENT, ATTENDEEEMAIL); + + additionalItems.put("starttime", DATE); + additionalItems.put(STATUS_XML_ELEMENT, STATUS); + additionalItems.put("priority", PRIORITY); + + additionalItems.put(CreatorEditorSettings.TYPE_APPOINTMENT_XML_ELEMENT, CreatorEditorSettings.TYPE_APPOINTMENT); + additionalItems.put(CreatorEditorSettings.TYPE_EVENT_XML_ELEMENT, CreatorEditorSettings.TYPE_EVENT); + additionalItems.put(CreatorEditorSettings.TYPE_REMINDER_XML_ELEMENT, CreatorEditorSettings.TYPE_REMINDER); + additionalItems.put(CreatorEditorSettings.TYPE_TODO_XML_ELEMENT, CreatorEditorSettings.TYPE_TODO); + additionalItems.put(CreatorEditorSettings.TYPE_ANNIVERSARY_XML_ELEMENT, CreatorEditorSettings.TYPE_ANNIVERSARY); + + + + } + + private void initFixedValues(){ + itemsValues = new LinkedHashMap(4); + itemsValues.put(RECURRENTFREQUENCY_XML_ELEMENT, RECURRENTFREQUENCY_POSSIBLE_VALUES_AS_COMMA_SEPARATED); + itemsValues.put(STATUS_XML_ELEMENT, STATUS_POSSIBLE_VALUES_AS_COMMA_SEPARATED); + } + + + /** + * Inits Max Occur valus for items + */ + private void initMaxOccurValues(){ + maxOccur = new LinkedHashMap(4); + + Integer integerOne = new Integer (1); + + maxOccur.put(SUMMARY, integerOne ); + maxOccur.put(DESCRIPTION, integerOne ); + maxOccur.put(LOCATION, integerOne ); + maxOccur.put(STARTTIME, integerOne ); + maxOccur.put(ENDTIME, integerOne ); + maxOccur.put(CREATION_PERIOD_START_DATE, integerOne ); + maxOccur.put(CREATION_PERIOD_END_DATE, integerOne ); + maxOccur.put(ALARMTIME, integerOne ); + maxOccur.put(RECURRENTFREQUENCY, integerOne ); + maxOccur.put(RECURRENTINTERVAL, integerOne ); + maxOccur.put(RECURRENTFROM, integerOne ); + maxOccur.put(RECURRENTTO, integerOne ); + maxOccur.put(SYNCHRONIZATION, integerOne ); + maxOccur.put(ORGANIZERNAME, integerOne ); + maxOccur.put(ORGANIZEREMAIL, integerOne ); + + maxOccur.put(STATUS, integerOne); + maxOccur.put(PRIORITY, integerOne); + + maxOccur.put(ATTENDEES, integerOne); + + } + + /** + * Get Item values (showable names) + * @return item names + */ + public String[] getItemValuesAsString(String type) { + + String[] arr = null; + + //TO-DO + if(type.equals(CreatorEditorSettings.TYPE_TODO_XML_ELEMENT)){ + arr=new String[]{ + SUMMARY, DESCRIPTION, STARTTIME ,ENDTIME, CREATION_PERIOD_START_DATE, CREATION_PERIOD_END_DATE, ALARMTIME, SYNCHRONIZATION, PRIORITY, STATUS + }; + return arr; + } + //Reminder + else if(type.equals(CreatorEditorSettings.TYPE_REMINDER_XML_ELEMENT)){ + arr=new String[]{ + SUMMARY, DESCRIPTION, ALARMTIME, SYNCHRONIZATION, CREATION_PERIOD_START_DATE, CREATION_PERIOD_END_DATE + }; + return arr; + } + //Anniversary + else if(type.equals(CreatorEditorSettings.TYPE_ANNIVERSARY_XML_ELEMENT)){ + arr=new String[]{ + SUMMARY, DESCRIPTION, DATE, ALARMTIME, SYNCHRONIZATION, CREATION_PERIOD_START_DATE, CREATION_PERIOD_END_DATE + }; + return arr; + } + //Event (Day note) + else if(type.equals(CreatorEditorSettings.TYPE_EVENT_XML_ELEMENT)){ + arr=new String[]{ + SUMMARY, DESCRIPTION, STARTTIME, ENDTIME, CREATION_PERIOD_START_DATE, CREATION_PERIOD_END_DATE, ALARMTIME, SYNCHRONIZATION + }; + return arr; + } + //Appointment + else if(type.equals(CreatorEditorSettings.TYPE_APPOINTMENT)){ + //return all others, but not priority and status + arr=new String[]{ + SUMMARY, DESCRIPTION, LOCATION, STARTTIME, ENDTIME, CREATION_PERIOD_START_DATE, CREATION_PERIOD_END_DATE, ALARMTIME, + RECURRENTFROM, RECURRENTTO, RECURRENTFREQUENCY, RECURRENTINTERVAL, + SYNCHRONIZATION, ORGANIZERNAME, ORGANIZEREMAIL, ATTENDEE, + CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE + }; + return arr; + + } + //Just in case else returning all + else{ + return getItemValuesAsString(); + } + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractVariables#getInstanceImpl() + */ + protected AbstractVariables getInstanceImpl() { + return instance; + } + + + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/connectionmethod/ConnectionMethod.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/connectionmethod/ConnectionMethod.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.connectionmethod; + + +import com.nokia.s60tools.creator.components.AbstractComponent; +import com.nokia.s60tools.creator.components.AbstractVariables; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + + +/** + * Class representing Connection method + */ +public class ConnectionMethod extends AbstractComponent { + + + public ConnectionMethod(int id) { + super(id); + } + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.config.AbstractComponent#getType() + */ + public String getType() { + return CreatorEditorSettings.TYPE_CONNECTION_METHOD; + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#isValid() + */ + public boolean isValid() { + return true; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getIdByValue(java.lang.String) + */ + public String getIdByValue(String value) { + return ConnectionMethodVariables.getInstance().getIdByValue(value); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValueById(java.lang.String) + */ + public String getValueById(String id) { + return ConnectionMethodVariables.getInstance().getValueById(id); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getXMLElementName() + */ + public String getXMLElementName() { + return CreatorEditorSettings.TYPE_CONNECTION_METHOD_XML_ELEMENT; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValuesForItemType(java.lang.String) + */ + public String[] getValuesForItemType(String itemType) { + //If there is not this type of item at all + String idByValue = getIdByValue(itemType); + if(idByValue == null){ + return null; + } + return ConnectionMethodVariables.getInstance().getValuesForItemType(idByValue); + + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#itemMaxOccur(java.lang.String) + */ + public int itemMaxOccur(String itemName) { + return ConnectionMethodVariables.getInstance().itemMaxOccur(itemName); + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getVariables() + */ + public AbstractVariables getVariables(){ + return ConnectionMethodVariables.getInstance(); + } +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/connectionmethod/ConnectionMethodValue.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/connectionmethod/ConnectionMethodValue.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.connectionmethod; + +import com.nokia.s60tools.creator.components.AbstractValue; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + +/** + * One row of data of connection method + */ +public class ConnectionMethodValue extends AbstractValue { + + /** + * Creates new Value. + * @param value + * @param randomType + * @param amount + */ + public ConnectionMethodValue(String value, ModeTypes randomType, int amount) { + this(); + setValue(value); + setModeType(randomType); + setAmount(amount); + } + + /** + * Creates new Value. + * @param value + * @param amount + */ + public ConnectionMethodValue(String value, int amount) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(amount); + } + + + /** + * Creates new Value. + * + * @param value + * @param isRandom if false, random type is set to {@link ModeTypes#RandomTypeNotRandom} + * if true random type is set to {@link ModeTypes#RandomTypeDefaultLength} + * @param amount + */ + public ConnectionMethodValue(String value, boolean isRandom, int amount) { + this(); + if(!isRandom){ + setModeType(ModeTypes.RandomTypeNotRandom); + } + else{ + setModeType(ModeTypes.RandomTypeDefaultLength); + } + setValue(value); + setAmount(amount); + } + + /** + * Creates new Value with no random and no amount. + * random value is set to {@link ModeTypes#RandomTypeNotRandom} and + * amount is set to 0. + * @param value + */ + public ConnectionMethodValue(String value) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(0); + } + + /** + * Creates new Value. + * Attributes is set by default; + * - random value is set to {@link ModeTypes#RandomTypeDefaultLength} + * - random is set to true + * - value is set to EMPTY_STRING + * - amount is set to 0. + */ + public ConnectionMethodValue() { + super(CreatorEditorSettings.TYPE_CONNECTION_METHOD); + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/connectionmethod/ConnectionMethodVariables.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/connectionmethod/ConnectionMethodVariables.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,196 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.connectionmethod; + +import java.util.LinkedHashMap; + +import com.nokia.s60tools.creator.components.AbstractVariables; + +/** + * Variables for connection method + */ +public class ConnectionMethodVariables extends AbstractVariables { + + // + // Variables for XML element names + // + public static final String USEPROXY_XML_ELEMENT = "useproxy"; + public static final String PROMPTPASSWORD_XML_ELEMENT = "promptpassword"; + public static final String SECUREAUTHENTICATION_XML_ELEMENT = "secureauthentication"; + public static final String DISABLE_TEXT_AUTH_XML_ELEMENT = "disabletextauth"; + public static final String WAPWSOPTION_XML_ELEMENT = "wapwspoption"; + public static final String DATACALLLINESPEED_XML_ELEMENT = "datacalllinespeed"; + public static final String DATACALLTYPEISDN_XML_ELEMENT = "datacalltypeisdn"; + public static final String PROTOCOLLTYPE_XML_ELEMENT = "protocoltype"; + public static final String BEARERTYPE_XML_ELEMENT = "bearertype"; + + /** + * Only instance of this class + */ + private static ConnectionMethodVariables instance; + + /** + * Get Singleton instance of variables + * @return + */ + public static ConnectionMethodVariables getInstance() { + + if(instance == null){ + instance = new ConnectionMethodVariables(); + } + + return instance; + } + + private ConnectionMethodVariables(){ + init(); + initFixedValues(); + initMaxOccurValues(); + } + + // + // Variables to show in UI + // + public static final String CONNECTIONNAME = "Connection name"; + public static final String BEARERTYPE = "Bearer type"; + public static final String STARTPAGE = "Start page"; + public static final String WAPWSPOPTION = "WAP WSP option"; + public static final String PROTOCOLTYPE = "Protocol type"; + public static final String SECUREAUTHENTICATION = "Secure authentication"; + public static final String LOGINNAME = "Login name"; + public static final String LOGINPASS = "Login password"; + public static final String PROMPTPASSWORD = "Prompt password"; + public static final String GATEWAYADDRESS = "Gateway address"; + public static final String SUBNETMASK = "Subnetmask"; + public static final String DEVICEIPADDR = "Device IP address"; + public static final String IP4NAMESERVER1 = "IP v4 primary nameserver"; + public static final String IP4NAMESERVER2 = "IP v4 secondary nameserver"; + public static final String DATACALLTELNUMBER = "Datacall phone number"; + public static final String DATACALLTYPEISDN = "Datacall ISDN type"; + public static final String DATACALLLINESPEED = "Datacall line speed"; + public static final String USEPROXY = "Use proxy"; + public static final String PROXYSERVERADDRESS = "Proxy server address"; + public static final String PROXYPORTNUMBER = "Proxy port number"; + public static final String IP6NAMESERVER1 = "IP v6 primary nameserver"; + public static final String IP6NAMESERVER2 = "IP v6 secondary nameserver"; + public static final String DISABLETEXTAUTH = "Disable plaintext authentication"; + public static final String WLANNAME = "SSID of WLAN connection"; + public static final String WLANIPADDR = "IP address of Device"; + public static final String WLANSECMODE = "WLAN Security mode"; + public static final String WLANNETMODE = "WLAN Network mode"; + + // + // Fixed variables for certain item in UI + // + public static final String ALL_BEARERTYPE_TYPES_AS_COMMA_SEPARATED_STRING [] = {"WLAN", "GPRS", "Datacall", "HSGSM", "Embedded", "VPN", "LAN"}; + public static final String ALL_PROTOCOLTYPE_TYPES_AS_COMMA_SEPARATED_STRING [] = {"IPV4", "IPV6"}; + public static final String ALL_DATACALLTYPEISDN_TYPES_AS_COMMA_SEPARATED_STRING [] = {"Analogue", "ISDNv110", "ISDNv120"}; + public static final String ALL_DATACALLLINESPEED_TYPES_AS_COMMA_SEPARATED_STRING [] = {"AUTOMATIC", "9600", "14400", "19200", "28800", "38400", "43200", "56000"}; + public static final String ALL_WAPWSPOPTION_TYPES_AS_COMMA_SEPARATED_STRING [] = {"Connectionless", "Connectionoriented"}; + + + + private void init() { + + items = new LinkedHashMap(27); + items.put("connectionname", CONNECTIONNAME ); + items.put(BEARERTYPE_XML_ELEMENT, BEARERTYPE ); + items.put("startpage", STARTPAGE ); + items.put(WAPWSOPTION_XML_ELEMENT, WAPWSPOPTION ); + items.put(PROTOCOLLTYPE_XML_ELEMENT, PROTOCOLTYPE ); + items.put("loginname", LOGINNAME ); + items.put(SECUREAUTHENTICATION_XML_ELEMENT, SECUREAUTHENTICATION ); + items.put("loginpass", LOGINPASS ); + items.put(PROMPTPASSWORD_XML_ELEMENT, PROMPTPASSWORD ); + items.put("gatewayaddress", GATEWAYADDRESS ); + items.put("subnetmask", SUBNETMASK ); + items.put("deviceipaddr", DEVICEIPADDR ); + items.put("ip4nameserver1", IP4NAMESERVER1 ); + items.put("ip4nameserver2", IP4NAMESERVER2 ); + items.put("datacalltelnumber", DATACALLTELNUMBER ); + items.put(DATACALLTYPEISDN_XML_ELEMENT, DATACALLTYPEISDN ); + items.put(DATACALLLINESPEED_XML_ELEMENT, DATACALLLINESPEED ); + items.put(USEPROXY_XML_ELEMENT, USEPROXY ); + items.put("proxyserveraddress", PROXYSERVERADDRESS ); + items.put("proxyportnumber", PROXYPORTNUMBER ); + items.put("ip6nameserver1", IP6NAMESERVER1 ); + items.put("ip6nameserver2", IP6NAMESERVER2 ); + items.put(DISABLE_TEXT_AUTH_XML_ELEMENT, DISABLETEXTAUTH ); + items.put("wlanname", WLANNAME ); + items.put("wlanipaddr", WLANIPADDR ); + items.put("wlansecmode", WLANSECMODE ); + items.put("wlannetmode", WLANNETMODE ); + } + + private void initFixedValues(){ + itemsValues = new LinkedHashMap(4); + itemsValues.put(BEARERTYPE_XML_ELEMENT, ALL_BEARERTYPE_TYPES_AS_COMMA_SEPARATED_STRING); + itemsValues.put(PROTOCOLLTYPE_XML_ELEMENT, ALL_PROTOCOLTYPE_TYPES_AS_COMMA_SEPARATED_STRING); + itemsValues.put(DATACALLTYPEISDN_XML_ELEMENT, ALL_DATACALLTYPEISDN_TYPES_AS_COMMA_SEPARATED_STRING); + itemsValues.put(DATACALLLINESPEED_XML_ELEMENT, ALL_DATACALLLINESPEED_TYPES_AS_COMMA_SEPARATED_STRING); + itemsValues.put(WAPWSOPTION_XML_ELEMENT, ALL_WAPWSPOPTION_TYPES_AS_COMMA_SEPARATED_STRING); + itemsValues.put(DISABLE_TEXT_AUTH_XML_ELEMENT, YES_NO_TYPES_AS_COMMA_SEPARATED_STRING); + itemsValues.put(SECUREAUTHENTICATION_XML_ELEMENT, YES_NO_TYPES_AS_COMMA_SEPARATED_STRING); + itemsValues.put(PROMPTPASSWORD_XML_ELEMENT, YES_NO_TYPES_AS_COMMA_SEPARATED_STRING); + itemsValues.put(USEPROXY_XML_ELEMENT, YES_NO_TYPES_AS_COMMA_SEPARATED_STRING); + + } + + /** + * Inits Max Occur values for items, all items can occur only once. + */ + private void initMaxOccurValues(){ + maxOccur = new LinkedHashMap(4); + + Integer integerOne = new Integer (1); + + maxOccur.put( CONNECTIONNAME , integerOne ); + maxOccur.put( BEARERTYPE , integerOne ); + maxOccur.put( STARTPAGE , integerOne ); + maxOccur.put( WAPWSPOPTION , integerOne ); + maxOccur.put( PROTOCOLTYPE , integerOne ); + maxOccur.put( LOGINNAME , integerOne ); + maxOccur.put( SECUREAUTHENTICATION , integerOne ); + maxOccur.put( LOGINPASS , integerOne ); + maxOccur.put( PROMPTPASSWORD , integerOne ); + maxOccur.put( GATEWAYADDRESS , integerOne ); + maxOccur.put( SUBNETMASK , integerOne ); + maxOccur.put( DEVICEIPADDR , integerOne ); + maxOccur.put( IP4NAMESERVER1 , integerOne ); + maxOccur.put( IP4NAMESERVER2 , integerOne ); + maxOccur.put( DATACALLTELNUMBER , integerOne ); + maxOccur.put( DATACALLTYPEISDN , integerOne ); + maxOccur.put( DATACALLLINESPEED , integerOne ); + maxOccur.put( USEPROXY , integerOne ); + maxOccur.put( PROXYSERVERADDRESS , integerOne ); + maxOccur.put( PROXYPORTNUMBER , integerOne ); + maxOccur.put( IP6NAMESERVER1 , integerOne ); + maxOccur.put( IP6NAMESERVER2 , integerOne ); + maxOccur.put( DISABLETEXTAUTH , integerOne ); + maxOccur.put( WLANNAME , integerOne ); + maxOccur.put( WLANIPADDR , integerOne ); + maxOccur.put( WLANSECMODE , integerOne ); + maxOccur.put( WLANNETMODE , integerOne ); + + } + + protected AbstractVariables getInstanceImpl() { + return instance; + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/contact/Contact.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/contact/Contact.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.contact; + + +import com.nokia.s60tools.creator.components.AbstractComponent; +import com.nokia.s60tools.creator.components.AbstractVariables; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + + +/** + * Class representing contact + */ +public class Contact extends AbstractComponent { + + + public Contact(int id) { + super(id); + } + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.config.AbstractComponent#getType() + */ + public String getType() { + return CreatorEditorSettings.TYPE_CONTACT; + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#isValid() + */ + public boolean isValid() { + return true; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getIdByValue(java.lang.String) + */ + public String getIdByValue(String value) { + return ContactVariables.getInstance().getIdByValue(value); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValueById(java.lang.String) + */ + public String getValueById(String id) { + return ContactVariables.getInstance().getValueById(id); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getXMLElementName() + */ + public String getXMLElementName() { + return CreatorEditorSettings.TYPE_CONTACT_XML_ELEMENT; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValuesForItemType(java.lang.String) + */ + public String[] getValuesForItemType(String itemType) { + //If there is not this type of item at all + String idByValue = getIdByValue(itemType); + if(idByValue == null){ + return null; + } + return ContactVariables.getInstance().getValuesForItemType(idByValue); + + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#isTypeSupportingIncValueForEachCopy(java.lang.String) + */ + public boolean isTypeSupportingIncValueForEachCopy(String type) { + + return ContactVariables.getInstance().isTypeSupportingIncValueForEachCopy(type); + + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getVariables() + */ + public AbstractVariables getVariables(){ + return ContactVariables.getInstance(); + } +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/contact/ContactGroup.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/contact/ContactGroup.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,203 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.contact; + + +import java.util.Iterator; +import java.util.Set; +import java.util.Vector; + +import com.nokia.s60tools.creator.components.AbstractComponent; +import com.nokia.s60tools.creator.components.AbstractValue; +import com.nokia.s60tools.creator.components.AbstractVariables; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + + +/** + * Class representing contact group + */ +public class ContactGroup extends AbstractComponent { + + + public int getId() { + int id_ = NULL_ID; + String numberValue = getAdditionalParameter(AbstractComponent.ID_PARAMETER_ID); + if( numberValue != null ){ + try { + id_ = Integer.parseInt(numberValue); + } catch (Exception e) { + id_ = NULL_ID; + } + } + return id_; + } + + + + public ContactGroup(int id) { + super(id); + } + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.config.AbstractComponent#getType() + */ + public String getType() { + return CreatorEditorSettings.TYPE_CONTACT_GROUP; + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#isValid() + */ + public boolean isValid() { + return true; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getIdByValue(java.lang.String) + */ + public String getIdByValue(String value) { + return ContactGroupVariables.getInstance().getIdByValue(value); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValueById(java.lang.String) + */ + public String getValueById(String id) { + return ContactGroupVariables.getInstance().getValueById(id); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getXMLElementName() + */ + public String getXMLElementName() { + return CreatorEditorSettings.TYPE_CONTACT_GROUP_XML_ELEMENT; + } + + + + + /** + * Get name parameter + * @return + */ + public String getName() { + return getAdditionalParameter(AbstractComponent.NAME_PARAMETER_ID); + } + + /** + * Component type must be separated from other data with COMPONENT_TYPE_SEPARATOR, and before + * COMPONENT_TYPE_SEPARATOR there must not be any other information than component type. + * @return component String. Format: + * COMPONENT_TYPE_SEPARATOR =, =... + */ + /** + * Component type must be separated from other data with COMPONENT_TYPE_SEPARATOR, and before + * COMPONENT_TYPE_SEPARATOR there must not be any other information than component type. + * @return component String. Format: + * COMPONENT_TYPE_SEPARATOR =, =... + */ + public String toString() { + + Set componentKeys = getKeys(); + //Collection values = comp.getAttributes().values(); + + StringBuffer allFieldsB = new StringBuffer(); + allFieldsB.append(getType()); + allFieldsB.append( COMPONENT_TYPE_SEPARATOR); + + //reference to another component + if(hasReferenceToAnotherComponent()){ + allFieldsB.append( getReferenceToAnotherComponent().getType() ); + allFieldsB.append( WHITE_SPACE ); + allFieldsB.append( ID_PARAMETER_ID ); + allFieldsB.append(COMPONENT_LABEL_VALUE_SEPARATOR ); + allFieldsB.append( getReferenceToAnotherComponent().getId() ); + allFieldsB.append( COMPONENT_TYPE_SEPARATOR); + } + + //Amount (how many of this component will be added) + if(getAmount() > 0){ + allFieldsB.append(" maxmount="); + allFieldsB.append(getAmount()); + allFieldsB.append(COMPONENT_ITEM_SEPARATOR); + } + + + if(getName() != null && getName().trim().length() > 0){ + allFieldsB.append(ContactGroupVariables.NAME); + allFieldsB.append(COMPONENT_LABEL_VALUE_SEPARATOR); + allFieldsB.append(getName() ); + allFieldsB.append(COMPONENT_ITEM_SEPARATOR); + } + + + String itemlabel = new String(); + Vector itemValue; + //Looping through one component, founding all fields from that component + for (Iterator compValuesIt = componentKeys.iterator(); compValuesIt.hasNext();) { + itemlabel = (String) compValuesIt.next(); + itemValue = getAttribute(itemlabel); + //get all values from values vector + for (Iterator iterator = itemValue.iterator(); iterator.hasNext();) { + ContactGroupValue val = (ContactGroupValue) iterator.next(); + + allFieldsB.append(itemlabel); + allFieldsB.append(COMPONENT_LABEL_VALUE_SEPARATOR);//= + //If value is random value, showing in UI only short description () + allFieldsB.append(val.getValue()); + allFieldsB.append(COMPONENT_ITEM_SEPARATOR);//, + } + + } + //deleting last ", " from list + if(allFieldsB.toString().endsWith(COMPONENT_ITEM_SEPARATOR)){ + allFieldsB.delete(allFieldsB.length()-COMPONENT_ITEM_SEPARATOR.length(), allFieldsB.length()); + } + return CreatorEditorSettings.getInstance().replaceEntitiesWithChars(allFieldsB.toString()); + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValuesForItemType(java.lang.String) + */ + public String[] getValuesForItemType(String itemType) { + //If there is not this type of item at all + String idByValue = getIdByValue(itemType); + if(idByValue == null){ + return null; + } + return ContactGroupVariables.getInstance().getValuesForItemType(idByValue); + + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getVariables() + */ + public AbstractVariables getVariables(){ + return ContactGroupVariables.getInstance(); + } +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/contact/ContactGroupValue.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/contact/ContactGroupValue.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,173 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.contact; + +import com.nokia.s60tools.creator.components.AbstractValue; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + +/** + * One row of data of contact group. + * + * Id and value are same in contact groups values. + * Thats because of parsing expect that value is random if there is no value, and + * group has only attributes, no value in XML element. + */ +public class ContactGroupValue extends AbstractValue { + + /** + * Creates new Value. + * @param value + * @param randomType + * @param amount + */ + public ContactGroupValue(String value, ModeTypes randomType, int amount) { + this(); + setValue(value); + setModeType(randomType); + setAmount(amount); + } + + /** + * Creates new Value. + * @param value + * @param amount + */ + public ContactGroupValue(String value, int amount) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(amount); + } + + + /** + * Returning {@link #getId()} as String, because id and value are same in contact groups. + * Thats because of parsing expect that value is random if there is no value, and + * group has only attributes, no value in xml element. + * + * @return {@link #getId()} + * @see com.nokia.s60tools.creator.components.AbstractValue#getValue() + */ + + public String getValue() { + return ""+getId(); + } + + /** + * Is this value random or not + * @return true if it is a random value + */ + public boolean isRandom() { + return false; + } + + + /* Contact Group value cannot be random. So always returning RandomTypes.RandomTypeNotRandom + * (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractValue#getRandomType() + */ + public ModeTypes getModeType() { + return ModeTypes.RandomTypeNotRandom; + } + + /** + /** + * Creates new Value. + * + * @param value + * @param isRandom if false, random type is set to {@link ModeTypes#RandomTypeNotRandom} + * if true random type is set to {@link ModeTypes#RandomTypeDefaultLength} + * @param amount + */ + public ContactGroupValue(String value, boolean isRandom, int amount) { + this(); + if(!isRandom){ + setModeType(ModeTypes.RandomTypeNotRandom); + } + else{ + setModeType(ModeTypes.RandomTypeDefaultLength); + } + setValue(value); + setAmount(amount); + } + + /** + * Creates new Value with no random and no amount. + * random value is set to {@link ModeTypes#RandomTypeNotRandom} and + * amount is set to 0. + * @param value + */ + public ContactGroupValue(String value) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(0); + } + + /** + * Creates new Value. + * Attributes is set by default; + * - random value is set to {@link ModeTypes#RandomTypeDefaultLength} + * - random is set to true + * - value is set to EMPTY_STRING + * - amount is set to 0. + */ + public ContactGroupValue() { + super(CreatorEditorSettings.TYPE_CONTACT_GROUP); + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractValue#setMaxAmount(int) + */ + public void setMaxAmount(int maxAmount) { + super.setMaxAmount(maxAmount); + super.setAmount(maxAmount); + } + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractValue#setAmount(int) + */ + public void setAmount(int amount) { + this.setMaxAmount(amount); + } + + + /* Overwriting because of value and id are same in contact groups + * (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractValue#setValue(java.lang.String) + */ + public void setValue(String value) { + super.setValue(value); + + int intValue=0; + try { + intValue = Integer.parseInt(value); + } catch (Exception e) { + intValue = 0; + } + super.setId(intValue); + } + /* Overwriting because of value and id are same in contact groups + * (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractValue#setId(int) + */ + public void setId(int id) { + super.setId(id); + super.setValue("" +id); + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/contact/ContactGroupVariables.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/contact/ContactGroupVariables.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.contact; + +import java.util.LinkedHashMap; + +import com.nokia.s60tools.creator.components.AbstractComponent; +import com.nokia.s60tools.creator.components.AbstractVariables; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + +/** + * Variables for contact group + */ +public class ContactGroupVariables extends AbstractVariables { + + + private static ContactGroupVariables instance; + + + /** + * Get Singleton instance of variables + * @return + */ + public static ContactGroupVariables getInstance() { + + if(instance == null){ + instance = new ContactGroupVariables(); + } + + return instance; + } + + private ContactGroupVariables(){ + init(); + } + + + /** + * UI text "Name" + */ + public static final String NAME = "Name"; + + private void init() { + + items = new LinkedHashMap(1); + items.put(CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE_XML_ELEMENT, CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE); + + additionalItems = new LinkedHashMap(13); + + additionalItems.put(AbstractComponent.NAME_PARAMETER_ID, NAME); + + + } + + protected AbstractVariables getInstanceImpl() { + return instance; + } + + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/contact/ContactSet.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/contact/ContactSet.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,148 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.contact; + + +import com.nokia.s60tools.creator.components.AbstractComponent; +import com.nokia.s60tools.creator.components.AbstractVariables; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + + +/** + * Class representing contact set + */ +public class ContactSet extends AbstractComponent { + + + + public ContactSet(int id) { + super(id); + } + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.config.AbstractComponent#getType() + */ + public String getType() { + return CreatorEditorSettings.TYPE_CONTACT_SET; + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#isValid() + */ + public boolean isValid() { + return true; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getIdByValue(java.lang.String) + */ + public String getIdByValue(String value) { + return ContactSetVariables.getInstance().getIdByValue(value); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValueById(java.lang.String) + */ + public String getValueById(String id) { + return ContactSetVariables.getInstance().getValueById(id); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getXMLElementName() + */ + public String getXMLElementName() { + return CreatorEditorSettings.TYPE_CONTACT_SET_XML_ELEMENT; + } + + + + /** + * Get Number of existing parameters + * @return 0 if not any + */ + public int getNumberOfExistingContacts() { + int numberOfExistingParams = NULL_ID; + String numberValue = getAdditionalParameter(AbstractComponent.NUMBER_OF_EXISTING_CONTACTS_PARAMETER_ID); + if( numberValue != null ){ + try { + numberOfExistingParams = Integer.parseInt(numberValue); + } catch (Exception e) { + numberOfExistingParams = NULL_ID; + } + } + return numberOfExistingParams; + } + + + /** + * Component type must be separated from other data with COMPONENT_TYPE_SEPARATOR, and before + * COMPONENT_TYPE_SEPARATOR there must not be any other information than component type. + * @return component String. Format: + * COMPONENT_TYPE_SEPARATOR =, =... + */ + public String toString() { + + StringBuffer allFieldsB = new StringBuffer(); + allFieldsB.append(getType()); + allFieldsB.append( COMPONENT_TYPE_SEPARATOR); + + allFieldsB.append(getValueById(ID_PARAMETER_ID)); + allFieldsB.append(COMPONENT_LABEL_VALUE_SEPARATOR); + allFieldsB.append(getId()); + + //Number of existing contacts + if(getNumberOfExistingContacts() != 0){ + allFieldsB.append(COMPONENT_ITEM_SEPARATOR); + allFieldsB.append(AbstractComponent.NUMBER_OF_EXISTING_CONTACTS); + allFieldsB.append(COMPONENT_LABEL_VALUE_SEPARATOR); + allFieldsB.append(getNumberOfExistingContacts() ); + } + + + return CreatorEditorSettings.getInstance().replaceEntitiesWithChars(allFieldsB.toString()); + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValuesForItemType(java.lang.String) + */ + public String[] getValuesForItemType(String itemType) { + //If there is not this type of item at all + String idByValue = getIdByValue(itemType); + if(idByValue == null){ + return null; + } + return ContactSetVariables.getInstance().getValuesForItemType(idByValue); + + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getVariables() + */ + public AbstractVariables getVariables(){ + return ContactSetVariables.getInstance(); + } +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/contact/ContactSetValue.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/contact/ContactSetValue.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.contact; + +import com.nokia.s60tools.creator.components.AbstractValue; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + +/** + * One row of data of contact set + */ +public class ContactSetValue extends AbstractValue { + + /** + * Creates new Value. + * @param value + * @param randomType + * @param amount + */ + public ContactSetValue(String value, ModeTypes randomType, int amount) { + this(); + setValue(value); + setModeType(randomType); + setAmount(amount); + } + + /** + * Creates new Value. + * @param value + * @param amount + */ + public ContactSetValue(String value, int amount) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(amount); + } + + + /** + * Creates new NoteValue. + * + * @param value + * @param isRandom if false, random type is set to {@link ModeTypes#RandomTypeNotRandom} + * if true random type is set to {@link ModeTypes#RandomTypeDefaultLength} + * @param amount + */ + public ContactSetValue(String value, boolean isRandom, int amount) { + this(); + if(!isRandom){ + setModeType(ModeTypes.RandomTypeNotRandom); + } + else{ + setModeType(ModeTypes.RandomTypeDefaultLength); + } + setValue(value); + setAmount(amount); + } + + /** + * Creates new NoteValue with no random and no amount. + * random value is set to {@link ModeTypes#RandomTypeNotRandom} and + * amount is set to 0. + * @param value + */ + public ContactSetValue(String value) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(0); + } + + /** + * Creates new Value. + * Attributes is set by default; + * - random value is set to{@link ModeTypes#RandomTypeDefaultLength} + * - random is set to true + * - value is set to EMPTY_STRING + * - amount is set to 0. + */ + public ContactSetValue() { + super(CreatorEditorSettings.TYPE_CONTACT_SET); + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/contact/ContactSetVariables.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/contact/ContactSetVariables.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.contact; + +import java.util.LinkedHashMap; + +import com.nokia.s60tools.creator.components.AbstractComponent; +import com.nokia.s60tools.creator.components.AbstractVariables; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + +/** + * Variables for contact set + */ +public class ContactSetVariables extends AbstractVariables { + + + public static final String ADD_CONTACT_SET_TXT = "Add new " +CreatorEditorSettings.TYPE_CONTACT_SET; + + private static ContactSetVariables instance; + + + /** + * Get Singleton instance of variables + * @return + */ + public static ContactSetVariables getInstance() { + + if(instance == null){ + instance = new ContactSetVariables(); + } + + return instance; + } + + private ContactSetVariables(){ + init(); + } + + /** + * UI text "ID" + */ + public static final String ID = "ID"; + + private void init() { + + items = new LinkedHashMap(1); + items.put(AbstractComponent.ID_PARAMETER_ID,ID); + + additionalItems = new LinkedHashMap(13); + additionalItems.put(AbstractComponent.NUMBER_OF_EXISTING_CONTACTS_PARAMETER_ID, AbstractComponent.NUMBER_OF_EXISTING_CONTACTS_DIALOG_TEXT); + + + } + + protected AbstractVariables getInstanceImpl() { + return instance; + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractVariables#isModeEnabledForKey(java.lang.String) + */ + public boolean isModeEnabledForKey(String key) { + return false; + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/contact/ContactValue.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/contact/ContactValue.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.contact; + +import com.nokia.s60tools.creator.components.AbstractValue; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + +/** + * One row of data of contact + */ +public class ContactValue extends AbstractValue { + + /** + * Creates new Value. + * @param value + * @param randomType + * @param amount + */ + public ContactValue(String value, ModeTypes randomType, int amount) { + this(); + setValue(value); + setModeType(randomType); + setAmount(amount); + } + + /** + * Creates new Value. + * @param value + * @param amount + */ + public ContactValue(String value, int amount) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(amount); + } + + + + /** + * Creates new ContactValue. + * + * @param value + * @param isRandom if false, random type is set to {@link ModeTypes#RandomTypeNotRandom} + * if true random type is set to {@link ModeTypes#RandomTypeDefaultLength} + * @param amount + */ + public ContactValue(String value, boolean isRandom, int amount) { + this(); + if(!isRandom){ + setModeType(ModeTypes.RandomTypeNotRandom); + } + else{ + setModeType(ModeTypes.RandomTypeDefaultLength); + } + setValue(value); + setAmount(amount); + } + + /** + * Creates new ContactValue with no random and no amount. + * random value is set to {@link ModeTypes#RandomTypeNotRandom} and + * amount is set to 0. + * @param value + */ + public ContactValue(String value) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(0); + } + + /** + * Creates new ContactValue. + * Attributes is set by default; + * - random value is set to {@link ModeTypes#RandomTypeDefaultLength} + * - random is set to true + * - value is set to EMPTY_STRING + * - amount is set to 0. + */ + public ContactValue() { + super(CreatorEditorSettings.TYPE_CONTACT); + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/contact/ContactVariables.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/contact/ContactVariables.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,589 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.contact; + +import java.util.LinkedHashMap; + +import com.nokia.s60tools.creator.components.AbstractVariables; +import com.nokia.s60tools.creator.components.filetype.FileTypeVariables; + +/** + * Variables for contact + */ +public class ContactVariables extends AbstractVariables + +{ + + /** + * Constant for founding id element supports incvalueforeachcopy. + * S60 Side of Creator is implemented so if "number" or "phone" exist on element name + * it supports incvalueforeachcopy. + */ + private static final String NUMBER = "number"; + + /** + * Constant for founding id element supports incvalueforeachcopy. + * S60 Side of Creator is implemented so if "number" or "phone" exist on element name + * it supports incvalueforeachcopy. + */ + private static final String PHONE = "phone"; + + public static final String THUMBNAILID_XML_ELEMENT = "thumbnailid"; + + private static ContactVariables instance; + + /** + * Get Singleton instance of variables + * @return + */ + public static ContactVariables getInstance() { + + if (instance == null) { + instance = new ContactVariables(); + } + + return instance; + } + + private ContactVariables() { + init(); + initFixedValues(); + } + + protected AbstractVariables getInstanceImpl() { + return instance; + } + + + /** + * Label text for "first name" memory entry item + */ + public static final String QTN_PHOB_LBL_FIRST_NAME = "First name"; + + /** + * Memory entry item label "Middle name" + */ + public static final String QTN_PHOB_LBL_MIDDLE_NAME = "Middle name"; + + /** + * Label text for "last name" memory entry item + */ + public static final String QTN_PHOB_LBL_LAST_NAME = "Last name"; + + /** + * Label text for "first name reading" memory entry item, used in japanese + * Phonebook only (not visible in other languages) + */ + public static final String QTN_PHOB_LBL_FIRST_READING = "First name reading"; + + /** + * Label text for "last name reading" memory entry item, used in japanese + * Phonebook only (not visible in other languages) + */ + public static final String QTN_PHOB_LBL_LAST_READING = "Last name reading"; + + /** + * Label text for prefix memory entry item. l: + */ + public static final String QTN_PHOB_LBL_PREFIX = "Prefix"; + + /** + * Label text for suffix memory entry item. l: + */ + public static final String QTN_PHOB_LBL_SUFFIX = "Suffix"; + + /** + * Label text for "Company Name" memory entry item + */ + public static final String QTN_PHOB_LBL_COMPANY_NAME = "Company Name"; + + /** + * Memory entry item label "Department" + */ + public static final String QTN_PHOB_LBL_DEPT_NAME = "Department"; + + /** + * Label text for "Job Title" memory entry item + */ + public static final String QTN_PHOB_LBL_JOB_TITLE = "Job Title"; + + /** + * Label text for "Nick Name" memory entry item. l: + */ + public static final String QTN_SIMP_LBL_NICK = "Nick name"; + + /** + * Memory entry item label "Assistant name" + */ + public static final String QTN_PHOB_LBL_ASSISTANT_NAME = "Assistant name"; + + /** + * Memory entry item label "Spouse" + */ + public static final String QTN_PHOB_LBL_SPOUSE = "Spouse"; + + /** + * Memory entry item label "Children" + */ + public static final String QTN_PHOB_LBL_CHILDREN = "Children"; + + /** + * Label text for "Phone Number (Standard)" memory entry item + */ + public static final String QTN_PHOB_LBL_NUMBER_STANDARD = "Phone Number"; + + /** + * Label text for "Phone Number (Home)" memory entry item + */ + public static final String QTN_PHOB_LBL_NUMBER_HOME = "Phone Number (Home)"; + + /** + * Label text for "Phone Number (Work)" memory entry item + */ + public static final String QTN_PHOB_LBL_NUMBER_WORK = "Phone Number (Work)"; + + /** + * Label text for "Phone Number (Mobile)" memory entry item + */ + public static final String QTN_PHOB_LBL_NUMBER_MOBILE = "Phone Number (Mobile)"; + + /** + * Label text for "Mobile (home)" memory entry item + */ + public static final String QTN_PHOB_LBL_NUMBER_MOBILE_HOME = "Mobile (home)"; + + /** + * Label text for "Mobile (work)" memory entry item + */ + public static final String QTN_PHOB_LBL_NUMBER_MOBILE_WORK = "Mobile (work)"; + + /** + * Label text for "video no." memory entry item + */ + public static final String QTN_PHOB_LBL_VIDEO = "Video no."; + + /** + * Label text for "video no. (home)" memory entry item + */ + public static final String QTN_PHOB_LBL_VIDEO_HOME = "Video no. (home)"; + + /** + * Label text for "video no. (work)" memory entry item + */ + public static final String QTN_PHOB_LBL_VIDEO_WORK = "Video no. (work)"; + + /** + * Memory entry item label "Car phone" + */ + public static final String QTN_PHOB_LBL_CAR_TEL = "Car phone"; + + /** + * Memory entry item label "Assistant phone" + */ + public static final String QTN_PHOB_LBL_NUMBER_ASSISTANT = "Assistant phone"; + + /** + * Label text for "VOIP call" memory entry item + */ + public static final String QTN_PHOB_LBL_VOIP = "Tel. Internet"; + + /** + * Label text for "VOIP call (home)" memory entry item + */ + public static final String QTN_PHOB_LBL_VOIP_HOME = "Tel. Internet (home)"; + + /** + * Label text for "VOIP call (work)" memory entry item + */ + public static final String QTN_PHOB_LBL_VOIP_WORK = "Tel. Internet (work)"; + + /** + * Label text for "push to talk" memory entry item + */ + public static final String QTN_PHOB_LBL_POC = "PTT"; + + /** + * Label text for "share view" memory entry item + */ + public static final String QTN_PHOB_LBL_SWIS = "Share view"; + + /** + * Label text for "SIP" memory entry item + */ + public static final String QTN_PHOB_LBL_SIP = "SIP"; + + /** + * Label text for "Fax Number" memory entry item + */ + public static final String QTN_PHOB_LBL_FAX = "Fax"; + + /** + * Label text for "Fax (home)" memory entry item + */ + public static final String QTN_PHOB_LBL_FAX_HOME = "Fax (home)"; + + /** + * Label text for "Fax (work)" memory entry item + */ + public static final String QTN_PHOB_LBL_FAX_WORK = "Fax (work)"; + + /** + * Label text for "Pager Number" memory entry item + */ + public static final String QTN_PHOB_LBL_PAGER = "Pager Number"; + + /** + * Label text for "Email Address" memory entry item + */ + public static final String QTN_PHOB_LBL_EMAIL = "Email"; + + /** + * Label text for "Email (home)" memory entry item + */ + public static final String QTN_PHOB_LBL_EMAIL_HOME = "Email (home)"; + + /** + * Label text for "Email (work)" memory entry item + */ + public static final String QTN_PHOB_LBL_EMAIL_WORK = "Email (work)"; + + /** + * Label text for "URL" memory entry item + */ + public static final String QTN_PHOB_LBL_URL = "URL"; + + /** + * Label text for "URL (home)" memory entry item + */ + public static final String QTN_PHOB_LBL_URL_HOME = "URL (home)"; + + /** + * Label text for "URL (work)" memory entry item + */ + public static final String QTN_PHOB_LBL_URL_WORK = "URL (work)"; + + /** + * Label text for "Postal Address" memory entry item + */ + public static final String QTN_PHOB_LBL_ADDRESS = "Postal Address"; + + /** + * Label text for "P.O.Box" memory entry item + */ + public static final String QTN_PHOB_LBL_POBOX = "P.O.Box"; + + /** + * Label text for "Extencion" memory entry item + */ + public static final String QTN_PHOB_LBL_EXTENCION = "Extension"; + + /** + * Label text for "Street" memory entry item + */ + public static final String QTN_PHOB_LBL_STREET = "Street"; + + /** + * Label text for "Postal code" memory entry item + */ + public static final String QTN_PHOB_LBL_POSTAL_CODE = "Postal code"; + + /** + * Label text for "City" memory entry item + */ + public static final String QTN_PHOB_LBL_CITY = "City"; + + /** + * Label text for "State" memory entry item + */ + public static final String QTN_PHOB_LBL_STATE = "State"; + + /** + * Label text for "Country" memory entry item + */ + public static final String QTN_PHOB_LBL_COUNTRY = "Country"; + + /** + * Label text for "Address (home)" memory entry item + */ + public static final String QTN_PHOB_LBL_ADDRESS_HOME = "Address (home)"; + + /** + * Label text for "P.O.Box (home)" memory entry item + */ + public static final String QTN_PHOB_LBL_POBOX_HOME = "P.O.Box (home)"; + + /** + * Label text for "Extencion (home)" memory entry item + */ + public static final String QTN_PHOB_LBL_EXTENCION_HOME = "Extension (home)"; + + /** + * Label text for "Street (home)" memory entry item + */ + public static final String QTN_PHOB_LBL_STREET_HOME = "Street (home)"; + + /** + * Label text for "Postal code (home)" memory entry item + */ + public static final String QTN_PHOB_LBL_POSTAL_CODE_HOME = "Postal code (home)"; + + /** + * Label text for "City (home)" memory entry item + */ + public static final String QTN_PHOB_LBL_CITY_HOME = "City (home)"; + + /** + * Label text for "State (home)" memory entry item + */ + public static final String QTN_PHOB_LBL_STATE_HOME = "State (home)"; + + /** + * Label text for "Country (home)" memory entry item + */ + public static final String QTN_PHOB_LBL_COUNTRY_HOME = "Country (home)"; + + /** + * Label text for "Address (work)" memory entry item + */ + public static final String QTN_PHOB_LBL_ADDRESS_WORK = "Address (work)"; + + /** + * Label text for "P.O.Box (work)" memory entry item + */ + public static final String QTN_PHOB_LBL_POBOX_WORK = "P.O.Box (work)"; + + /** + * Label text for "Extencion (work)" memory entry item + */ + public static final String QTN_PHOB_LBL_EXTENCION_WORK = "Extension (work)"; + + /** + * Label text for "Street (work)" memory entry item + */ + public static final String QTN_PHOB_LBL_STREET_WORK = "Street (work)"; + + /** + * Label text for "Postal code (work)" memory entry item + */ + public static final String QTN_PHOB_LBL_POSTAL_CODE_WORK = "Postal code (work)"; + + /** + * Label text for "City (work)" memory entry item + */ + public static final String QTN_PHOB_LBL_CITY_WORK = "City (work)"; + + /** + * Label text for "State (work)" memory entry item + */ + public static final String QTN_PHOB_LBL_STATE_WORK = "State (work)"; + + /** + * Label text for "Country (work)" memory entry item + */ + public static final String QTN_PHOB_LBL_COUNTRY_WORK = "Country (work)"; + + /** + * Label text for "DTMF String" memory entry item + */ + public static final String QTN_PHOB_LBL_DTMF = "DTMF"; + + /** + * Label text for "Date" memory entry item + */ + public static final String QTN_PHOB_LBL_DATE = "Birthday"; + + /** + * Memory entry item label "Anniversary" + */ + public static final String QTN_PHOB_LBL_ANNIVERSARY = "Anniversary"; + + /** + * Label text for "Note" memory entry item + */ + public static final String QTN_PHOB_LBL_NOTE = "Note"; + + /** + * Memory entry item label "Synchronization" + */ + public static final String QTN_PHOB_LBL_SYNCHRONIZATION = "Synchronization"; + + /** + * Label text for "thumbnail" memory entry item + */ + public static final String QTN_PHOB_LBL_THUMBNAILPATH = "Thumbnail path"; + + /** + * Label for Thumbnail ID, not existing value in S60 Device, only occurs in script mode. + */ + public static final String QTN_PHOB_LBL_THUMBNAILID = "Thumbnail ID"; + + + /** + * Label text for "Image" memory entry item + */ + public static final String QTN_PHOB_LBL_IMAGE = "Image"; + + /** + * Label text for "Text for call" memory entry item + */ + public static final String QTN_PHOB_LBL_TEXT = "Text for call"; + + /** + * Label text for "Personal Ringing Tone Indication" memory entry item + */ + public static final String QTN_PHOB_LBL_TONE = "Ring tone path"; + + // + //few items found also in VPbkEngFieldTypes.rss, but those cause Emulator to crash, so not taken into use + // + + /** + * Label text for Location privacy indicator, found in VPbkEngFieldTypes.rss + */ + public static final String R_VPBK_FIELD_TYPE_LOCPRIVACY = "Location privacy indicator"; + + /** + * Label text for Wv(IM) address, found in VPbkEngFieldTypes.rss + */ + public static final String R_VPBK_FIELD_TYPE_WVADDRESS = "Wv(IM) address"; + + private void init() { + + items = new LinkedHashMap(71); + + //First 10 items exist in same order that they appear in Device when creating new contact + + items.put("firstname", QTN_PHOB_LBL_FIRST_NAME); + items.put("lastname", QTN_PHOB_LBL_LAST_NAME); + items.put("mobilephonegen", QTN_PHOB_LBL_NUMBER_MOBILE); + items.put("landphonegen", QTN_PHOB_LBL_NUMBER_STANDARD); + items.put("emailgen", QTN_PHOB_LBL_EMAIL); + items.put("videonumbergen", QTN_PHOB_LBL_VIDEO); + items.put("voipgen", QTN_PHOB_LBL_VOIP); + items.put("poc", QTN_PHOB_LBL_POC); + items.put("company", QTN_PHOB_LBL_COMPANY_NAME); + items.put("jobtitle", QTN_PHOB_LBL_JOB_TITLE); + + items.put("note", QTN_PHOB_LBL_NOTE); + items.put("middlename", QTN_PHOB_LBL_MIDDLE_NAME); + items.put("secondname", QTN_SIMP_LBL_NICK); + + + items.put("prefix", QTN_PHOB_LBL_PREFIX); + items.put("suffix", QTN_PHOB_LBL_SUFFIX); + + items.put("addrlabelgen", QTN_PHOB_LBL_ADDRESS); + items.put("addrpogen", QTN_PHOB_LBL_POBOX); + items.put("addrextgen", QTN_PHOB_LBL_EXTENCION); + items.put("addrstreetgen", QTN_PHOB_LBL_STREET); + items.put("addrlocalgen", QTN_PHOB_LBL_CITY); + items.put("addrregiongen", QTN_PHOB_LBL_STATE); + items.put("addrpostcodegen", QTN_PHOB_LBL_POSTAL_CODE); + items.put("addrcountrygen", QTN_PHOB_LBL_COUNTRY); + + items.put("addrlabelhome", QTN_PHOB_LBL_ADDRESS_HOME); + items.put("addrpohome", QTN_PHOB_LBL_POBOX_HOME); + items.put("addrexthome", QTN_PHOB_LBL_EXTENCION_HOME); + items.put("addrstreethome", QTN_PHOB_LBL_STREET_HOME); + items.put("addrlocalhome", QTN_PHOB_LBL_CITY_HOME); + items.put("addrregionhome", QTN_PHOB_LBL_STATE_HOME); + items.put("addrpostcodehome", QTN_PHOB_LBL_POSTAL_CODE_HOME); + items.put("addrcountryhome", QTN_PHOB_LBL_COUNTRY_HOME); + + items.put("addrlabelwork", QTN_PHOB_LBL_ADDRESS_WORK); + items.put("addrpowork", QTN_PHOB_LBL_POBOX_WORK); + items.put("addrextwork", QTN_PHOB_LBL_EXTENCION_WORK); + items.put("addrstreetwork", QTN_PHOB_LBL_STREET_WORK); + items.put("addrlocalwork", QTN_PHOB_LBL_CITY_WORK); + items.put("addrregionwork", QTN_PHOB_LBL_STATE_WORK); + items.put("addrpostcodework", QTN_PHOB_LBL_POSTAL_CODE_WORK); + items.put("addrcountrywork", QTN_PHOB_LBL_COUNTRY_WORK); + + items.put("swis", QTN_PHOB_LBL_SWIS); + items.put("sip", QTN_PHOB_LBL_SIP); + items.put("dtmfstring", QTN_PHOB_LBL_DTMF); + items.put("department", QTN_PHOB_LBL_DEPT_NAME); + items.put("asstname", QTN_PHOB_LBL_ASSISTANT_NAME); + items.put("spouse", QTN_PHOB_LBL_SPOUSE); + items.put("children", QTN_PHOB_LBL_CHILDREN); + items.put("anniversary", QTN_PHOB_LBL_ANNIVERSARY); + items.put("synchronization", QTN_PHOB_LBL_SYNCHRONIZATION); + items.put("thumbnailpath", QTN_PHOB_LBL_THUMBNAILPATH); + items.put(THUMBNAILID_XML_ELEMENT, QTN_PHOB_LBL_THUMBNAILID); + items.put("callerobjtext",QTN_PHOB_LBL_TEXT); + items.put("ringtonepath",QTN_PHOB_LBL_TONE); + items.put("callerobjimg",QTN_PHOB_LBL_IMAGE); + items.put("birthday",QTN_PHOB_LBL_DATE); + + items.put("landphonehome", QTN_PHOB_LBL_NUMBER_HOME); + items.put("landphonework", QTN_PHOB_LBL_NUMBER_WORK); + + items.put("mobilephonehome", QTN_PHOB_LBL_NUMBER_MOBILE_HOME); + items.put("mobilephonework", QTN_PHOB_LBL_NUMBER_MOBILE_WORK); + + items.put("faxnumbergen", QTN_PHOB_LBL_FAX); + items.put("faxnumberhome", QTN_PHOB_LBL_FAX_HOME); + items.put("faxnumberwork", QTN_PHOB_LBL_FAX_WORK); + items.put("pagernumber", QTN_PHOB_LBL_PAGER); + + items.put("videonumberhome", QTN_PHOB_LBL_VIDEO_HOME); + items.put("videonumberwork", QTN_PHOB_LBL_VIDEO_WORK); + + items.put("voiphome", QTN_PHOB_LBL_VOIP_HOME); + items.put("voipwork", QTN_PHOB_LBL_VOIP_WORK); + + items.put("asstphone", QTN_PHOB_LBL_NUMBER_ASSISTANT); + items.put("carphone", QTN_PHOB_LBL_CAR_TEL); + + items.put("urlgen", QTN_PHOB_LBL_URL); + items.put("urlhome", QTN_PHOB_LBL_URL_HOME); + items.put("urlwork", QTN_PHOB_LBL_URL_WORK); + + items.put("emailhome", QTN_PHOB_LBL_EMAIL_HOME); + items.put("emailwork", QTN_PHOB_LBL_EMAIL_WORK); + + + //Following items not found in devices and causes emulator crash, can be taken into use if wanted + //items found in VPbkEngFieldTypes.rss + items.put("locprivacy",R_VPBK_FIELD_TYPE_LOCPRIVACY);//r_vpbk_field_type_locprivacy (Location privacy indicator) + items.put("wvaddress", R_VPBK_FIELD_TYPE_WVADDRESS);//R_VPBK_FIELD_TYPE_WVADDRESS (Wv(IM) address) + + } + + private void initFixedValues(){ + itemsValues = new LinkedHashMap(4); + itemsValues.put(THUMBNAILID_XML_ELEMENT, FileTypeVariables.ALL_PICTURE_FILE_TYPES_AS_COMMA_SEPARATED_STRING); + } + + /** + * Check if incvalueforeachcopy is supported for type. + * @param type as in UI, not as in XML. + * @return true if incvalueforeachcopy is supported. + */ + public boolean isTypeSupportingIncValueForEachCopy(String type) { + + //phone number + String id = getIdByValue(type); + if(id == null){ + return false; + } + + return id.contains(PHONE) || id.contains(NUMBER); + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/filetype/FileType.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/filetype/FileType.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,134 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.filetype; + + +import com.nokia.s60tools.creator.components.AbstractComponent; +import com.nokia.s60tools.creator.components.AbstractVariables; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + + +/** + * Class representing File + */ +public class FileType extends AbstractComponent { + + + public FileType(int id) { + super(id); + } + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.config.AbstractComponent#getType() + */ + public String getType() { + return CreatorEditorSettings.TYPE_FILE; + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#isValid() + */ + public boolean isValid() { + return true; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getIdByValue(java.lang.String) + */ + public String getIdByValue(String value) { + return FileTypeVariables.getInstance().getIdByValue(value); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValueById(java.lang.String) + */ + public String getValueById(String id) { + return FileTypeVariables.getInstance().getValueById(id); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getXMLElementName() + */ + public String getXMLElementName() { + return CreatorEditorSettings.TYPE_FILE_XML_ELEMENT; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValuesForItemType(java.lang.String) + */ + public String[] getValuesForItemType(String itemType) { + //If there is not this type of item at all + String idByValue = getIdByValue(itemType); + if(idByValue == null){ + return null; + } + return FileTypeVariables.getInstance().getValuesForItemType(idByValue); + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#itemMaxOccur(java.lang.String) + */ + public int itemMaxOccur(String itemName) { + return FileTypeVariables.getInstance().itemMaxOccur(itemName); + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getVariables() + */ + public AbstractVariables getVariables(){ + return FileTypeVariables.getInstance(); + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#hasTypeLimitationsForOtherValues(java.lang.String, java.lang.String) + */ + public boolean hasTypeLimitationsForOtherValues(String type, String value) { + if(type.equals(FileTypeVariables.ENCRYPTION_TYPE) ){ + return true; + } + else{ + return false; + } + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#isTypeDisabledByTypeAndValue(java.lang.String, java.lang.String, java.lang.String) + */ + public boolean isTypeDisabledByTypeAndValue(String selectedType, String selectedValue, String typeToDisable) { + if(selectedType == null || selectedValue == null || typeToDisable == null){ + return false; + } + else if(selectedType.equals(FileTypeVariables.ENCRYPTION_TYPE) && selectedValue.equals(FileTypeVariables.DRM_FL) && typeToDisable.startsWith(FileTypeVariables.DRM_CD)){ + return true; + } + else{ + return false; + } + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/filetype/FileTypeValue.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/filetype/FileTypeValue.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.filetype; + +import com.nokia.s60tools.creator.components.AbstractValue; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + +/** + * One row of data of file + */ +public class FileTypeValue extends AbstractValue { + + /** + * Creates new Value. + * @param value + * @param randomType + * @param amount + */ + public FileTypeValue(String value, ModeTypes randomType, int amount) { + this(); + setValue(value); + setModeType(randomType); + setAmount(amount); + } + + /** + * Creates new Value. + * @param value + * @param amount + */ + public FileTypeValue(String value, int amount) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(amount); + } + + + /** + * Creates new Value. + * + * @param value + * @param isRandom if false, random type is set to {@link ModeTypes#RandomTypeNotRandom} + * if true random type is set to {@link ModeTypes#RandomTypeDefaultLength} + * @param amount + */ + public FileTypeValue(String value, boolean isRandom, int amount) { + this(); + if(!isRandom){ + setModeType(ModeTypes.RandomTypeNotRandom); + } + else{ + setModeType(ModeTypes.RandomTypeDefaultLength); + } + setValue(value); + setAmount(amount); + } + + /** + * Creates new Value with no random and no amount. + * random value is set to {@link ModeTypes#RandomTypeNotRandom} and + * amount is set to 0. + * @param value + */ + public FileTypeValue(String value) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(0); + } + + /** + * Creates new Value. + * Attributes is set by default; + * - random value is set to {@link ModeTypes#RandomTypeDefaultLength} + * - random is set to true + * - value is set to EMPTY_STRING + * - amount is set to 0. + */ + public FileTypeValue() { + super(CreatorEditorSettings.TYPE_FILE); + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/filetype/FileTypeVariables.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/filetype/FileTypeVariables.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,349 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.filetype; + +import java.util.LinkedHashMap; + +import com.nokia.s60tools.creator.components.AbstractValue; +import com.nokia.s60tools.creator.components.AbstractVariables; + +/** + * Variables for file + */ +public class FileTypeVariables extends AbstractVariables { + + + /** + * UI text for "Encryption Type" + */ + public static final String ENCRYPTION_TYPE = "Encryption Type"; + + /** + * XML element "right" + */ + public static final String RIGHT_XML = "right"; + // + //Constants for UI, privates because of prefixes (Play, Print...) + // + private static final String ENDTIME = "Endtime"; + private static final String STARTTIME = "Starttime"; + private static final String ACCUMULATED = "Accumulated"; + private static final String INTERVAL = "Interval"; + private static final String COUNT = "Count"; + + + // + //constants for XML element names + // + public static final String COUNT_XML = "count"; + public static final String INTERVAL_XML = "interval"; + public static final String ENDTIME_XML = "endtime"; + public static final String STARTTIME_XML = "starttime"; + public static final String ACCUMULATED_XML = "accumulated"; + public static final String ENCRYPTION_TYPE_XML = "encryption"; + public static final String TYPE_XML = "type"; + + + // + //Constants for print + // + public static final String PRINT_TYPE = "print"; + public static final String PRINTINTERVAL = PRINT_TYPE + INTERVAL_XML; + public static final String PRINTENDTIME = PRINT_TYPE + ENDTIME_XML; + public static final String PRINTSTARTTIME = PRINT_TYPE + STARTTIME_XML; + public static final String PRINTCOUNT = PRINT_TYPE + COUNT_XML; + public static final String PRINTACCUMULATED = PRINT_TYPE + ACCUMULATED_XML; + + public static final String [][] PRINT_KEYS = {{ + PRINTCOUNT, PRINTINTERVAL, PRINTSTARTTIME, PRINTENDTIME, PRINTACCUMULATED + },{ + COUNT_XML, INTERVAL_XML, STARTTIME_XML, ENDTIME_XML, ACCUMULATED_XML + }}; + + // + //Constants for execute + // + public static final String EXECUTE_TYPE = "execute"; + public static final String EXECUTEINTERVAL = EXECUTE_TYPE + INTERVAL_XML; + public static final String EXECUTEENDTIME = EXECUTE_TYPE + ENDTIME_XML; + public static final String EXECUTESTARTTIME = EXECUTE_TYPE + STARTTIME_XML; + public static final String EXECUTECOUNT = EXECUTE_TYPE + COUNT_XML; + public static final String EXECUTEACCUMULATED = EXECUTE_TYPE + ACCUMULATED_XML; + public static final String [][] EXECUTE_KEYS = {{ + EXECUTECOUNT, EXECUTEINTERVAL, EXECUTESTARTTIME, EXECUTEENDTIME, EXECUTEACCUMULATED + },{ + COUNT_XML, INTERVAL_XML, STARTTIME_XML, ENDTIME_XML, ACCUMULATED_XML + }}; + + // + //Constants for display + // + public static final String DISPLAY_TYPE = "display"; + public static final String DISPLAYINTERVAL = DISPLAY_TYPE + INTERVAL_XML; + public static final String DISPLAYENDTIME = DISPLAY_TYPE + ENDTIME_XML; + public static final String DISPLAYSTARTTIME = DISPLAY_TYPE + STARTTIME_XML; + public static final String DISPLAYCOUNT = DISPLAY_TYPE + COUNT_XML; + public static final String DISPLAYACCUMULATED = DISPLAY_TYPE + ACCUMULATED_XML; + public static final String [][] DISPLAY_KEYS = {{ + DISPLAYCOUNT, DISPLAYINTERVAL, DISPLAYSTARTTIME, DISPLAYENDTIME, DISPLAYACCUMULATED + },{ + COUNT_XML, INTERVAL_XML, STARTTIME_XML, ENDTIME_XML, ACCUMULATED_XML + }}; + + // + //Constants for play + // + public static final String PLAY_TYPE = "play"; + public static final String PLAYINTERVAL = PLAY_TYPE + INTERVAL_XML; + public static final String PLAYENDTIME = PLAY_TYPE + ENDTIME_XML; + public static final String PLAYSTARTTIME = PLAY_TYPE + STARTTIME_XML; + public static final String PLAYCOUNT = PLAY_TYPE + COUNT_XML; + public static final String PLAYACCUMULATED = PLAY_TYPE + ACCUMULATED_XML; + public static final String [][] PLAY_KEYS = {{ + PLAYCOUNT, PLAYINTERVAL, PLAYSTARTTIME, PLAYENDTIME, PLAYACCUMULATED + },{ + COUNT_XML, INTERVAL_XML, STARTTIME_XML, ENDTIME_XML, ACCUMULATED_XML + }}; + + + /** + * Prefix for "DRM-CD" + */ + public static final String DRM_CD = "DRM-CD"; + /** + * Prefix for "DRM-FL" + */ + public static final String DRM_FL = "DRM-FL"; + + // + // Prefixes for DRM-CD variables + // + private static final String DRM_CD_PRINT = DRM_CD + " Print "; + private static final String DRM_CD_EXECUTE = DRM_CD + " Execute "; + private static final String DRM_CD_DISPLAY = DRM_CD + " Display "; + private static final String DRM_CD_PLAY = DRM_CD + " Play "; + + public static final String DURATIONS_HELP_TEXT = "For '" +ACCUMULATED + "' and '" +INTERVAL +"' -fields use format: " + +"P[n]Y[n]M[n]DT[n]H[n]M[n]S. Where P is start point for duration, Y stands for year, M for month, D for day, " + +"T is time part start point, H stands for hour, M for minute and S for second. " + +" E.g. P1Y2M3DT4H5M6S."; + + + private static FileTypeVariables instance; + + /** + * Get Singleton instance of variables + * @return + */ + public static FileTypeVariables getInstance() { + + if(instance == null){ + instance = new FileTypeVariables(); + } + + return instance; + } + + private FileTypeVariables(){ + init(); + initFixedValues(); + initMaxOccurValues(); + } + + public static final String TYPE = "Type"; + public static final String DIR = "Directory"; + public static final String [] ALL_FILE_TYPES_AS_COMMA_SEPARATED_STRING = {"3GPP-70kB", "AAC-100kB", "AMR-20kB", "XLS-15kB", "GIF-2kB", "JPEG-200kB", "JPEG-25kB", "JPEG-500kB", "MIDI-10kB", "MP3-250kB", "PNG-15kB", "PPT-40kB", "RM-95kB", "RNG-1kB", "TXT-10kB", "TXT-70kB", "WAV-20kB", "DOC-20kB", "SWF-15kB", "JAD-1kB", "JAR-10kB", "TIF-25kB", "MXMF-40kB", "BMP-25kB", "JP2-65kB", "SVG-15kB", "HTML-20kB", "VCF-1kB", "VCS-1kB", "MP4-200kB", "SISX-10kB", "RAM-1kB", "WMV-200kB", "WMA-50kB"}; + public static final String [] ALL_PICTURE_FILE_TYPES_AS_COMMA_SEPARATED_STRING = {"GIF-2kB", "JPEG-200kB", "JPEG-25kB", "JPEG-500kB", "PNG-15kB", "TIF-25kB", "BMP-25kB", "JP2-65kB", "SVG-15kB"}; + + private void init() { + + items = new LinkedHashMap(4); + items.put(TYPE_XML, TYPE); + items.put("directory", DIR); + + items.put(ENCRYPTION_TYPE_XML, ENCRYPTION_TYPE); + + items.put(PLAYCOUNT, DRM_CD_PLAY + COUNT); + items.put(PLAYSTARTTIME, DRM_CD_PLAY + STARTTIME); + items.put(PLAYENDTIME, DRM_CD_PLAY + ENDTIME); + items.put(PLAYINTERVAL, DRM_CD_PLAY + INTERVAL); + items.put(PLAYACCUMULATED, DRM_CD_PLAY + ACCUMULATED); + + items.put(DISPLAYCOUNT, DRM_CD_DISPLAY + COUNT); + items.put(DISPLAYSTARTTIME, DRM_CD_DISPLAY + STARTTIME); + items.put(DISPLAYENDTIME, DRM_CD_DISPLAY + ENDTIME); + items.put(DISPLAYINTERVAL, DRM_CD_DISPLAY + INTERVAL); + items.put(DISPLAYACCUMULATED, DRM_CD_DISPLAY + ACCUMULATED); + + items.put(EXECUTECOUNT, DRM_CD_EXECUTE + COUNT); + items.put(EXECUTESTARTTIME, DRM_CD_EXECUTE + STARTTIME); + items.put(EXECUTEENDTIME, DRM_CD_EXECUTE + ENDTIME); + items.put(EXECUTEINTERVAL, DRM_CD_EXECUTE + INTERVAL); + items.put(EXECUTEACCUMULATED, DRM_CD_EXECUTE + ACCUMULATED); + + items.put(PRINTCOUNT, DRM_CD_PRINT + COUNT); + items.put(PRINTSTARTTIME, DRM_CD_PRINT + STARTTIME); + items.put(PRINTENDTIME, DRM_CD_PRINT + ENDTIME); + items.put(PRINTINTERVAL, DRM_CD_PRINT + INTERVAL); + items.put(PRINTACCUMULATED, DRM_CD_PRINT + ACCUMULATED); + + + additionalItems = new LinkedHashMap(4); + additionalItems.put(COUNT_XML, COUNT_XML); + additionalItems.put(INTERVAL_XML, INTERVAL_XML); + additionalItems.put(ENDTIME_XML, ENDTIME_XML); + additionalItems.put(STARTTIME_XML, STARTTIME_XML); + additionalItems.put(ACCUMULATED_XML, ACCUMULATED_XML); + additionalItems.put(RIGHT_XML, RIGHT_XML); + + } + + /** + * Inits Max Occur valus for items + */ + private void initMaxOccurValues(){ + maxOccur = new LinkedHashMap(4); + + Integer integerOne = new Integer (1); + maxOccur.put(TYPE, integerOne );//Should it be able to add more than one file? If So, also S60 side must be changed. + maxOccur.put(DIR, integerOne ); + maxOccur.put(ENCRYPTION_TYPE, integerOne ); + + maxOccur.put( DRM_CD_PLAY + COUNT, integerOne ); + maxOccur.put( DRM_CD_PLAY + STARTTIME, integerOne ); + maxOccur.put( DRM_CD_PLAY + ENDTIME, integerOne ); + maxOccur.put( DRM_CD_PLAY + INTERVAL, integerOne ); + maxOccur.put( DRM_CD_PLAY + ACCUMULATED, integerOne ); + + maxOccur.put( DRM_CD_DISPLAY + COUNT, integerOne ); + maxOccur.put( DRM_CD_DISPLAY + STARTTIME, integerOne ); + maxOccur.put( DRM_CD_DISPLAY + ENDTIME, integerOne ); + maxOccur.put( DRM_CD_DISPLAY + INTERVAL, integerOne ); + maxOccur.put( DRM_CD_DISPLAY + ACCUMULATED, integerOne ); + + maxOccur.put( DRM_CD_EXECUTE + COUNT, integerOne ); + maxOccur.put( DRM_CD_EXECUTE + STARTTIME, integerOne ); + maxOccur.put( DRM_CD_EXECUTE + ENDTIME, integerOne ); + maxOccur.put( DRM_CD_EXECUTE + INTERVAL, integerOne ); + maxOccur.put( DRM_CD_EXECUTE + ACCUMULATED, integerOne ); + + maxOccur.put( DRM_CD_PRINT + COUNT, integerOne ); + maxOccur.put( DRM_CD_PRINT + STARTTIME, integerOne ); + maxOccur.put( DRM_CD_PRINT + ENDTIME, integerOne ); + maxOccur.put( DRM_CD_PRINT + INTERVAL, integerOne ); + maxOccur.put( DRM_CD_PRINT + ACCUMULATED, integerOne ); + } + + /** + * Check if this key is a encryption value + * @param key (not a XML key but UI key) + * @return + */ + public static boolean isEncryptionValue(String key){ + return key.startsWith(DRM_CD); + } + + private void initFixedValues(){ + itemsValues = new LinkedHashMap(4); + + //For enabling creation of empty type (then directory will be created) we first add a empty slot for list + String [] items = new String[ALL_FILE_TYPES_AS_COMMA_SEPARATED_STRING.length + 1]; + items [0] = AbstractValue.EMPTY_STRING; + for (int i = 1; i < items.length; i++) { + items[i] = ALL_FILE_TYPES_AS_COMMA_SEPARATED_STRING[i - 1]; + } + + itemsValues.put(TYPE_XML, items); + + + itemsValues.put(ENCRYPTION_TYPE_XML, new String[] {DRM_FL, DRM_CD}); + + } + + protected AbstractVariables getInstanceImpl() { + return instance; + } + + /** + * Get ID used in editor to <[element]> + * @param rightType + * @param elementName + * @return Interal ID for <[element]> + */ + public static String getEncryptionId(String rightType, String elementName) { + + if(rightType.equalsIgnoreCase(DISPLAY_TYPE)){ + return getEncryptionElemnInternalId(DISPLAY_TYPE, elementName); + } + else if(rightType.equalsIgnoreCase(PLAY_TYPE)){ + return getEncryptionElemnInternalId(PLAY_TYPE, elementName); + } + else if(rightType.equalsIgnoreCase(EXECUTE_TYPE)){ + return getEncryptionElemnInternalId(EXECUTE_TYPE, elementName); + } + else if(rightType.equalsIgnoreCase(PRINT_TYPE)){ + return getEncryptionElemnInternalId(PRINT_TYPE, elementName); + } + + return null; + } + + /** + * Get id for encryption element used only in object model, not in XML + * @param type + * @param elemn + * @return id + */ + private static String getEncryptionElemnInternalId(String type, String elemn){ + + + if(elemn.equalsIgnoreCase(COUNT_XML)){ + return type + COUNT_XML; + } + else if(elemn.equalsIgnoreCase(INTERVAL_XML)){ + return type + INTERVAL_XML; + } + else if(elemn.equalsIgnoreCase(ENDTIME_XML)){ + return type + ENDTIME_XML; + } + else if(elemn.equalsIgnoreCase(STARTTIME_XML)){ + return type + STARTTIME_XML; + } + else if(elemn.equalsIgnoreCase(ACCUMULATED_XML)){ + return type + ACCUMULATED_XML; + } + else{ + return null; + } + + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractVariables#isModeEnabledForKey(java.lang.String) + */ + public boolean isModeEnabledForKey(String key) { + if(key != null && key.equals(ENCRYPTION_TYPE)){ + return false; + } + else{ + return true; + } + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/impsserver/IMPSServer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/impsserver/IMPSServer.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.impsserver; + + +import com.nokia.s60tools.creator.components.AbstractComponent; +import com.nokia.s60tools.creator.components.AbstractVariables; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + + +/** + * Class representing IMPS Server + */ +public class IMPSServer extends AbstractComponent { + + + public IMPSServer(int id) { + super(id); + } + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.config.AbstractComponent#getType() + */ + public String getType() { + return CreatorEditorSettings.TYPE_IMPS_SERVER; + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#isValid() + */ + public boolean isValid() { + return true; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getIdByValue(java.lang.String) + */ + public String getIdByValue(String value) { + return IMPSServerVariables.getInstance().getIdByValue(value); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValueById(java.lang.String) + */ + public String getValueById(String id) { + return IMPSServerVariables.getInstance().getValueById(id); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getXMLElementName() + */ + public String getXMLElementName() { + return CreatorEditorSettings.TYPE_IMPS_SERVER_XML_ELEMENT; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValuesForItemType(java.lang.String) + */ + public String[] getValuesForItemType(String itemType) { + //If there is not this type of item at all + String idByValue = getIdByValue(itemType); + if(idByValue == null){ + return null; + } + return IMPSServerVariables.getInstance().getValuesForItemType(idByValue); + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getVariables() + */ + public AbstractVariables getVariables(){ + return IMPSServerVariables.getInstance(); + } +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/impsserver/IMPSServerValue.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/impsserver/IMPSServerValue.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.impsserver; + +import com.nokia.s60tools.creator.components.AbstractValue; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + +/** + * One row of data of IMPS Server + */ +public class IMPSServerValue extends AbstractValue { + + /** + * Creates new Value. + * @param value + * @param randomType + * @param amount + */ + public IMPSServerValue(String value, ModeTypes randomType, int amount) { + this(); + setValue(value); + setModeType(randomType); + setAmount(amount); + } + + /** + * Creates new Value. + * @param value + * @param amount + */ + public IMPSServerValue(String value, int amount) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(amount); + } + + + /** + * Creates new Value. + * + * @param value + * @param isRandom if false, random type is set to {@link ModeTypes#RandomTypeNotRandom} + * if true random type is set to {@link ModeTypes#RandomTypeDefaultLength} + * @param amount + */ + public IMPSServerValue(String value, boolean isRandom, int amount) { + this(); + if(!isRandom){ + setModeType(ModeTypes.RandomTypeNotRandom); + } + else{ + setModeType(ModeTypes.RandomTypeDefaultLength); + } + setValue(value); + setAmount(amount); + } + + /** + * Creates new Value with no random and no amount. + * random value is set to {@link ModeTypes#RandomTypeNotRandom} and + * amount is set to 0. + * @param value + */ + public IMPSServerValue(String value) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(0); + } + + /** + * Creates new Value. + * Attributes is set by default; + * - random value is set to {@link ModeTypes#RandomTypeDefaultLength} + * - random is set to true + * - value is set to EMPTY_STRING + * - amount is set to 0. + */ + public IMPSServerValue() { + super(CreatorEditorSettings.TYPE_IMPS_SERVER); + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/impsserver/IMPSServerVariables.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/impsserver/IMPSServerVariables.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.impsserver; + +import java.util.LinkedHashMap; + +import com.nokia.s60tools.creator.components.AbstractVariables; + +/** + * Variables for IMPS server + */ +public class IMPSServerVariables extends AbstractVariables { + + + private static IMPSServerVariables instance; + + /** + * Get Singleton instance of variables + * @return + */ + public static IMPSServerVariables getInstance() { + + if(instance == null){ + instance = new IMPSServerVariables(); + } + + return instance; + } + + private IMPSServerVariables(){ + init(); + } + + // + // Variables to show items in UI + // + public static final String NAME = "Name"; + public static final String URL = "URL"; + public static final String USERNAME = "Username"; + public static final String PASSWORD = "Password"; + public static final String CONNECTION_METHOD_NAME = "Connection method name"; + + private void init() { + + items = new LinkedHashMap(5); + items.put("name",NAME); + items.put("url",URL); + items.put("username",USERNAME); + items.put("password",PASSWORD); + items.put("connectionmethodname",CONNECTION_METHOD_NAME); + } + + protected AbstractVariables getInstanceImpl() { + return instance; + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/landmark/Landmark.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/landmark/Landmark.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.landmark; + + +import com.nokia.s60tools.creator.components.AbstractComponent; +import com.nokia.s60tools.creator.components.AbstractVariables; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + + +/** + * Class representing landmark + */ +public class Landmark extends AbstractComponent { + + + public Landmark(int id) { + super(id); + } + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.config.AbstractComponent#getType() + */ + public String getType() { + return CreatorEditorSettings.TYPE_LANDMARK; + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#isValid() + */ + public boolean isValid() { + return true; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getIdByValue(java.lang.String) + */ + public String getIdByValue(String value) { + return LandmarkVariables.getInstance().getIdByValue(value); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValueById(java.lang.String) + */ + public String getValueById(String id) { + return LandmarkVariables.getInstance().getValueById(id); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getXMLElementName() + */ + public String getXMLElementName() { + return CreatorEditorSettings.TYPE_LANDMARK_XML_ELEMENT; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValuesForItemType(java.lang.String) + */ + public String[] getValuesForItemType(String itemType) { + //If there is not this type of item at all + String idByValue = getIdByValue(itemType); + if(idByValue == null){ + return null; + } + return LandmarkVariables.getInstance().getValuesForItemType(idByValue); + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#itemMaxOccur(java.lang.String) + */ + public int itemMaxOccur(String itemName) { + return LandmarkVariables.getInstance().itemMaxOccur(itemName); + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getVariables() + */ + public AbstractVariables getVariables(){ + return LandmarkVariables.getInstance(); + } +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/landmark/LandmarkValue.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/landmark/LandmarkValue.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.landmark; + +import com.nokia.s60tools.creator.components.AbstractValue; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + +/** + * One row of data of landmark + */ +public class LandmarkValue extends AbstractValue { + + /** + * Creates new Value. + * @param value + * @param randomType + * @param amount + */ + public LandmarkValue(String value, ModeTypes randomType, int amount) { + this(); + setValue(value); + setModeType(randomType); + setAmount(amount); + } + + /** + * Creates new Value. + * @param value + * @param amount + */ + public LandmarkValue(String value, int amount) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(amount); + } + + + /** + * Creates new Value. + * + * @param value + * @param isRandom if false, random type is set to {@link ModeTypes#RandomTypeNotRandom} + * if true random type is set to {@link ModeTypes#RandomTypeDefaultLength} + * @param amount + */ + public LandmarkValue(String value, boolean isRandom, int amount) { + this(); + if(!isRandom){ + setModeType(ModeTypes.RandomTypeNotRandom); + } + else{ + setModeType(ModeTypes.RandomTypeDefaultLength); + } + setValue(value); + setAmount(amount); + } + + /** + * Creates new Value with no random and no amount. + * random value is set to {@link ModeTypes#RandomTypeNotRandom} and + * amount is set to 0. + * @param value + */ + public LandmarkValue(String value) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(0); + } + + /** + * Creates new Value. + * Attributes is set by default; + * - random value is set to {@link ModeTypes#RandomTypeDefaultLength} + * - random is set to true + * - value is set to EMPTY_STRING + * - amount is set to 0. + */ + public LandmarkValue() { + super(CreatorEditorSettings.TYPE_LOG); + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/landmark/LandmarkVariables.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/landmark/LandmarkVariables.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.landmark; + +import java.util.HashMap; +import java.util.LinkedHashMap; + +import com.nokia.s60tools.creator.components.AbstractVariables; + +/** + * Variables for landmark + */ +public class LandmarkVariables extends AbstractVariables { + + // + // Variables to show items in UI + // + public static final String POSTAL_ZIP = "Postal code/ZIP"; + public static final String CITY = "City"; + public static final String STATE_PROVINCE = "State/Province"; + public static final String COUNTRY_REGION = "Country/Region"; + public static final String PHONE_NUMBER = "Phone number"; + public static final String URL = "URL"; + public static final String LATITUDE = "Latitude"; + public static final String LONGITUDE = "Longitude"; + public static final String POSITION_ACCURACY = "Position accuracy"; + public static final String STREET = "Street"; + public static final String DESCRIPTION = "Description"; + public static final String CATEGORY = "Category"; + public static final String NAME = "Name"; + public static final String ALTITUDE = "Altitude"; + public static final String ALTITUDE_ACCURACY = "Altitude accuracy"; + + private static LandmarkVariables instance; + + /** + * Get Singleton instance of variables + * @return + */ + public static LandmarkVariables getInstance() { + + if(instance == null){ + instance = new LandmarkVariables(); + } + + return instance; + } + + private LandmarkVariables(){ + init(); + initMaxOccurValues(); + initTipTexts(); + } + + + + + private void init() { + + items = new LinkedHashMap(4); + items.put("name",NAME); + items.put("category",CATEGORY); + items.put("description",DESCRIPTION); + items.put("street",STREET); + items.put("postalcode",POSTAL_ZIP); + items.put("city",CITY); + items.put("state",STATE_PROVINCE); + items.put("country",COUNTRY_REGION); + items.put("phonenbr",PHONE_NUMBER); + items.put("url",URL); + items.put("latitude",LATITUDE); + items.put("longitude",LONGITUDE); + items.put("positionaccuracy",POSITION_ACCURACY); + items.put("altitude",ALTITUDE); + items.put("altitudeaccuracy",ALTITUDE_ACCURACY); + + } + + /** + * Inits Max Occur valus for items. + * Only {@link LandmarkVariables#CATEGORY} can occur more than once in on script. + */ + private void initMaxOccurValues() { + maxOccur = new LinkedHashMap(4); + + Integer integerOne = new Integer(1); + + // On landmarks, only CATEGORY can occur more than once in on script + + maxOccur.put(NAME, integerOne); + maxOccur.put(DESCRIPTION, integerOne); + maxOccur.put(STREET, integerOne); + maxOccur.put(POSTAL_ZIP, integerOne); + maxOccur.put(CITY, integerOne); + maxOccur.put(STATE_PROVINCE, integerOne); + maxOccur.put(COUNTRY_REGION, integerOne); + maxOccur.put(PHONE_NUMBER, integerOne); + maxOccur.put(URL, integerOne); + maxOccur.put(LATITUDE, integerOne); + maxOccur.put(LONGITUDE, integerOne); + maxOccur.put(POSITION_ACCURACY, integerOne); + maxOccur.put(ALTITUDE, integerOne); + maxOccur.put(ALTITUDE_ACCURACY, integerOne); + } + + private void initTipTexts(){ + tipTexts = new HashMap(); + + String altitudeTipText = "Altitude in meters"; + + String accuracyTipText = "Accuracy in meters"; + tipTexts.put(POSITION_ACCURACY, accuracyTipText); + tipTexts.put(ALTITUDE, altitudeTipText); + tipTexts.put(ALTITUDE_ACCURACY, accuracyTipText); + } + + protected AbstractVariables getInstanceImpl() { + return instance; + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/log/Log.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/log/Log.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.log; + + +import com.nokia.s60tools.creator.components.AbstractComponent; +import com.nokia.s60tools.creator.components.AbstractVariables; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + + +/** + * Class representing log + */ +public class Log extends AbstractComponent { + + + public Log(int id) { + super(id); + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.config.AbstractComponent#getType() + */ + public String getType() { + return CreatorEditorSettings.TYPE_LOG; + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#isValid() + */ + public boolean isValid() { + return true; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getIdByValue(java.lang.String) + */ + public String getIdByValue(String value) { + return LogVariables.getInstance().getIdByValue(value); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValueById(java.lang.String) + */ + public String getValueById(String id) { + return LogVariables.getInstance().getValueById(id); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getXMLElementName() + */ + public String getXMLElementName() { + return CreatorEditorSettings.TYPE_LOG_XML_ELEMENT; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValuesForItemType(java.lang.String) + */ + public String[] getValuesForItemType(String itemType) { + //If there is not this type of item at all + String idByValue = getIdByValue(itemType); + if(idByValue == null){ + return null; + } + return LogVariables.getInstance().getValuesForItemType(idByValue); + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#isTypeSupportingIncValueForEachCopy(java.lang.String) + */ + public boolean isTypeSupportingIncValueForEachCopy(String type) { + + return LogVariables.getInstance().isTypeSupportingIncValueForEachCopy(type); + + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getVariables() + */ + public AbstractVariables getVariables(){ + return LogVariables.getInstance(); + } +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/log/LogValue.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/log/LogValue.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.log; + +import com.nokia.s60tools.creator.components.AbstractValue; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + +/** + * One row of data of log + */ +public class LogValue extends AbstractValue { + + /** + * Creates new Value. + * @param value + * @param randomType + * @param amount + */ + public LogValue(String value, ModeTypes randomType, int amount) { + this(); + setValue(value); + setModeType(randomType); + setAmount(amount); + } + + /** + * Creates new Value. + * @param value + * @param amount + */ + public LogValue(String value, int amount) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(amount); + } + + + /** + * Creates new Value. + * + * @param value + * @param isRandom if false, random type is set to {@link ModeTypes#RandomTypeNotRandom} + * if true random type is set to {@link ModeTypes#RandomTypeDefaultLength} + * @param amount + */ + public LogValue(String value, boolean isRandom, int amount) { + this(); + if(!isRandom){ + setModeType(ModeTypes.RandomTypeNotRandom); + } + else{ + setModeType(ModeTypes.RandomTypeDefaultLength); + } + setValue(value); + setAmount(amount); + } + + /** + * Creates new Value with no random and no amount. + * random value is set to {@link ModeTypes#RandomTypeNotRandom} and + * amount is set to 0. + * @param value + */ + public LogValue(String value) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(0); + } + + /** + * Creates new Value. + * Attributes is set by default; + * - random value is set to {@link ModeTypes#RandomTypeDefaultLength} + * - random is set to true + * - value is set to EMPTY_STRING + * - amount is set to 0. + */ + public LogValue() { + super(CreatorEditorSettings.TYPE_LOG); + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/log/LogVariables.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/log/LogVariables.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.log; + +import java.util.LinkedHashMap; + +import com.nokia.s60tools.creator.components.AbstractVariables; + +/** + * Variables for log + */ +public class LogVariables extends AbstractVariables { + + + private static final String DIRECTION_XML = "direction"; + private static LogVariables instance; + + /** + * Get Singleton instance of variables + * @return + */ + public static LogVariables getInstance() { + + if(instance == null){ + instance = new LogVariables(); + } + + return instance; + } + + private LogVariables(){ + init(); + initFixedValues(); + } + + // + // Variables to show items in UI + // + public static final String DIRECTION = "Direction"; + public static final String DURATION = "Duration"; + public static final String PHONENUMBER = "Phone number"; + public static final String DATETIME = "Datetime"; + + /** + * Direction fixed values + */ + public static final String [] ALL_DIRECTION_TYPES_AS_COMMA_SEPARATED_STRING = {"missed", "in", "out"}; + + private void init() { + + items = new LinkedHashMap(4); + items.put(DIRECTION_XML,DIRECTION); + items.put("duration",DURATION); + items.put("phonenumber",PHONENUMBER); + items.put("datetime",DATETIME); + + } + private void initFixedValues(){ + itemsValues = new LinkedHashMap(4); + + itemsValues.put(DIRECTION_XML, ALL_DIRECTION_TYPES_AS_COMMA_SEPARATED_STRING); + + + } + + protected AbstractVariables getInstanceImpl() { + return instance; + } + + /** + * Check if incvalueforeachcopy is supported for type. + * @param type as in UI, not as in XML. + * @return true if incvalueforeachcopy is supported. + */ + public boolean isTypeSupportingIncValueForEachCopy(String type) { + + if(type == null){ + return false; + } + + return type.equals(PHONENUMBER); + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/messaging/MailBox.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/messaging/MailBox.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.messaging; + + +import com.nokia.s60tools.creator.components.AbstractComponent; +import com.nokia.s60tools.creator.components.AbstractVariables; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + + +/** + * Class representing mailbox + */ +public class MailBox extends AbstractComponent { + + + public MailBox(int id, String type) { + this(id); + setMailBoxType(type); + } + + public MailBox(int id) { + super(id); + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.config.AbstractComponent#getType() + */ + public String getType() { + return CreatorEditorSettings.TYPE_MAIL_BOX; + } + + /** + * Get type for this MailBox + * @return + */ + public String getMailBoxType() { + return getAdditionalParameter(TYPE_PARAMETER_ID); + } + + + + /** + * Set event type for this MailBox + * @param type + */ + public void setMailBoxType(String type) { + addAdditionalParameter(TYPE_PARAMETER_ID, type); + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#isValid() + */ + public boolean isValid() { + return true; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getIdByValue(java.lang.String) + */ + public String getIdByValue(String value) { + return MailBoxVariables.getInstance().getIdByValue(value); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValueById(java.lang.String) + */ + public String getValueById(String id) { + return MailBoxVariables.getInstance().getValueById(id); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getXMLElementName() + */ + public String getXMLElementName() { + return CreatorEditorSettings.TYPE_MAIL_BOX_XML_ELEMENT; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValuesForItemType(java.lang.String) + */ + public String[] getValuesForItemType(String itemType) { + //If there is not this type of item at all + String idByValue = getIdByValue(itemType); + if(idByValue == null){ + return null; + } + return MailBoxVariables.getInstance().getValuesForItemType(idByValue); + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#itemMaxOccur(java.lang.String) + */ + public int itemMaxOccur(String itemName) { + return MailBoxVariables.getInstance().itemMaxOccur(itemName); + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getVariables() + */ + public AbstractVariables getVariables(){ + return MailBoxVariables.getInstance(); + } +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/messaging/MailBoxValue.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/messaging/MailBoxValue.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.messaging; + +import com.nokia.s60tools.creator.components.AbstractValue; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + +/** + * One row of data of mailbox + */ +public class MailBoxValue extends AbstractValue { + + /** + * Creates new Value. + * @param value + * @param randomType + * @param amount + */ + public MailBoxValue(String value, ModeTypes randomType, int amount) { + this(); + setValue(value); + setModeType(randomType); + setAmount(amount); + } + + /** + * Creates new Value. + * @param value + * @param amount + */ + public MailBoxValue(String value, int amount) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(amount); + } + + + /** + * Creates new Value. + * + * @param value + * @param isRandom if false, random type is set to {@link ModeTypes#RandomTypeNotRandom} + * if true random type is set to {@link ModeTypes#RandomTypeDefaultLength} + * @param amount + */ + public MailBoxValue(String value, boolean isRandom, int amount) { + this(); + if(!isRandom){ + setModeType(ModeTypes.RandomTypeNotRandom); + } + else{ + setModeType(ModeTypes.RandomTypeDefaultLength); + } + setValue(value); + setAmount(amount); + } + + /** + * Creates new Value with no random and no amount. + * random value is set to {@link ModeTypes#RandomTypeNotRandom} and + * amount is set to 0. + * @param value + */ + public MailBoxValue(String value) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(0); + } + + /** + * Creates new Value. + * Attributes is set by default; + * - random value is set to {@link ModeTypes#RandomTypeDefaultLength} + * - random is set to true + * - value is set to EMPTY_STRING + * - amount is set to 0. + */ + public MailBoxValue() { + super(CreatorEditorSettings.TYPE_MAIL_BOX); + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/messaging/MailBoxVariables.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/messaging/MailBoxVariables.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,318 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.messaging; + +import java.util.LinkedHashMap; + +import com.nokia.s60tools.creator.components.AbstractComponent; +import com.nokia.s60tools.creator.components.AbstractVariables; + +/** + * Variables for mailbox + */ +public class MailBoxVariables extends AbstractVariables { + + // + // Variables to show items in UI + // + private static final String TO_CC_INCLUDE_LIMIT = "TO/CC include limit"; + private static final String SMTP_AUTHENTICATION = "SMTP authentication"; + private static final String REPLYTO_ADDRESS = "Replyto address"; + private static final String RECEIPT_ADDRESS = "Receipt address"; + private static final String EMAIL_ALIAS = "Email alias"; + private static final String OUTGOING_SERVER_NAME = "Outgoing server name"; + private static final String OUTGOING_PASSWORD = "Outgoing password"; + private static final String OUTGOING_LOGIN_NAME = "Outgoing login name"; + private static final String OUTGOING_PORT = "Outgoing port"; + private static final String SYNC_RATE = "Sync rate"; + private static final String MAX_EMAIL_SIZE = "Max email size"; + private static final String IMAP_IDLE_TIMEOUT = "Imap idle timeout"; + private static final String PATH_SEPARATOR = "Path separator"; + private static final String INCOMING_FOLDER_PATH = "Incoming folder path"; + private static final String ATTACHMENT_FETCH_SIZE = "Attachment fetch size"; + private static final String BODY_TEXT_SIZE_LIMIT = "Body text size limit"; + private static final String ATTACHMENT_SIZE_LIMIT = "Attachment size limit"; + private static final String INCOMING_SERVER_NAME = "Incoming server name"; + private static final String INCOMING_PASSWORD = "Incoming password"; + private static final String INCOMING_LOGINNAME = "Incoming loginname"; + private static final String INCOMING_PORT = "Incoming port"; + + // + // XML element names + // + private static final String SEND_OPTION_XML = "sendoption"; + private static final String COPY_TO_SELF_XML = "copytoself"; + private static final String FOLDER_SYNC_TYPE_XML = "foldersynctype"; + private static final String SUBSCRIBE_TYPE_XML = "subscribetype"; + private static final String GET_EMAIL_OPTIONS_XML = "getemailoptions"; + + // + // Fixed variables for certain item in UI + // + public static final String [] POSSIBLE_VALUES_FOR_GET_EMAIL_OPTIONS = {"getheaders", "getbodytext", "getbodytextandattachments", "getattachments", "getbodyalternativetext"}; + public static final String [] POSSIBLE_VALUES_FOR_SUBSCRIBE_TYPE = {"updateneither", "updatelocal", "updateremote", "updateboth"}; + public static final String [] POSSIBLE_VALUES_FOR_FOLDER_SYNC_TYPE = {"usecombination", "uselocal", "useremote"}; + public static final String [] POSSIBLE_VALUES_FOR_COPY_TO_SELF = {"no", "to", "cc", "bcc"}; + public static final String [] POSSIBLE_VALUES_FOR_SEND_OPTION = {"immediately", "onnextconnection", "onrequest"}; + + + // + // XML element names, not needed outside of this class + // + + private static final String REQUEST_RECEIPTS_XML = "requestreceipts"; + private static final String OUTGOING_SSL_WRAPPER_XML = "outgoingsslwrapper"; + private static final String OUTGOING_SECURE_SOCKETS_XML = "outgoingsecuresockets"; + private static final String ADD_VCARD_XML = "addvcard"; + private static final String DISCONNECTED_USER_MODE_XML = "disconnectedusermode"; + private static final String ENABLE_EXPUNGE_MODE_XML = "enableexpungemode"; + private static final String MARK_SEEN_IN_SYNC_XML = "markseeninsync"; + private static final String IMAP_IDLE_COMMAND_XML = "imapidlecommand"; + private static final String DELETE_MAILS_AT_DISCONNECT_XML = "deletemailsatdisconnect"; + private static final String AUTOSEND_ON_CONNECT_XML = "autosendonconnect"; + private static final String ACKNOWLEDGE_RECEIPTS_XML = "acknowledgereceipts"; + private static final String USE_APOP_SECURE_LOGIN_XML = "useapopsecurelogin"; + private static final String INCOMING_SSL_WRAPPER_XML = "incomingsslwrapper"; + private static final String INCOMINGSECURESOCKETS_XML = "incomingsecuresockets"; + + + // + // Variables to show items in UI + // + public static final String SEND_OPTION = "Send option"; + public static final String FOLDER_SYNC_TYPE = "Folder sync type"; + public static final String SUBSCRIBE_TYPE = "Subscribe type"; + public static final String MAILBOX_SYNC_LIMIT = "Mailbox sync limit"; + public static final String INBOX_SYNC_LIMIT = "Inbox sync limit"; + public static final String GET_EMAIL_OPTIONS = "Get email options"; + public static final String OUTGOING_CONNECTIONMETHOD_NAME = "Outgoing connectionmethod name"; + public static final String INCOMING_CONNECTIONMETHOD_NAME = "Incoming connectionmethod name"; + public static final String REQUEST_RECEIPTS = "Request receipts"; + public static final String OUTGOING_SSL_WRAPPER = "Outgoing SSL wrapper"; + public static final String OUTGOING_SECURE_SOCKETS = "Outgoing secure sockets"; + public static final String ADD_VCARD = "Add vcard"; + public static final String DISCONNECTED_USER_MODE = "Disconnected user mode"; + public static final String ENABLE_EXPUNGE_MODE = "Enable EXPUNGE mode"; + public static final String MARK_SEEN_IN_SYNC = "Mark seen in sync"; + public static final String IMAP_IDLE_COMMAND = "Imap idle command"; + public static final String DELETE_MAILS_AT_DISCONNECT = "Delete mails at disconnect"; + public static final String AUTOSEND_ON_CONNECT = "Autosend on connect"; + public static final String ACKNOWLEDGE_RECEIPTS = "Acknowledge receipts"; + public static final String INCOMING_SSL_WRAPPER = "Incoming SSL wrapper"; + public static final String INCOMING_SECURE_SOCKETS = "Incoming secure sockets"; + public static final String OWN_EMAIL = "Own email"; + public static final String COPY_TO_SELF = "Copy to self"; + public static final String USE_APOP_SECURE_LOGIN = "Use APOP secure login"; + public static final String NAME = "Name"; + public static final String CONNECTION_METHOD_NAME = "Connection method name"; + + + + + /** + * Only instance of this class + */ + private static MailBoxVariables instance; + + + /** + * Get Singleton instance of variables + * @return + */ + public static MailBoxVariables getInstance() { + + if(instance == null){ + instance = new MailBoxVariables(); + } + + return instance; + } + + /** + * Private contruction + */ + private MailBoxVariables(){ + init(); + initFixedValues(); + initMaxOccurValues(); + } + + // + //TYPES of mail box + // + private static final String TYPE = "Type"; + private static final String TYPE_POP3 = "POP3"; + private static final String TYPE_IMAP = "IMAP4"; + private static final String TYPE_SYNCML = "SyncML"; + + private void init() { + + items = new LinkedHashMap(14); + + items.put("name",NAME); + items.put("ownemail",OWN_EMAIL); + items.put(COPY_TO_SELF_XML,COPY_TO_SELF); + items.put(USE_APOP_SECURE_LOGIN_XML,USE_APOP_SECURE_LOGIN); + + items.put("incomingport", INCOMING_PORT); + items.put(INCOMING_SSL_WRAPPER_XML, INCOMING_SSL_WRAPPER); + items.put(INCOMINGSECURESOCKETS_XML, INCOMING_SECURE_SOCKETS); + items.put("incomingloginname", INCOMING_LOGINNAME); + items.put("incomingpassword", INCOMING_PASSWORD); + items.put("incomingservername", INCOMING_SERVER_NAME); + items.put("incomingconnectionmethod", INCOMING_CONNECTIONMETHOD_NAME); + items.put(ACKNOWLEDGE_RECEIPTS_XML, ACKNOWLEDGE_RECEIPTS); + items.put("attachmentsizelimit", ATTACHMENT_SIZE_LIMIT); + items.put(AUTOSEND_ON_CONNECT_XML, AUTOSEND_ON_CONNECT); + items.put("bodytextsizelimit", BODY_TEXT_SIZE_LIMIT); + items.put(DELETE_MAILS_AT_DISCONNECT_XML, DELETE_MAILS_AT_DISCONNECT); + items.put("attachmentfetchsize", ATTACHMENT_FETCH_SIZE); + items.put("incomingfolderpath", INCOMING_FOLDER_PATH); + items.put("pathseparator", PATH_SEPARATOR); + items.put(GET_EMAIL_OPTIONS_XML, GET_EMAIL_OPTIONS); + items.put(IMAP_IDLE_COMMAND_XML, IMAP_IDLE_COMMAND); + items.put("imapidletimeout", IMAP_IDLE_TIMEOUT); + items.put("maxemailsize", MAX_EMAIL_SIZE); + items.put(SUBSCRIBE_TYPE_XML, SUBSCRIBE_TYPE); + items.put("syncrate", SYNC_RATE); + items.put(FOLDER_SYNC_TYPE_XML, FOLDER_SYNC_TYPE); + items.put(MARK_SEEN_IN_SYNC_XML, MARK_SEEN_IN_SYNC); + items.put(ENABLE_EXPUNGE_MODE_XML, ENABLE_EXPUNGE_MODE); + items.put("inboxsynclimit", INBOX_SYNC_LIMIT); + items.put("mailboxsynclimit", MAILBOX_SYNC_LIMIT); + items.put(DISCONNECTED_USER_MODE_XML, DISCONNECTED_USER_MODE); + items.put("outgoingport", OUTGOING_PORT); + items.put(OUTGOING_SSL_WRAPPER_XML, OUTGOING_SSL_WRAPPER); + items.put(OUTGOING_SECURE_SOCKETS_XML, OUTGOING_SECURE_SOCKETS); + items.put("outgoingloginname", OUTGOING_LOGIN_NAME); + items.put("outgoingpassword", OUTGOING_PASSWORD); + items.put("outgoingservername", OUTGOING_SERVER_NAME); + items.put("outgoingconnectionmethod", OUTGOING_CONNECTIONMETHOD_NAME); + items.put(ADD_VCARD_XML, ADD_VCARD); + items.put("emailalias", EMAIL_ALIAS); + items.put("receiptaddress", RECEIPT_ADDRESS); + items.put("replytoaddress", REPLYTO_ADDRESS); + items.put(REQUEST_RECEIPTS_XML, REQUEST_RECEIPTS); + items.put("smtpauth", SMTP_AUTHENTICATION); + items.put(SEND_OPTION_XML, SEND_OPTION); + items.put("toccincludelimit", TO_CC_INCLUDE_LIMIT); + + + additionalItems = new LinkedHashMap(13); + additionalItems.put(AbstractComponent.TYPE_PARAMETER_ID,TYPE); + } + + private void initFixedValues(){ + itemsValues = new LinkedHashMap(4); + itemsValues.put(INCOMINGSECURESOCKETS_XML, YES_NO_TYPES_AS_COMMA_SEPARATED_STRING); + itemsValues.put(INCOMING_SSL_WRAPPER_XML, YES_NO_TYPES_AS_COMMA_SEPARATED_STRING); + itemsValues.put(USE_APOP_SECURE_LOGIN_XML, YES_NO_TYPES_AS_COMMA_SEPARATED_STRING); + itemsValues.put(ACKNOWLEDGE_RECEIPTS_XML, YES_NO_TYPES_AS_COMMA_SEPARATED_STRING); + itemsValues.put(AUTOSEND_ON_CONNECT_XML, YES_NO_TYPES_AS_COMMA_SEPARATED_STRING); + itemsValues.put(DELETE_MAILS_AT_DISCONNECT_XML, YES_NO_TYPES_AS_COMMA_SEPARATED_STRING); + itemsValues.put(IMAP_IDLE_COMMAND_XML, YES_NO_TYPES_AS_COMMA_SEPARATED_STRING); + itemsValues.put(MARK_SEEN_IN_SYNC_XML, YES_NO_TYPES_AS_COMMA_SEPARATED_STRING); + itemsValues.put(ENABLE_EXPUNGE_MODE_XML, YES_NO_TYPES_AS_COMMA_SEPARATED_STRING); + itemsValues.put(DISCONNECTED_USER_MODE_XML, YES_NO_TYPES_AS_COMMA_SEPARATED_STRING); + itemsValues.put(ADD_VCARD_XML, YES_NO_TYPES_AS_COMMA_SEPARATED_STRING); + itemsValues.put(OUTGOING_SECURE_SOCKETS_XML, YES_NO_TYPES_AS_COMMA_SEPARATED_STRING); + itemsValues.put(OUTGOING_SSL_WRAPPER_XML, YES_NO_TYPES_AS_COMMA_SEPARATED_STRING); + itemsValues.put(REQUEST_RECEIPTS_XML, YES_NO_TYPES_AS_COMMA_SEPARATED_STRING); + + itemsValues.put(GET_EMAIL_OPTIONS_XML, POSSIBLE_VALUES_FOR_GET_EMAIL_OPTIONS); + itemsValues.put(SUBSCRIBE_TYPE_XML, POSSIBLE_VALUES_FOR_SUBSCRIBE_TYPE); + itemsValues.put(FOLDER_SYNC_TYPE_XML, POSSIBLE_VALUES_FOR_FOLDER_SYNC_TYPE); + itemsValues.put(COPY_TO_SELF_XML, POSSIBLE_VALUES_FOR_COPY_TO_SELF); + itemsValues.put(SEND_OPTION_XML, POSSIBLE_VALUES_FOR_SEND_OPTION); + + } + + /** + * Inits Max Occur valus for items + */ + private void initMaxOccurValues(){ + maxOccur = new LinkedHashMap(4); + + Integer integerOne = new Integer (1); + + maxOccur.put(NAME, integerOne ); + maxOccur.put(OWN_EMAIL, integerOne ); + maxOccur.put(COPY_TO_SELF, integerOne ); + maxOccur.put(USE_APOP_SECURE_LOGIN, integerOne ); + maxOccur.put(INCOMING_PORT, integerOne ); + maxOccur.put(INCOMING_SSL_WRAPPER, integerOne ); + maxOccur.put(INCOMING_SECURE_SOCKETS, integerOne ); + maxOccur.put(INCOMING_LOGINNAME, integerOne ); + maxOccur.put(INCOMING_PASSWORD, integerOne ); + maxOccur.put(INCOMING_SERVER_NAME, integerOne ); + maxOccur.put(INCOMING_CONNECTIONMETHOD_NAME, integerOne ); + maxOccur.put(ACKNOWLEDGE_RECEIPTS, integerOne ); + maxOccur.put(ATTACHMENT_SIZE_LIMIT, integerOne ); + maxOccur.put(AUTOSEND_ON_CONNECT, integerOne ); + maxOccur.put(BODY_TEXT_SIZE_LIMIT, integerOne ); + maxOccur.put(DELETE_MAILS_AT_DISCONNECT, integerOne ); + maxOccur.put(ATTACHMENT_FETCH_SIZE, integerOne ); + maxOccur.put(INCOMING_FOLDER_PATH, integerOne ); + maxOccur.put(PATH_SEPARATOR, integerOne ); + maxOccur.put(GET_EMAIL_OPTIONS, integerOne ); + maxOccur.put(IMAP_IDLE_COMMAND, integerOne ); + maxOccur.put(IMAP_IDLE_TIMEOUT, integerOne ); + maxOccur.put(MAX_EMAIL_SIZE, integerOne ); + maxOccur.put(SUBSCRIBE_TYPE, integerOne ); + maxOccur.put(SYNC_RATE, integerOne ); + maxOccur.put(FOLDER_SYNC_TYPE, integerOne ); + maxOccur.put(MARK_SEEN_IN_SYNC, integerOne ); + maxOccur.put(ENABLE_EXPUNGE_MODE, integerOne ); + maxOccur.put(INBOX_SYNC_LIMIT, integerOne ); + maxOccur.put(MAILBOX_SYNC_LIMIT, integerOne ); + maxOccur.put(DISCONNECTED_USER_MODE, integerOne ); + maxOccur.put(OUTGOING_PORT, integerOne ); + maxOccur.put(OUTGOING_SSL_WRAPPER, integerOne ); + maxOccur.put(OUTGOING_SECURE_SOCKETS, integerOne ); + maxOccur.put(OUTGOING_LOGIN_NAME, integerOne ); + maxOccur.put(OUTGOING_PASSWORD, integerOne ); + maxOccur.put(OUTGOING_SERVER_NAME, integerOne ); + maxOccur.put(OUTGOING_CONNECTIONMETHOD_NAME, integerOne ); + maxOccur.put(ADD_VCARD, integerOne ); + maxOccur.put(EMAIL_ALIAS, integerOne ); + maxOccur.put(RECEIPT_ADDRESS, integerOne ); + maxOccur.put(REPLYTO_ADDRESS, integerOne ); + maxOccur.put(REQUEST_RECEIPTS, integerOne ); + maxOccur.put(SMTP_AUTHENTICATION, integerOne ); + maxOccur.put(SEND_OPTION, integerOne ); + maxOccur.put(TO_CC_INCLUDE_LIMIT, integerOne ); + } + + /* + * (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractVariables#getInstanceImpl() + */ + protected AbstractVariables getInstanceImpl() { + return instance; + } + + /** + * Get values for "Type" + * @return fixed values for Type + */ + public static String[] getTypeVariables() { + + return new String[]{TYPE_IMAP, TYPE_POP3, TYPE_SYNCML }; + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/messaging/Message.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/messaging/Message.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,203 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.messaging; + + +import java.util.Iterator; +import java.util.Set; +import java.util.Vector; + +import com.nokia.s60tools.creator.components.AbstractComponent; +import com.nokia.s60tools.creator.components.AbstractValue; +import com.nokia.s60tools.creator.components.AbstractVariables; +import com.nokia.s60tools.creator.components.contact.ContactValue; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + + +/** + * Class representing message + */ +public class Message extends AbstractComponent { + + + public Message(int id, String messageType) { + this(id); + setMessageType(messageType); + } + public Message(int id) { + super(id); + } + + /** + * Get type for this Message + * @return + */ + public String getMessageType() { + return getAdditionalParameter(TYPE_PARAMETER_ID); + } + + + + /** + * Set event type for this Message + * @param eventType + */ + public void setMessageType(String eventType) { + addAdditionalParameter(TYPE_PARAMETER_ID, eventType); + } + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.config.AbstractComponent#getType() + */ + public String getType() { + return CreatorEditorSettings.TYPE_MESSAGE; + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#isValid() + */ + public boolean isValid() { + // Message must have type + return getMessageType() != null; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getIdByValue(java.lang.String) + */ + public String getIdByValue(String value) { + return MessageVariables.getInstance().getIdByValue(value); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValueById(java.lang.String) + */ + public String getValueById(String id) { + return MessageVariables.getInstance().getValueById(id); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getXMLElementName() + */ + public String getXMLElementName() { + return CreatorEditorSettings.TYPE_MESSAGE_XML_ELEMENT; + } + + /** + * Component type must be separated from other data with COMPONENT_TYPE_SEPARATOR, and before + * COMPONENT_TYPE_SEPARATOR there must not be any other information than component type. + * @return component String. Format: + * COMPONENT_TYPE_SEPARATOR =, =... + */ + public String toString() { + + Set componentKeys = getKeys(); + //Collection values = comp.getAttributes().values(); + + StringBuffer allFieldsB = new StringBuffer(); + allFieldsB.append( getValueById( getMessageType() )); + allFieldsB.append( COMPONENT_TYPE_SEPARATOR); + + //Amount (how many of this component will be added) + if(getAmount() > 0){ + allFieldsB.append(" Amount="); + allFieldsB.append(getAmount()); + allFieldsB.append(COMPONENT_ITEM_SEPARATOR); + } + + String itemlabel = new String(); + Vector itemValue; + //Looping through one component, founding all fields from that component + for (Iterator compValuesIt = componentKeys.iterator(); compValuesIt.hasNext();) { + itemlabel = (String) compValuesIt.next(); + itemValue = getAttribute(itemlabel); + //get all values from values vector + for (Iterator iterator = itemValue.iterator(); iterator.hasNext();) { + AbstractValue absVal = iterator.next(); + MessageValue calVal = (MessageValue)absVal; + + addOneItemToBuffer(allFieldsB, itemlabel, calVal); + } + + } + + //deleting last ", " from list + if(allFieldsB.toString().endsWith(COMPONENT_ITEM_SEPARATOR)){ + allFieldsB.delete(allFieldsB.length()-COMPONENT_ITEM_SEPARATOR.length(), allFieldsB.length()); + } + return CreatorEditorSettings.getInstance().replaceEntitiesWithChars(allFieldsB.toString()); + } + + private void addOneItemToBuffer(StringBuffer allFieldsB, String itemlabel, + MessageValue calVal) { + allFieldsB.append(itemlabel); + allFieldsB.append(COMPONENT_LABEL_VALUE_SEPARATOR); + //If value is random value, showing in UI only short description () + if(calVal.isRandom()){ + allFieldsB.append(ContactValue.RANDOM_TEXT); + }else{ + allFieldsB.append(calVal.getValue()); + } + allFieldsB.append(COMPONENT_ITEM_SEPARATOR); + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValuesForItemType(java.lang.String) + */ + public String[] getValuesForItemType(String itemType) { + + //If there is not this type of item at all + String idByValue = getIdByValue(itemType); + if(idByValue == null){ + return null; + } + return MessageVariables.getInstance().getValuesForItemType(idByValue); + + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#isTypeSupportingIncValueForEachCopy(java.lang.String) + */ + public boolean isTypeSupportingIncValueForEachCopy(String type) { + + return MessageVariables.getInstance().isTypeSupportingIncValueForEachCopy(type); + + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#itemMaxOccur(java.lang.String) + */ + public int itemMaxOccur(String itemName) { + return MessageVariables.getInstance().itemMaxOccur(itemName); + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getVariables() + */ + public AbstractVariables getVariables(){ + return MessageVariables.getInstance(); + } +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/messaging/MessageValue.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/messaging/MessageValue.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.messaging; + +import com.nokia.s60tools.creator.components.AbstractValue; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + +/** + * One row of data of message + */ +public class MessageValue extends AbstractValue { + + /** + * Creates new Value. + * @param value + * @param randomType + * @param amount + */ + public MessageValue(String value, ModeTypes randomType, int amount) { + this(); + setValue(value); + setModeType(randomType); + setAmount(amount); + } + + /** + * Creates new Value. + * @param value + * @param amount + */ + public MessageValue(String value, int amount) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(amount); + } + + /** + * Set amount and also maxamount as amount + * For now in messages there is no any other possible amount fields in calendar than maxamount in contact-set reference + * So using always amount also as maxamount. If there is new requirement for amount in messages, reimplement. + * + * @param amount -for amount and maxamount + */ + public void setAmount(int amount) { + super.setAmount(amount); + super.setMaxAmount(amount); + } + + + /** + * Creates new Value. + * + * @param value + * @param isRandom if false, random type is set to {@link ModeTypes#RandomTypeNotRandom} + * if true random type is set to {@link ModeTypes#RandomTypeDefaultLength} + * @param amount + */ + public MessageValue(String value, boolean isRandom, int amount) { + this(); + if(!isRandom){ + setModeType(ModeTypes.RandomTypeNotRandom); + } + else{ + setModeType(ModeTypes.RandomTypeDefaultLength); + } + setValue(value); + setAmount(amount); + } + + /** + * Creates new Value with no random and no amount. + * random value is set to {@link ModeTypes#RandomTypeNotRandom} and + * amount is set to 0. + * @param value + */ + public MessageValue(String value) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(0); + } + + /** + * Creates new Value. + * Attributes is set by default; + * - random value is set to {@link ModeTypes#RandomTypeDefaultLength} + * - random is set to true + * - value is set to EMPTY_STRING + * - amount is set to 0. + */ + public MessageValue() { + super(CreatorEditorSettings.TYPE_MESSAGE); + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractValue#getValue() + */ + public String getValue() { + + //In case of Attendee, there is two parameters in one value + if(isContactSetReference()){ + return ""+getId(); + } + else{ + return super.getValue(); + } + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/messaging/MessageVariables.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/messaging/MessageVariables.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,294 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.messaging; + +import java.util.LinkedHashMap; + +import com.nokia.s60tools.creator.components.AbstractVariables; +import com.nokia.s60tools.creator.components.filetype.FileTypeVariables; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + +/** + * Variables for message + */ +public class MessageVariables extends AbstractVariables { + + + // + // UI texts for xml elements + // + public static final String STATUS = "Status"; + public static final String TO = "To"; + public static final String FROM = "From"; + public static final String FOLDER = "Folder"; + public static final String SUBJECT = "Subject"; + public static final String TEXT = "Text"; + public static final String ATTACHMENTPATH = "Attachment path"; + public static final String ATTACHMENTID = "Attachment file ID"; + public static final String SMART_MSG_TYPE = "Type"; + + /** + * Possible fixed values for "Folder" + */ + public static final String [] FOLDER_POSSIBLE_VALUES = {"Sent", "Inbox", "Draft", "Outbox"}; + /** + * Possible fixed values for "Status" + */ + public static final String [] STATUS_POSSIBLE_VALUES = {"Read", "New"}; + /** + * Possible fixed values for Smart message "Type" + */ + public static final String [] SMART_MSG_TYPE_POSSIBLE_VALUES = { + "internetsettings", "emailnotification", "businesscard", "wapsettings", "vcalendar", + "vcard", "ringtone", "operatorlogo", "wapprovisioning", "clilogo"}; + + + + // + // XML element names + // + private static final String ATTACHEMENT_ID_XML_ELEMENT = "attachmentid"; + private static final String FOLDER_XML_ELEMENT = "folder"; + private static final String SMARTMESSAGETYPE_XML_ELEMENT = "smartmessagetype"; + private static final String BT_XML_ELEMENT = "bt"; + private static final String IR_XML_ELEMENT = "ir"; + private static final String SMART_XML_ELEMENT = "smart"; + private static final String SMS_XML_ELEMENT = "sms"; + private static final String MMS_XML_ELEMENT = "mms"; + private static final String AMS_XML_ELEMENT = "ams"; + private static final String EMAIL_XML_ELEMENT = "email"; + private static final String FROM_XML_ELEMENT = "from"; + private static final String TO_XML_ELEMENT = "to"; + private static final String STATUS_XML_ELEMENT = "status"; + + private static MessageVariables instance; + + /** + * Get Singleton instance of variables + * @return + */ + public static MessageVariables getInstance() { + + if(instance == null){ + instance = new MessageVariables(); + } + + return instance; + } + + private MessageVariables(){ + init(); + initFixedValues(); + initMaxOccurValues(); + } + + + + private void init() { + + items = new LinkedHashMap(3); + items.put(TO_XML_ELEMENT, TO); + items.put(FROM_XML_ELEMENT, FROM); + items.put(FOLDER_XML_ELEMENT, FOLDER); + items.put("subject", SUBJECT); + items.put("text", TEXT); + items.put(STATUS_XML_ELEMENT, STATUS); + items.put("attachmentpath", ATTACHMENTPATH); + items.put(ATTACHEMENT_ID_XML_ELEMENT, ATTACHMENTID); + //For contact set references, (from and to) must create own handling, because of items keys are unique, cant have same key with two values + items.put(/*FROM_XML_ELEMENT*/CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE_FROM, CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE_FROM); + items.put(/*TO_XML_ELEMENT */CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE_TO, CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE_TO); + + additionalItems = new LinkedHashMap(13); + + + additionalItems.put(SMS_XML_ELEMENT, CreatorEditorSettings.TYPE_MESSAGE_SMS); + additionalItems.put(MMS_XML_ELEMENT, CreatorEditorSettings.TYPE_MESSAGE_MMS); + additionalItems.put(AMS_XML_ELEMENT, CreatorEditorSettings.TYPE_MESSAGE_AMS); + additionalItems.put(EMAIL_XML_ELEMENT, CreatorEditorSettings.TYPE_MESSAGE_EMAIL); + additionalItems.put(SMART_XML_ELEMENT, CreatorEditorSettings.TYPE_MESSAGE_SMART); + additionalItems.put(IR_XML_ELEMENT, CreatorEditorSettings.TYPE_MESSAGE_IR); + additionalItems.put(BT_XML_ELEMENT, CreatorEditorSettings.TYPE_MESSAGE_BT); + + + additionalItems.put(CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE_XML_ELEMENT, CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE); + //For contact set references, (from and to) must create own handling, because of items keys are unique, cant have same key with two values + //Contact set reference from and to xml elements will found here + additionalItems.put(FROM_XML_ELEMENT, CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE_FROM); + additionalItems.put(TO_XML_ELEMENT, CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE_TO); + + additionalItems.put(SMARTMESSAGETYPE_XML_ELEMENT, SMART_MSG_TYPE); + + } + + private void initFixedValues(){ + itemsValues = new LinkedHashMap(4); + itemsValues.put(STATUS_XML_ELEMENT, STATUS_POSSIBLE_VALUES); + itemsValues.put(SMARTMESSAGETYPE_XML_ELEMENT, SMART_MSG_TYPE_POSSIBLE_VALUES); + itemsValues.put(FOLDER_XML_ELEMENT, FOLDER_POSSIBLE_VALUES); + itemsValues.put(ATTACHEMENT_ID_XML_ELEMENT, FileTypeVariables.ALL_FILE_TYPES_AS_COMMA_SEPARATED_STRING); + } + + /** + * Inits Max Occur valus for items + */ + private void initMaxOccurValues(){ + maxOccur = new LinkedHashMap(4); + + Integer integerOne = new Integer (1); + + maxOccur.put(FOLDER, integerOne ); + maxOccur.put(SUBJECT, integerOne ); + maxOccur.put(TEXT, integerOne ); + maxOccur.put(SMART_MSG_TYPE, integerOne ); + maxOccur.put(STATUS, integerOne ); + } + + /** + * Get XML element name by value + * @param value + * @return key if found, null otherwise + */ + public String getIdByValue(String value) { + + if(value != null && value.equals(CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE_FROM)){ + return FROM_XML_ELEMENT; + } + else if(value != null && value.equals(CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE_TO)){ + return TO_XML_ELEMENT; + } + else{ + return super.getIdByValue(value); + } + + } + + + /** + * Get value by two xml element name. Use with from/to and contact-set-reference to get proper contact set reference element UI name. + * @param superElement + * @param element + * @return String + */ + public static String getValueByIds(String superElement, String element){ + if(superElement != null && element != null){ + if(superElement.equalsIgnoreCase(FROM) && element.equalsIgnoreCase(CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE_XML_ELEMENT)){ + return CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE_FROM; + } + else if(superElement.equalsIgnoreCase(TO) && element.equalsIgnoreCase(CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE_XML_ELEMENT)){ + return CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE_TO; + } + else{ + return null; + } + } + else{ + return null; + } + } + + /** + * Get Item values (showable names) + * + * @return item names + */ + public String[] getItemValuesAsString(String type) { + + String _type = getValueById(type); + + String[] arr = null; + + // + // Some of types has limited number of values, not all + // + + if (_type.equals(CreatorEditorSettings.TYPE_MESSAGE_SMS)) { + arr = new String[] { + // No subject, no attachement in SMS + TO, FROM, FOLDER, TEXT,STATUS, CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE_TO, + CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE_FROM }; + return arr; + } else if (_type.equals(CreatorEditorSettings.TYPE_MESSAGE_SMART)) { + arr = new String[] { TO, FROM, FOLDER ,STATUS, + CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE_TO, + CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE_FROM, + SMART_MSG_TYPE}; + return arr; + } else if (_type.equals(CreatorEditorSettings.TYPE_MESSAGE_IR) + || _type.equals(CreatorEditorSettings.TYPE_MESSAGE_BT)) { + arr = new String[] { TO, FROM, FOLDER, STATUS,SUBJECT, CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE_TO, + CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE_FROM }; + return arr; + } + // Types: + // CreatorEditorSettings.TYPE_MESSAGE_MMS, + // CreatorEditorSettings.TYPE_MESSAGE_AMS, + // CreatorEditorSettings.TYPE_MESSAGE_EMAIL + // will have all elements + else { + return getItemValuesAsString(); + } + } + + protected AbstractVariables getInstanceImpl() { + return instance; + } + + /** + * Get ID by subelement name and superelement name + * @param itemId - sub element name + * @param superElementType - super element name + * @return + */ + public String getIDByValueAndType(String itemId, String superElementType) { + + if(itemId != null && superElementType != null && itemId.equals(CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE_XML_ELEMENT)){ + + if(superElementType.equals(FROM_XML_ELEMENT )){ + return CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE_FROM; + } + else if(superElementType.equals(TO_XML_ELEMENT )){ + return CreatorEditorSettings.TYPE_CONTACT_SET_REFERENCE_TO; + } + else{ + return getIdByValue(itemId); + } + } + + else{ + return getIdByValue(itemId); + } + + } + + /** + * Check if incvalueforeachcopy is supported for type. + * @param type as in UI, not as in XML. + * @return true if incvalueforeachcopy is supported. + */ + public boolean isTypeSupportingIncValueForEachCopy(String type) { + + //phone number + + if(type == null){ + return false; + } + + return type.equals(TO) || type.equals(FROM); + } +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/note/Note.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/note/Note.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.note; + + +import com.nokia.s60tools.creator.components.AbstractComponent; +import com.nokia.s60tools.creator.components.AbstractVariables; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + + +/** + * Class representing Note + */ +public class Note extends AbstractComponent { + + + public Note(int id) { + super(id); + } + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.config.AbstractComponent#getType() + */ + public String getType() { + return CreatorEditorSettings.TYPE_NOTE; + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#isValid() + */ + public boolean isValid() { + return true; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getIdByValue(java.lang.String) + */ + public String getIdByValue(String value) { + return NoteVariables.getInstance().getIdByValue(value); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValueById(java.lang.String) + */ + public String getValueById(String id) { + return NoteVariables.getInstance().getValueById(id); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getXMLElementName() + */ + public String getXMLElementName() { + return CreatorEditorSettings.TYPE_NOTE_XML_ELEMENT; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValuesForItemType(java.lang.String) + */ + public String[] getValuesForItemType(String itemType) { + //If there is not this type of item at all + String idByValue = getIdByValue(itemType); + if(idByValue == null){ + return null; + } + return NoteVariables.getInstance().getValuesForItemType(idByValue); + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getVariables() + */ + public AbstractVariables getVariables(){ + return NoteVariables.getInstance(); + } +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/note/NoteValue.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/note/NoteValue.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.note; + +import com.nokia.s60tools.creator.components.AbstractValue; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + +/** + * One row of data of note + */ +public class NoteValue extends AbstractValue { + + /** + * Creates new Value. + * @param value + * @param randomType + * @param amount + */ + public NoteValue(String value, ModeTypes randomType, int amount) { + this(); + setValue(value); + setModeType(randomType); + setAmount(amount); + } + + /** + * Creates new Value. + * @param value + * @param amount + */ + public NoteValue(String value, int amount) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(amount); + } + + + /** + * Creates new NoteValue. + * + * @param value + * @param isRandom if false, random type is set to {@link ModeTypes#RandomTypeNotRandom} + * if true random type is set to {@link ModeTypes#RandomTypeDefaultLength} + * @param amount + */ + public NoteValue(String value, boolean isRandom, int amount) { + this(); + if(!isRandom){ + setModeType(ModeTypes.RandomTypeNotRandom); + } + else{ + setModeType(ModeTypes.RandomTypeDefaultLength); + } + setValue(value); + setAmount(amount); + } + + /** + * Creates new NoteValue with no random and no amount. + * random value is set to {@link ModeTypes#RandomTypeNotRandom} and + * amount is set to 0. + * @param value + */ + public NoteValue(String value) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(0); + } + + /** + * Creates new NoteValue. + * Attributes is set by default; + * - random value is set to {@link ModeTypes#RandomTypeDefaultLength} + * - random is set to true + * - value is set to EMPTY_STRING + * - amount is set to 0. + */ + public NoteValue() { + super(CreatorEditorSettings.TYPE_NOTE); + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/note/NoteVariables.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/note/NoteVariables.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.note; + +import java.util.LinkedHashMap; + +import com.nokia.s60tools.creator.components.AbstractVariables; + +/** + * Variables for note + */ +public class NoteVariables extends AbstractVariables { + + + private static NoteVariables instance; + + /** + * Get Singleton instance of variables + * @return + */ + public static NoteVariables getInstance() { + + if(instance == null){ + instance = new NoteVariables(); + } + + return instance; + } + + private NoteVariables(){ + init(); + } + + + /** + * UI text "Text". + */ + public static final String TEXT = "Text"; + + private void init() { + + items = new LinkedHashMap(1); + items.put("text",TEXT); + + } + + protected AbstractVariables getInstanceImpl() { + return instance; + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/savedpage/SavedPage.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/savedpage/SavedPage.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.savedpage; + + +import com.nokia.s60tools.creator.components.AbstractComponent; +import com.nokia.s60tools.creator.components.AbstractVariables; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + + +/** + * Class representing saved page + */ +public class SavedPage extends AbstractComponent { + + + public SavedPage(int id) { + super(id); + } + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.config.AbstractComponent#getType() + */ + public String getType() { + return CreatorEditorSettings.TYPE_SAVED_PAGE; + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#isValid() + */ + public boolean isValid() { + return true; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getIdByValue(java.lang.String) + */ + public String getIdByValue(String value) { + return SavedPageVariables.getInstance().getIdByValue(value); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValueById(java.lang.String) + */ + public String getValueById(String id) { + return SavedPageVariables.getInstance().getValueById(id); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getXMLElementName() + */ + public String getXMLElementName() { + return CreatorEditorSettings.TYPE_SAVED_PAGE_XML_ELEMENT; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValuesForItemType(java.lang.String) + */ + public String[] getValuesForItemType(String itemType) { + //If there is not this type of item at all + String idByValue = getIdByValue(itemType); + if(idByValue == null){ + return null; + } + return SavedPageVariables.getInstance().getValuesForItemType(idByValue); + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getVariables() + */ + public AbstractVariables getVariables(){ + return SavedPageVariables.getInstance(); + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/savedpage/SavedPageFolder.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/savedpage/SavedPageFolder.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.savedpage; + + +import com.nokia.s60tools.creator.components.AbstractComponent; +import com.nokia.s60tools.creator.components.AbstractVariables; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + + +/** + * Class representing saved page folder + */ +public class SavedPageFolder extends AbstractComponent { + + + public SavedPageFolder(int id) { + super(id); + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.config.AbstractComponent#getType() + */ + public String getType() { + return CreatorEditorSettings.TYPE_SAVED_PAGE_FOLDER; + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#isValid() + */ + public boolean isValid() { + return true; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getIdByValue(java.lang.String) + */ + public String getIdByValue(String value) { + return SavedPageFolderVariables.getInstance().getIdByValue(value); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValueById(java.lang.String) + */ + public String getValueById(String id) { + return SavedPageFolderVariables.getInstance().getValueById(id); + } + + + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getXMLElementName() + */ + public String getXMLElementName() { + return CreatorEditorSettings.TYPE_SAVED_PAGE_FOLDER_XML_ELEMENT; + } + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getValuesForItemType(java.lang.String) + */ + public String[] getValuesForItemType(String itemType) { + //If there is not this type of item at all + String idByValue = getIdByValue(itemType); + if(idByValue == null){ + return null; + } + return SavedPageFolderVariables.getInstance().getValuesForItemType(idByValue); + } + + + /* (non-Javadoc) + * @see com.nokia.s60tools.creator.components.AbstractComponent#getVariables() + */ + public AbstractVariables getVariables(){ + return SavedPageFolderVariables.getInstance(); + } +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/savedpage/SavedPageFolderValue.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/savedpage/SavedPageFolderValue.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.savedpage; + +import com.nokia.s60tools.creator.components.AbstractValue; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + +/** + * One row of data of saved page folder + */ +public class SavedPageFolderValue extends AbstractValue { + + /** + * Creates new Value. + * @param value + * @param randomType + * @param amount + */ + public SavedPageFolderValue(String value, ModeTypes randomType, int amount) { + this(); + setValue(value); + setModeType(randomType); + setAmount(amount); + } + + /** + * Creates new Value. + * @param value + * @param amount + */ + public SavedPageFolderValue(String value, int amount) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(amount); + } + + + /** + * Creates new NoteValue. + * + * @param value + * @param isRandom if false, random type is set to {@link ModeTypes#RandomTypeNotRandom} + * if true random type is set to {@link ModeTypes#RandomTypeDefaultLength} + * @param amount + */ + public SavedPageFolderValue(String value, boolean isRandom, int amount) { + this(); + if(!isRandom){ + setModeType(ModeTypes.RandomTypeNotRandom); + } + else{ + setModeType(ModeTypes.RandomTypeDefaultLength); + } + setValue(value); + setAmount(amount); + } + + /** + * Creates new NoteValue with no random and no amount. + * random value is set to {@link ModeTypes#RandomTypeNotRandom} and + * amount is set to 0. + * @param value + */ + public SavedPageFolderValue(String value) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(0); + } + + /** + * Creates new NoteValue. + * Attributes is set by default; + * - random value is set to {@link ModeTypes#RandomTypeDefaultLength} + * - random is set to true + * - value is set to EMPTY_STRING + * - amount is set to 0. + */ + public SavedPageFolderValue() { + super(CreatorEditorSettings.TYPE_SAVED_PAGE_FOLDER); + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/savedpage/SavedPageFolderVariables.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/savedpage/SavedPageFolderVariables.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.savedpage; + +import java.util.LinkedHashMap; + +import com.nokia.s60tools.creator.components.AbstractVariables; + +/** + * Variables for saved page folder + */ +public class SavedPageFolderVariables extends AbstractVariables { + + + private static SavedPageFolderVariables instance; + + /** + * Get Singleton instance of variables + * @return + */ + public static SavedPageFolderVariables getInstance() { + + if(instance == null){ + instance = new SavedPageFolderVariables(); + } + + return instance; + } + + private SavedPageFolderVariables(){ + init(); + } + + + /** + * UI text "Name" + */ + public static final String NAME = "Name"; + + private void init() { + + items = new LinkedHashMap(1); + items.put("name",NAME); + + } + + protected AbstractVariables getInstanceImpl() { + return instance; + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/savedpage/SavedPageValue.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/savedpage/SavedPageValue.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.savedpage; + +import com.nokia.s60tools.creator.components.AbstractValue; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; + +/** + * One row of data of saved page + */ +public class SavedPageValue extends AbstractValue { + + /** + * Creates new Value. + * @param value + * @param randomType + * @param amount + */ + public SavedPageValue(String value, ModeTypes randomType, int amount) { + this(); + setValue(value); + setModeType(randomType); + setAmount(amount); + } + + /** + * Creates new Value. + * @param value + * @param amount + */ + public SavedPageValue(String value, int amount) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(amount); + } + + + /** + * Creates new NoteValue. + * + * @param value + * @param isRandom if false, random type is set to {@link ModeTypes#RandomTypeNotRandom} + * if true random type is set to {@link ModeTypes#RandomTypeDefaultLength} + * @param amount + */ + public SavedPageValue(String value, boolean isRandom, int amount) { + this(); + if(!isRandom){ + setModeType(ModeTypes.RandomTypeNotRandom); + } + else{ + setModeType(ModeTypes.RandomTypeDefaultLength); + } + setValue(value); + setAmount(amount); + } + + /** + * Creates new NoteValue with no random and no amount. + * random value is set to {@link ModeTypes#RandomTypeNotRandom} and + * amount is set to 0. + * @param value + */ + public SavedPageValue(String value) { + this(); + setValue(value); + setModeType(ModeTypes.RandomTypeNotRandom); + setAmount(0); + } + + /** + * Creates new NoteValue. + * Attributes is set by default; + * - random value is set to {@link ModeTypes#RandomTypeDefaultLength} + * - random is set to true + * - value is set to EMPTY_STRING + * - amount is set to 0. + */ + public SavedPageValue() { + super(CreatorEditorSettings.TYPE_SAVED_PAGE); + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/savedpage/SavedPageVariables.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/savedpage/SavedPageVariables.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.components.savedpage; + +import java.util.LinkedHashMap; + +import com.nokia.s60tools.creator.components.AbstractVariables; + +/** + * Variables for saved page + */ +public class SavedPageVariables extends AbstractVariables { + + + private static SavedPageVariables instance; + + /** + * Get Singleton instance of variables + * @return + */ + public static SavedPageVariables getInstance() { + + if(instance == null){ + instance = new SavedPageVariables(); + } + + return instance; + } + + private SavedPageVariables(){ + init(); + } + + + /** + * UI text "Name" + */ + public static final String NAME = "Name"; + /** + * UI text "Path" + */ + public static final String PATH = "Path"; + + + private void init() { + + items = new LinkedHashMap(2); + items.put("name",NAME); + items.put("path",PATH); + + } + + protected AbstractVariables getInstanceImpl() { + return instance; + } + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/core/CreatorEditorSettings.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/core/CreatorEditorSettings.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,433 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +package com.nokia.s60tools.creator.core; + +import java.util.Collection; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Set; + +import com.nokia.s60tools.creator.components.AbstractValue; +import com.nokia.s60tools.creator.components.calendar.CalendarVariables; + +/** + * CreatorScriptEditorSettings. Values for drop down menu on CreatorScript Editor. + * + * Use CreatorScriptEditorPropertiesSetter to set Values on startup + */ +public class CreatorEditorSettings { + + /** + * One instance of settings + */ + private static CreatorEditorSettings instance; + + /** + * Holds forbidden characters and entity numbers + */ + private Hashtable entityNumbersAndChars; + + /** + * Holds forbidden characters and entity numbers + */ + private Hashtable entityNamesAndChars; + + + + /** + * Type for general "Unkown" component type + */ + public static final String TYPE_UNKNOWN = "Unknown component"; + + // + // Variables for contacts + // + public static final String TYPE_CONTACT = "Contact"; + public static final String TYPE_CONTACT_XML_ELEMENT = "contact"; + public static final String TYPE_CONTACT_SET = "Contact-set"; + public static final String TYPE_CONTACT_SET_XML_ELEMENT = "contact-set"; + public static final String TYPE_CONTACT_SET_REFERENCE_XML_ELEMENT = "contact-set-reference"; + public static final String TYPE_CONTACT_SET_REFERENCE_FROM = "From (Contact Set ID)"; + public static final String TYPE_CONTACT_SET_REFERENCE_TO = "To (Contact Set ID)"; + public static final String TYPE_CONTACT_SET_REFERENCE = "Contact Set ID"; + public static final String TYPE_CONTACT_GROUP = "Contact Group"; + public static final String TYPE_CONTACT_GROUP_XML_ELEMENT = "contactgroup"; + + // + // Variables for note + // + public static final String TYPE_NOTE = "Note"; + public static final String TYPE_NOTE_XML_ELEMENT = "note"; + + // + // Variables for bookmark + // + public static final String TYPE_BOOKMARK = "Bookmark"; + public static final String TYPE_BOOKMARK_XML_ELEMENT = "bookmark"; + public static final String TYPE_BOOKMARK_FOLDER = "Bookmark folder"; + public static final String TYPE_BOOKMARK_FOLDER_XML_ELEMENT = "bookmarkfolder"; + + // + // Variables for saved page + // + public static final String TYPE_SAVED_PAGE = "Saved page"; + public static final String TYPE_SAVED_PAGE_XML_ELEMENT = "savedpage"; + public static final String TYPE_SAVED_PAGE_FOLDER = "Saved page folder"; + public static final String TYPE_SAVED_PAGE_FOLDER_XML_ELEMENT = "savedpagefolder"; + + // + // Variables for log + // + public static final String TYPE_LOG = "Log"; + public static final String TYPE_LOG_XML_ELEMENT = "log"; + + // + // Variables for IMPS Server + // + public static final String TYPE_IMPS_SERVER = "IMPS Server"; + public static final String TYPE_IMPS_SERVER_XML_ELEMENT = "impsserver"; + + // + // Variables for Connection method + // + public static final String TYPE_CONNECTION_METHOD_XML_ELEMENT = "connectionmethod"; + public static final String TYPE_CONNECTION_METHOD = "Connection method"; + + // + // Variables for calendar + // + public static final String TYPE_CALENDAR_XML_ELEMENT = "calendar"; + public static final String TYPE_CALENDAR = "Calendar"; + public static final String TYPE_TODO = "To-do"; + public static final String TYPE_TODO_XML_ELEMENT = "todo"; + public static final String TYPE_APPOINTMENT = "Appointment"; + public static final String TYPE_APPOINTMENT_XML_ELEMENT = "appointment"; + public static final String TYPE_EVENT = "Event"; + public static final String TYPE_EVENT_XML_ELEMENT = "event"; + public static final String TYPE_REMINDER = "Reminder"; + public static final String TYPE_REMINDER_XML_ELEMENT = "reminder"; + public static final String TYPE_ANNIVERSARY = "Anniversary"; + public static final String TYPE_ANNIVERSARY_XML_ELEMENT = "anniversary"; + + // + // Variables for mailbox + // + public static final String TYPE_MAIL_BOX_XML_ELEMENT = "mailbox"; + public static final String TYPE_MAIL_BOX = "Mail box"; + + // + // Variables for messages + // + public static final String TYPE_MESSAGE_XML_ELEMENT = "message"; + public static final String TYPE_MESSAGE_SMS = "SMS"; + public static final String TYPE_MESSAGE_MMS = "MMS"; + public static final String TYPE_MESSAGE_AMS = "AMS"; + public static final String TYPE_MESSAGE_EMAIL = "Email"; + public static final String TYPE_MESSAGE_SMART = "Smart message"; + public static final String TYPE_MESSAGE_IR = "IR message"; + public static final String TYPE_MESSAGE_BT = "BT message"; + public static final String TYPE_MESSAGE = "Message"; + + // + // Variables for landmarks + // + public static final String TYPE_LANDMARK_XML_ELEMENT = "landmark"; + public static final String TYPE_LANDMARK = "Landmark"; + + // + // Variables for file + // + public static final String TYPE_FILE = "File"; + public static final String TYPE_FILE_XML_ELEMENT = "file"; + + + + + + /** + * List of components able to add to script. This components is shown as list in combo in UI. + * Contact set does not belong to list, because it's handled as separate component. + */ + private String [] components = { + TYPE_CONTACT, + TYPE_CONTACT_GROUP, + TYPE_CONNECTION_METHOD, + TYPE_TODO, + TYPE_APPOINTMENT, + TYPE_EVENT, + TYPE_REMINDER, + TYPE_ANNIVERSARY, + TYPE_MAIL_BOX, + TYPE_MESSAGE_SMS, + TYPE_MESSAGE_MMS, + TYPE_MESSAGE_AMS, + TYPE_MESSAGE_EMAIL, + TYPE_MESSAGE_SMART, + TYPE_MESSAGE_IR, + TYPE_MESSAGE_BT, + TYPE_NOTE, + TYPE_BOOKMARK, + TYPE_BOOKMARK_FOLDER, + TYPE_SAVED_PAGE, + TYPE_SAVED_PAGE_FOLDER, + TYPE_LOG, + TYPE_IMPS_SERVER, + TYPE_LANDMARK, + TYPE_FILE + }; + + + /** + * Private construction + */ + private CreatorEditorSettings(){ + + init(); + + } + + /** + * Initialize entities for forbidden characters + */ + private void init(){ + entityNumbersAndChars = new Hashtable(); + entityNumbersAndChars.put("&", "&" ); + entityNumbersAndChars.put("<", "<" ); + entityNumbersAndChars.put(">", ">" ); + entityNumbersAndChars.put("'", "\'"); + entityNumbersAndChars.put(""", "\""); + + entityNamesAndChars = new Hashtable(); + entityNamesAndChars.put("&", "&" ); + entityNamesAndChars.put("<", "<" ); + entityNamesAndChars.put(">", ">" ); + entityNamesAndChars.put("'", "\'"); + entityNamesAndChars.put(""", "\""); + + } + + + + /** + * Only instance of Settings + * @return CreatorScriptEditorSettings instance + */ + public static CreatorEditorSettings getInstance(){ + if(instance == null){ + instance = new CreatorEditorSettings(); + } + return instance; + } + + /** + * Get Components + * @return components possible to create to script + */ + public String[] getComponents() { + return components; + } + + /** + * Set Components + * @param components possible to create to script + */ + public void setComponents(String[] components) { + this.components = components; + } + + + /** + * Is selected component supported or not. + * @param componentName + * @return true if it's a supported component name false otherwise + */ + public boolean isSupportedComponent(String componentName){ + + boolean isSupported = false; + for (int i = 0; i < components.length; i++) { + if(components[i].equals(componentName)){ + isSupported = true; + break; + } + } + + return isSupported ; + } + + + /** + * Check if a String contains forbidden characters to XML element and attribute content + * @param in + * @return true if contain, false otherwise + */ + public boolean containForbiddenChars(String in){ + + Collection forbiddenChars = entityNumbersAndChars.values(); + for (Iterator iterator = forbiddenChars.iterator(); iterator.hasNext();) { + String forbiddenChar = (String) iterator.next(); + if(in.contains(forbiddenChar)){ + return true; + } + } + return false; + + } + + /** + * Check if a String contains entities matching forbidden chars (e.g. & or &) + * @param in + * @return + */ + public boolean containEntities(String in){ + + Set numKeys = entityNumbersAndChars.keySet(); + for (Iterator iterator = numKeys.iterator(); iterator.hasNext();) { + String key = (String) iterator.next(); + if(in.contains(key)){ + return true; + } + } + + Set nameKeys = entityNamesAndChars.keySet(); + for (Iterator iterator = nameKeys.iterator(); iterator.hasNext();) { + String key = (String) iterator.next(); + if(in.contains(key)){ + return true; + } + } + return false; + + } + + /** + * Replaces entities: + * & and & with & + * < and < with < + * > and > with > + * ' and ' with ' + * " and " with " + * @param in String with entities + * @return out String with entities as characters + */ + public String replaceEntitiesWithChars(String in){ + + if(in == null){ + return in; + } + + String out = new String(in); + Set numKeys = entityNumbersAndChars.keySet(); + for (Iterator iterator = numKeys.iterator(); iterator.hasNext();) { + String key = (String) iterator.next(); + out = out.replace(key, entityNumbersAndChars.get(key)); + } + + Set nameKeys = entityNamesAndChars.keySet(); + for (Iterator iterator = nameKeys.iterator(); iterator.hasNext();) { + String key = (String) iterator.next(); + out = out.replace(key, entityNamesAndChars.get(key)); + } + + return out; + + } + + /** + * Checks that there are no forbidden characters and replaces with valid + * ones if needed. Chars that will be replaced: &, <, >, ", ' + * + * @param in + * String to be checked. + * @return Returns checked and corrected string. + */ + public String replaceForbiddenChars(String in) { + + if(in == null){ + return in; + } + + StringBuffer b = new StringBuffer(); + char[] arr = in.toCharArray(); + for (int i = 0; i < arr.length; i++) { + + if (arr[i] == '<') { + b.append("<"); + } else if (arr[i] == '>') { + b.append(">"); + } else if (arr[i] == '&') { + b.append("&"); + } else if (arr[i] == '\"') { + b.append("""); + } else if (arr[i] == '\'') { + b.append("'"); + } else { + b.append(arr[i]); + } + + } + return b.toString(); + + } + + /** + * + * @param key + * (type in UI format or in XML element name) + * @return true if key is one of contact set reference types + * (TYPE_CONTACT_SET_REFERENCE, TYPE_CONTACT_SET_REFERENCE_FROM or + * TYPE_CONTACT_SET_REFERENCE_TO) false otherwise. + */ + public static boolean isContactSetReference(String key) { + if (key != null && ( key.equals(TYPE_CONTACT_SET_REFERENCE) + || key.equals(TYPE_CONTACT_SET_REFERENCE_FROM) + || key.equals(TYPE_CONTACT_SET_REFERENCE_TO) + || key.equals(TYPE_CONTACT_SET_REFERENCE_XML_ELEMENT) + || key.equals(CalendarVariables.ATTENDEE_CONTACT_SET_REFERENCE) + )){ + return true; + } + else{ + return false; + } + } + + /** + * Check if value is randomText + * @param randomTxt + * @return true if its random text, false otherwise. + */ + public static boolean isRandomText(String randomTxt) { + + if(randomTxt == null){ + return false; + } + else{ + return randomTxt.equals(AbstractValue.RANDOM_TEXT_DEFAULT_LENGTH) + || randomTxt.equals(AbstractValue.RANDOM_TEXT_DEFAULT_LENGTH_LONG) + || randomTxt.equals(AbstractValue.RANDOM_TEXT_MAX_LENGTH) + || randomTxt.equals(AbstractValue.RANDOM_TEXT_MAX_LENGTH_LONG) + || randomTxt.equals(AbstractValue.RANDOM_TEXT_USER_DEFINED_LENGTH) + || randomTxt.equals(AbstractValue.RANDOM_TEXT_USER_DEFINED_LENGTH_LONG) + || randomTxt.equals(AbstractValue.RANDOM_TEXT) + || randomTxt.equals("<RND>"); + } + } + + +} diff -r 000000000000 -r 61163b28edca creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/dialogs/AbstractDialog.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/dialogs/AbstractDialog.java Tue Jan 12 13:17:53 2010 -0600 @@ -0,0 +1,3015 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.s60tools.creator.dialogs; + +import java.util.Iterator; +import java.util.Set; +import java.util.Vector; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.window.IShellProvider; +import org.eclipse.swt.SWT; +import org.eclipse.swt.SWTException; +import org.eclipse.swt.custom.CCombo; +import org.eclipse.swt.custom.TableEditor; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.events.VerifyEvent; +import org.eclipse.swt.events.VerifyListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.layout.RowLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.Widget; +import org.eclipse.ui.PlatformUI; + +import com.nokia.s60tools.creator.CreatorActivator; +import com.nokia.s60tools.creator.CreatorHelpContextIDs; +import com.nokia.s60tools.creator.components.AbstractComponent; +import com.nokia.s60tools.creator.components.AbstractValue; +import com.nokia.s60tools.creator.components.AbstractVariables; +import com.nokia.s60tools.creator.components.AbstractValue.ModeTypes; +import com.nokia.s60tools.creator.components.calendar.Calendar; +import com.nokia.s60tools.creator.components.contact.Contact; +import com.nokia.s60tools.creator.components.contact.ContactGroup; +import com.nokia.s60tools.creator.components.contact.ContactSet; +import com.nokia.s60tools.creator.components.contact.ContactSetVariables; +import com.nokia.s60tools.creator.components.messaging.MailBox; +import com.nokia.s60tools.creator.components.messaging.MailBoxVariables; +import com.nokia.s60tools.creator.components.messaging.Message; +import com.nokia.s60tools.creator.core.CreatorEditorSettings; +import com.nokia.s60tools.creator.editors.CreatorScriptEditor; +import com.nokia.s60tools.creator.editors.IAddComponentListener; +import com.nokia.s60tools.creator.editors.IComponentProvider; +import com.nokia.s60tools.creator.util.CreatorEditorConsole; + +/** + * + */ +public abstract class AbstractDialog extends Dialog { + + + // + // Variables for UI texts (column topics) + // + protected static final String AMOUNT_TXT = "Amount"; + protected static final String MODE_TXT = "Mode"; + protected static final String ITEM_VALUE_TXT = "Item value"; + protected static final String ITEM_TYPE_TXT = "Item type"; + protected static final String CLEAR_TXT = "Clear"; + + // + // Variables for UI component lengths + // + protected static final int TEXT_FIELD_LENGTH = 200; + protected static final int AMOUNT_FIELD_LENGTH = 50; + private static final int COLUMN_WIDTH_FOR_ONE_CHAR = 10; + + // + // Help texts for UI + // + public static final String POSSIBLE_VALUES_FOR_TXT_PART_1 = "Possible values for '"; + public static final String POSSIBLE_VALUES_FOR_TXT_PART_2 = "' are: "; + public static final String POSSIBLE_VALUES_FOR_TXT_PART_3 = "."; + + + public static final String MAX_AMOUNT_TEXT = "Max amount"; + public static final String AMOUNT_FIELD_INFO_TEXT = "If amount field is empty, amount 1 is used."; + + + // + // UI texts + // + private static final String RANDOM_LEN_MAX = "Max"; + private static final String RANDOM_LEN_DEFAULT = "Default"; + private static final String SET_RANDOM_TXT = "Set random"; + private static final String ADD_ROW_TXT = "Add row"; + + + /** + * Unexpected error message + */ + private static final String UNEXPECTED_ERROR_WHEN_CREATING_TABLE_AREA_ERROR_WAS = + "Unexpected error when creating table area, error was: "; + + + /** + * How many lines is shown in dialog by default + */ + private static final int INITIAL_ITEMS_NUMBER_IN_TABLE = 20; + /** + * How many items can be in combo (max) + */ + private static final int MAX_ITEMS_IN_COMBO = 30; + + + /** + * UI help text for refering to connection method + */ + public static final String CONNECTION_METHOD_NAME_HELP_TEXT = POSSIBLE_VALUES_FOR_TXT_PART_1 + +MailBoxVariables.CONNECTION_METHOD_NAME + +POSSIBLE_VALUES_FOR_TXT_PART_2 + +"'Default' or any existing " +MailBoxVariables.CONNECTION_METHOD_NAME + +POSSIBLE_VALUES_FOR_TXT_PART_3; + + /** + * UI help text for refering to incoming and outgoing connection method + */ + public static final String CONNECTION_METHOD_NAME_IN_AND_OUT_HELP_TEXT = POSSIBLE_VALUES_FOR_TXT_PART_1 + +MailBoxVariables.INCOMING_CONNECTIONMETHOD_NAME + + " and " + +MailBoxVariables.OUTGOING_CONNECTIONMETHOD_NAME + +POSSIBLE_VALUES_FOR_TXT_PART_2 + +"'Default' or any existing " +MailBoxVariables.CONNECTION_METHOD_NAME + +POSSIBLE_VALUES_FOR_TXT_PART_3; + + + // + // private fields + // + + private AbstractComponent component = null; + private boolean isInEditMode; + private Color white; + private Color grey; + protected Table itemsTable; + protected Text amoutTxtToComponent; + + private boolean isAmountFieldsEnabled = true; + private boolean isRandomFieldsEnabled = true; + private IComponentProvider provider = null; + private CCombo linkToOtherComponentCombo = null; + private boolean isTableEnabled = true; + private String tableColumnHeaderAmount; + private Text extraNbrToComponent = null; + private Text extraTxtToComponent = null; + private String labelForExtraNumberField; + private String labelForExtraTextField; + private boolean wasErrorsWithDatas = false; + private Button addContactSetButton = null; + private Button addRowButton; + + + /** + * errors + */ + private Vector errors = null; + + /** + * @param parentShell + */ + private AbstractDialog(IShellProvider parentShell) { + super(parentShell); + throw new RuntimeException("Not accepted"); + } + + /** + * @param parentShell + */ + private AbstractDialog(Shell parentShell) { + super (parentShell); + throw new RuntimeException("Not accepted"); + } + + + /** + * @param parentShell + * @param component + */ + public AbstractDialog(Shell parentShell, IComponentProvider provider){ + super(parentShell); + this.provider = provider; + init(); + } + + /** + * @param parentShell + * @param component + */ + public AbstractDialog(IShellProvider parentShell, IComponentProvider provider){ + super(parentShell); + this.provider = provider; + init(); + } + + + /** + * Init + */ + private void init(){ + RGB rgbWhite = new RGB(255, 255, 255); + white = new Color(null, rgbWhite); + + //Get grey color from parent + grey = super.getParentShell().getBackground(); + + setInEditMode(provider.isInEditMode()); + if(isInEditMode){ + this.component = provider.getEditable(); + } + + tableColumnHeaderAmount = AMOUNT_TXT; + } + + /** + * Set context sensitive help id + * @param control + * @param id + */ + protected void setContextSensitiveHelpID(Control control, String id){ + + PlatformUI.getWorkbench().getHelpSystem().setHelp(control,id); + + } + /** + * Set context sensitive help id to item by component type + * @param control + */ + protected void setContextSensitiveHelpIDByComponentType(Control control){ + + if(getComponent() instanceof ContactSet){ + PlatformUI.getWorkbench().getHelpSystem().setHelp(control,CreatorHelpContextIDs.CREATOR_HELP_CONTACT_SET); + }else if(getComponent() instanceof Contact || getComponent() instanceof ContactGroup){ + PlatformUI.getWorkbench().getHelpSystem().setHelp(control,CreatorHelpContextIDs.CREATOR_HELP_CONTACTS); + }else if(getComponent() instanceof Message){ + PlatformUI.getWorkbench().getHelpSystem().setHelp(control,CreatorHelpContextIDs.CREATOR_HELP_MESSAGES); + }else if(getComponent() instanceof Calendar){ + PlatformUI.getWorkbench().getHelpSystem().setHelp(control,CreatorHelpContextIDs.CREATOR_HELP_CALENDAR); + }else{ + PlatformUI.getWorkbench().getHelpSystem().setHelp(control,CreatorHelpContextIDs.CREATOR_HELP_GENERIC_COMPONENT); + } + + } + + /** + * SuperClass for all Dialogs holds instance to component created or edited. + * Implementing classes will know what type of {@link AbstractComponent} needs to be handle. + * @return component + */ + public AbstractComponent getComponent() { + return component; + } + + + + /** + * Set component + * @param component + */ + protected void setComponent(AbstractComponent component) { + this.component = component; + } + + /** + * Every dialog must be able to create a new Component by it's own type. + * @return AbstractComponent + */ + protected abstract AbstractComponent createNewComponent(); + + /** + * Every dialog must be able to create a new Value by it's own type. + * @return AbstractValue + */ + protected abstract AbstractValue createNewValue(String type, String value, String random, String amount); + + /** + * Is Dialog in Edit mode (or add new mode) + * @return true if dialog is in edit mode, false otherwise + */ + protected boolean isInEditMode() { + return isInEditMode; + } + + + /** + * Set Dialog to edit mode + * @param isInEditMode true if Dialog is in edit mode + */ + protected void setInEditMode(boolean isInEditMode) { + this.isInEditMode = isInEditMode; + } + + + /** + * Selects given value as default to Combo + * @param values + * @param combo + * @param value + */ + protected void setComboSelection(String[] values, CCombo combo, String value) { + if (values!= null && combo != null && value != null && !value.equals(AbstractValue.EMPTY_STRING)) { + for (int i = 0; i < values.length; i++) { + if (value.equalsIgnoreCase(values[i])) { + combo.select(i); + break; + } + } + } + } + + /* (non-Javadoc) + * @see org.eclipse.jface.window.Window#open() + */ + public int open(){ + return super.open(); + } + + /** + * @return Listener for making sure that text field contains only numbers + * Also back space and delete buttons is allowed + */ + protected VerifyListener getNumberVerifyListener() { + return new VerifyListener() { + public void verifyText(VerifyEvent e) { + char c = e.character; + int i = c; // 0=48, 9=57, del = 127, backspace = 8 + //If event is "" it's a clear command and must be accepted, otherwise only numbers, del and backspace is accepted commands + if ((e.text != null && e.text.equals(AbstractValue.EMPTY_STRING) )|| (i >= 48 && i <= 57) || i == 8 || i == 127) { + e.doit = true;// If text is not number, don't do it (set + // text just typed) + } else { + e.doit = false; + } + } + }; + } + + /** + * Check if valueText should be enabled or not and setting text to it + * + * @param valueTxt + * @param randomTxt + */ + protected void setValueTextAndEnabling(final Text valueTxt, + String txtToValue, String randomTxt) { + + //just in case taking of valueText size limit, if there was user defined on, other text will be also limited + valueTxt.setTextLimit(Text.LIMIT); + + // If random is selected, text field is disabled and showing that random + // mode is on + if (randomTxt.equals(AbstractValue.RANDOM_TEXT_DEFAULT_LENGTH) + || randomTxt + .equals(AbstractValue.RANDOM_TEXT_DEFAULT_LENGTH_LONG)) + { + removeNumberVerifyListener(valueTxt);//If there is number verify listener, that must be removed + valueTxt.setText(AbstractValue.RANDOM_TEXT_DEFAULT_LENGTH_LONG); + valueTxt.setEnabled(false); + } + else if (randomTxt.equals(AbstractValue.RANDOM_TEXT_MAX_LENGTH) + || randomTxt.equals(AbstractValue.RANDOM_TEXT_MAX_LENGTH_LONG)) + { + removeNumberVerifyListener(valueTxt);//If there is number verify listener, that must be removed + valueTxt.setText(AbstractValue.RANDOM_TEXT_MAX_LENGTH_LONG); + valueTxt.setEnabled(false); + } + else if (randomTxt.equals(AbstractValue.RANDOM_TEXT_USER_DEFINED_LENGTH) + || randomTxt.equals(AbstractValue.RANDOM_TEXT_USER_DEFINED_LENGTH_LONG)) + { + valueTxt.setEnabled(true); + try { + Integer.parseInt(txtToValue); + valueTxt.setText(txtToValue); + } catch (NumberFormatException e) { + // When there was a text, an error will occur, skipping that one + valueTxt.setText("" +AbstractValue.USER_DEFINED_DEFAULT_LENGTH); + valueTxt.setFocus(); + valueTxt.selectAll(); + } + //even if given data was valid or not, we add verify listener + finally{ + //We need number verify listener when user defined len is selected + valueTxt.addVerifyListener(getNumberVerifyListener()); + //When field is for custom random length field, text limit will be 9 + valueTxt.setTextLimit(9); + } + } + + // If just started edit mode, must put initial value to txt field + else if (txtToValue != null && txtToValue.trim().length() > 0) { + removeNumberVerifyListener(valueTxt);//If there is number verify listener, that must be removed + valueTxt.setEnabled(true); + valueTxt.setText(CreatorEditorSettings.getInstance() + .replaceEntitiesWithChars(txtToValue)); + } + // else value must be enabled, and if there was a random mode txt, + // cleaning in + else { + removeNumberVerifyListener(valueTxt);//If there is number verify listener, that must be removed + valueTxt.setEnabled(true); + if (valueTxt.getText() != null + && (valueTxt.getText().equals( + AbstractValue.RANDOM_TEXT_DEFAULT_LENGTH) + || valueTxt.getText().equals(AbstractValue.RANDOM_TEXT_DEFAULT_LENGTH_LONG) + || valueTxt.getText().equals(AbstractValue.RANDOM_TEXT_MAX_LENGTH)) + || valueTxt.getText().equals(AbstractValue.RANDOM_TEXT_MAX_LENGTH_LONG) + ) + { + valueTxt.setText(AbstractValue.EMPTY_STRING); + } + } + + + } + + /** + * Check if valueText should be enabled or not and setting text to it + * + * @param valueCombo + * @param randomTxt + */ + protected void setValueTextAndEnabling(final CCombo valueCombo, + String txtToValue, String randomTxt, String typeComboSelection) { + + + // If random is selected, text field is disabled and showing that random + // mode is on. With fixed values, random lenght cannot be definede, so it allways is + //random with default lenght + boolean isRandomValue = CreatorEditorSettings.isRandomText(randomTxt); + + if (isRandomValue ) + { + valueCombo.setText(AbstractValue.RANDOM_TEXT_DEFAULT_LENGTH_LONG); + valueCombo.setEnabled(false); + } + + + // If just started edit mode, must put initial value to txt field + else if (txtToValue != null && txtToValue.trim().length() > 0) { + + //When type is contact set reference, selection must be done with contactsetref as String, not by its value, which is just its id, e.g. "1" + boolean isContactSetReference = CreatorEditorSettings.isContactSetReference(typeComboSelection); + String selection; + if(isContactSetReference){ + selection = getContactSetStringById(txtToValue); + }else{ + selection = txtToValue; + } + valueCombo.setEnabled(true); + valueCombo.setText(AbstractValue.EMPTY_STRING); + String items[] = valueCombo.getItems(); + if(isContactSetReference && selection == null){ + valueCombo.setText(AbstractValue.EMPTY_STRING); + String errMsg = typeComboSelection + +" can not be set, because contact-set: '" +txtToValue +"' was not found."; + CreatorEditorConsole.getInstance().println(errMsg , CreatorEditorConsole.MSG_ERROR); + addError(errMsg); + + }else{ + for (int i = 0; i < items.length; i++) { + if(selection.equalsIgnoreCase(items[i])){ + valueCombo.setText(selection); + break; + } + } + } + + } + // else value must be enabled, and if there was a random mode txt, + // cleaning in + else { + valueCombo.setEnabled(true); + if (valueCombo.getText() != null + && (valueCombo.getText().equals( + AbstractValue.RANDOM_TEXT_DEFAULT_LENGTH) + || valueCombo.getText().equals(AbstractValue.RANDOM_TEXT_DEFAULT_LENGTH_LONG) + || valueCombo.getText().equals(AbstractValue.RANDOM_TEXT_MAX_LENGTH)) + || valueCombo.getText().equals(AbstractValue.RANDOM_TEXT_MAX_LENGTH_LONG) + || valueCombo.getText().equals(AbstractValue.RANDOM_TEXT) + ) + { + valueCombo.setText(AbstractValue.EMPTY_STRING); + } + } + + + } + + /** + * Remove verify listener(s) from widget + * @param widget + */ + private void removeNumberVerifyListener(final Widget widget) { + if( widget.isListening(SWT.Verify)){ + Listener [] listeners = widget.getListeners(SWT.Verify); + for (int i = 0; i < listeners.length; i++) { + widget.removeListener(SWT.Verify, listeners[i]); + } + } + } + + + /** + * @return white color + */ + protected Color getWhite() { + return white; + } + + /** + * @return grey color + */ + protected Color getGrey() { + return grey; + } + + /** + * Create table columns with header names: + * Item Type, Item Value, Random, Amount + */ + protected void createTableColums() { + // + //Create columns, set column widths + // + TableColumn columnType = new TableColumn(itemsTable, SWT.NONE); + columnType.setWidth (200); + columnType.setText(ITEM_TYPE_TXT); + TableColumn columnValue = new TableColumn(itemsTable, SWT.NONE); + columnValue.setWidth (300); + columnValue.setText(ITEM_VALUE_TXT); + TableColumn columnMode = new TableColumn(itemsTable, SWT.CENTER); + columnMode.setWidth (180); + columnMode.setText(MODE_TXT); + TableColumn columnAmount = new TableColumn(itemsTable, SWT.NONE); + columnAmount.setWidth (tableColumnHeaderAmount.length() * COLUMN_WIDTH_FOR_ONE_CHAR); + columnAmount.setText(tableColumnHeaderAmount); + + //REMOVE btn + TableColumn columnRemove = new TableColumn(itemsTable, SWT.NONE); + columnRemove.setWidth (40); + } + + /** + * Create a empty row to table + */ + protected void addRow(boolean openItemType, boolean setFocusToRow) throws Exception{ + addRow(AbstractValue.EMPTY_STRING, AbstractValue.EMPTY_STRING, + AbstractValue.EMPTY_STRING, AbstractValue.EMPTY_STRING, openItemType, setFocusToRow); + } + + /** + * Create a row to table, and setting values to rows (if needed) + * @param key + * @param value + */ + protected void addRow(String key, AbstractValue value, boolean setFocusToRow) throws Exception{ + + String valueStr = value.getValue(); + + if(value.getModeType() == ModeTypes.RandomTypeUserDefinedLength){ + valueStr = "" +value.getRandomValueLenght(); + } + addRow(key, valueStr, value.getModeValueText(), ""+ value.getAmount(), true, setFocusToRow ); + } + + /** + * Get item types allready existing in dialog + * @return + */ + private String [] getAddedItems(){ + + + Vector addedItems = new Vector(); + if(itemsTable != null){ + + TableItem [] items = itemsTable.getItems(); + + for (int i = 0; i < items.length; i++) { + + TableItem item = items[i]; + + if(item != null){ + + String key = item.getText(0); + addedItems.add(key); + + } + } + } + return (String[])addedItems.toArray(new String[0]); + } + + /** + * Get Item types (showable names) as String. + * @return item names + * @param addedItems items allready added to Script + */ + private String [] getItemTypesAsString(String [] addedItems){ + + String[] itemsString = getItemTypesAsString(); + + if(addedItems == null || addedItems.length == 0){ + return itemsString; + } + + Vector items = new Vector(itemsString.length); + for (int i = 0; i < itemsString.length; i++) { + items.add(itemsString[i]); + } + + //Checking what items are currently added and what is supporting only one item in one script + + for (int i = 0; i < addedItems.length; i++) { + int itemMaxOccur = getComponent().itemMaxOccur(addedItems[i]); + + if(itemMaxOccur == 1){ + items.remove(addedItems[i]); + } + } + + return (String[]) items.toArray(new String[0]); + } + + + /** + * Check item amount enablation by item name + * @param itemName + * @param amout Text + * @return true if enabled, false otherwise. + */ + private void setAmountTextEnabletion(String itemName, Text amountText){ + + int itemMaxOccur = getComponent().itemMaxOccur(itemName); + boolean enable = (itemMaxOccur == 1) ? false : true; + amountText.setEnabled(enable); + + if(!enable){ + amountText.setBackground(getGrey()); + }else{ + amountText.setBackground(getWhite()); + } + + } + + /** + * Get Item types (showable names) as String. + * @return item names + */ + protected abstract String [] getItemTypesAsString(); + + /** + * Get Item values (showable names) + * @param itemType - one of types given by {@link #getItemTypesAsString()} + * @return item names if itemType has fixed values or contac-set references + * or null if itemType has no fixed values. + */ + private String [] getItemValueAsString(String itemType){ + + String[] valuesForItemType; + + //If item is contact set reference, returning + if(CreatorEditorSettings.isContactSetReference(itemType)){ + valuesForItemType = getContactSetsAsString(); + if(valuesForItemType == null){ + valuesForItemType=new String[]{AbstractValue.EMPTY_STRING}; + } + } + else{ + valuesForItemType = getComponent().getValuesForItemType(itemType); + } + return valuesForItemType; + } + + + + /** + * Create a row to table, and setting values to rows (if needed) + * @param key + * @param value + * @param randomValueText + * @param amount + */ + private void addRow(String key, String value, String randomValueText, + String amount, boolean openItemType, boolean setFocusToRow) throws Exception{ + + String[] allreadyAddedItems = getAddedItems(); + String[] itemTypesAsString = getItemTypesAsString(allreadyAddedItems); + + //If there is allready all items supported added to table, adding row wont affect (Might occurr when "Add Row" is pushed + if(itemTypesAsString == null || itemTypesAsString.length < 1 + && key.equals(AbstractValue.EMPTY_STRING) && value.equals(AbstractValue.EMPTY_STRING)){ + return; + } + + final TableItem item = new TableItem (itemsTable, SWT.NONE); + final int itemIndex = itemsTable.indexOf(item); + + + // + //CCombo for selecting item type + // + + TableEditor typeComboEditor = new TableEditor(itemsTable); + // Item names + final CCombo typeCombo = new CCombo(itemsTable, SWT.READ_ONLY); + //Allready added items will be update after all lines are added. + typeCombo.setItems(itemTypesAsString); + int visibleItemsCount = itemTypesAsString.length; + if(visibleItemsCount > 30){ + visibleItemsCount=30; + } + typeCombo.setVisibleItemCount(visibleItemsCount); + final String typeComboSelection = getTypeComboSelection(key, itemIndex, openItemType); + typeCombo.setText(typeComboSelection);//// Select the previously selected item from the cell: combo.select(combo.indexOf(item.getText(column))); + typeCombo.setBackground(getWhite()); + item.setText(0, typeCombo.getText()); + + typeComboEditor.grabHorizontal = true; + typeComboEditor.setEditor(typeCombo, item, 0); + + + // + //Text for typing item value + // + TableEditor valueEditor = new TableEditor(itemsTable); + + //checking if text or combo is needed + String [] fixedValuesForType = getItemValueAsString(typeComboSelection); + boolean isValuesInCombo = fixedValuesForType != null && fixedValuesForType.length > 0; + Text valueTxt = null; + CCombo valueCombo = null; + + if(isValuesInCombo){ + // Adding action to clear Button + valueCombo = addValueComboToTable(fixedValuesForType, value, + item, randomValueText, typeComboSelection); + valueEditor.grabHorizontal = true; + valueEditor.setEditor(valueCombo, item, 1); + + + }else{ + valueTxt = createValueText(value, randomValueText, + setFocusToRow, item, typeComboSelection); + valueEditor.grabHorizontal = true; + valueEditor.setEditor(valueTxt, item, 1); + + } + + + // + // CCombo for Random value selection. + // + // selecting random, max len, normal len, or no selection. + // If random is selected, disabling item value combo + // + + TableEditor modeEditor = new TableEditor(itemsTable); + final CCombo modeCombo = new CCombo(itemsTable, SWT.READ_ONLY ); + String[] modeValues = getModeValues(isValuesInCombo, typeComboSelection); + modeCombo.setItems(modeValues); + + modeCombo.setText(getModeComboSelection(randomValueText, modeValues)); + + item.setText(2, modeCombo.getText()); + modeCombo.setBackground(getWhite()); + + modeEditor.grabHorizontal = true; + modeEditor.setEditor(modeCombo, item, 2); + + modeCombo.setEnabled(isRandomFieldsEnabled); + if(!isRandomFieldsEnabled){ + modeCombo.setBackground(getGrey()); + }else{ + modeCombo.setBackground(getWhite()); + } + + // + //Text field for Amount text + // + + TableEditor amountEditor = new TableEditor(itemsTable); + final Text amountTxt = new Text(itemsTable, SWT.NONE); + amountTxt.setTextLimit(5); + //don't show if amount is not set (is 0) + if(!amount.equals("0")){ + amountTxt.setText(amount); + } + item.setText(3, amountTxt.getText()); + + // Verify that amount is typed with numbers + amountTxt.addVerifyListener(getNumberVerifyListener()); + + //Update item when modify + amountTxt.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + item.setText(3, amountTxt.getText()); + } + }); + + //In some cases amount fields is not enabled. + //Future improvement idea, possibility to enable/disable amountTxt by selected type. + if(CreatorEditorSettings.isContactSetReference(key) || CreatorEditorSettings.isContactSetReference(typeComboSelection)){ + amountTxt.setEnabled(true);//always enabled with contact set reference + modeCombo.setEnabled(false); + modeCombo.setBackground(getGrey()); + } + else if(!isAmountFieldsEnabled){ + setModeComboEnablation(typeComboSelection, modeCombo); + amountTxt.setEnabled(isAmountFieldsEnabled); + } + else{ + setModeComboEnablation(typeComboSelection, modeCombo); + setAmountTextEnabletion(typeComboSelection, amountTxt); + } + + + amountEditor.grabHorizontal = true; + amountEditor.setEditor(amountTxt, item, 3); + + // + // Remove btn + // + TableEditor clrBtnEditor = new TableEditor(itemsTable); + final Button clearBtn = new Button(itemsTable, SWT.PUSH); + clearBtn.setLayoutData(new GridData( GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL)); + clearBtn.setFont(getButtonFont()); + clearBtn.setText(CLEAR_TXT); + clearBtn.pack ();//This must be called, otherwise button is not visible + clrBtnEditor.minimumWidth = clearBtn.getSize ().x + 5;//Using +5 to fit button precisely to column + clrBtnEditor.horizontalAlignment = SWT.CENTER; + + + //Setting all listeners to item value, depending on item type, listeners will be for + //Text or CCombo type of value. + setItemValueListeners(item, clrBtnEditor, valueEditor, typeCombo, fixedValuesForType, + isValuesInCombo, valueTxt, valueCombo, modeCombo, amountTxt, + clearBtn); + + clrBtnEditor.setEditor(clearBtn, item, 4); + + // Update item when modify + typeCombo.addSelectionListener(new TypeComboSelectionListener(item, + clrBtnEditor, valueEditor, typeCombo, valueTxt, valueCombo, + modeCombo, amountTxt, clearBtn)); + + itemsTable.addListener(SWT.SetData, new TypeComboItemsSetterListener(typeCombo)); + + setContextSensitiveHelpIDByComponentType(typeCombo); + setContextSensitiveHelpID(modeCombo, CreatorHelpContextIDs.CREATOR_HELP_RANDOM_VALUES); + setContextSensitiveHelpIDByComponentType(amountTxt); + setContextSensitiveHelpIDByComponentType(clearBtn); + } + + private void setModeComboEnablation(final String typeComboSelection, + final CCombo modeCombo) { + boolean isModeEnabled = getComponent().getVariables().isModeEnabledForKey(typeComboSelection); + modeCombo.setEnabled(isModeEnabled); + if(!isModeEnabled){ + modeCombo.setBackground(getGrey()); + }else{ + modeCombo.setBackground(getWhite()); + } + } + + /** + * Get selection for mode combo + * @param modeText + * @param modeValues + * @return + */ + private String getModeComboSelection(String modeText, String [] modeValues) { + + if(modeText != null && !modeText.equals(AbstractValue.EMPTY_STRING)){ + for (int i = 0; i < modeValues.length; i++) { + if(modeText.equalsIgnoreCase(modeValues[i])){ + return modeText; + } + } + } + + return modeValues[0]; + } + + /** + * Get values for mode combo + * @param isValuesInCombo + * @param typeComboSelection + * @return values for mode combo + */ + private String[] getModeValues(boolean isValuesInCombo, String typeComboSelection) { + + boolean incValueSupported = isTypeSupportingIncValueForeEachCopy(typeComboSelection); + + String[] modeValues; + + if(!incValueSupported && isValuesInCombo){ + modeValues = AbstractValue.getModeValuesForFixedValues(); + } + else if(!incValueSupported){ + modeValues = AbstractValue.getModeValues(); + } + //else incValueSupported == true + else{ + modeValues = AbstractValue.getModeValuesForSupportingIncValueForeEachCopy(); + } + + return modeValues; + } + + /** + * Check if component is supporting incvalueforeachcopy parameter. + * @param type + * @return true if supporting. + */ + private boolean isTypeSupportingIncValueForeEachCopy (String type){ + + return getComponent().isTypeSupportingIncValueForEachCopy(type); + + } + + /** + * Set listeners related to value item (Text or CCombo) + * @param item + * @param clrButtonEditor + * @param valueEditor + * @param typeCombo + * @param fixedValuesForType + * @param isValuesInCombo + * @param valueTxt + * @param valueCombo + * @param modeCombo + * @param amountTxt + * @param clearBtn + */ + private void setItemValueListeners(final TableItem item, + TableEditor clrButtonEditor, TableEditor valueEditor, final CCombo typeCombo, + String[] fixedValuesForType, boolean isValuesInCombo, + Text valueTxt, CCombo valueCombo, final CCombo modeCombo, + final Text amountTxt, final Button clearBtn) { + + // + //First remove existing listeners, so there will be no extra listeners with non existing objects + // + + Listener[] listeners = modeCombo.getListeners(SWT.Selection); + for (int i = 0; i < listeners.length; i++) { + modeCombo.removeListener(SWT.Selection, listeners[i]); + } + listeners = clearBtn.getListeners(SWT.Selection); + for (int i = 0; i < listeners.length; i++) { + clearBtn.removeListener(SWT.Selection, listeners[i]); + } + listeners = item.getListeners(SWT.Modify); + for (int i = 0; i < listeners.length; i++) { + item.removeListener(SWT.Modify, listeners[i]); + } + if(valueCombo != null){ + listeners = valueCombo.getListeners(SWT.SetData); + for (int i = 0; i < listeners.length; i++) { + valueCombo.removeListener(SWT.SetData, listeners[i]); + } + } + + + if(isValuesInCombo){ + + valueCombo.setVisibleItemCount(fixedValuesForType.length); + + //Update item text when text is modified (and random Combo when value text is modified by fulfill random button) + valueCombo.addModifyListener( new ValueModifyListener(item, valueCombo, typeCombo)); + //Add listener to check this value enablation by selection of another value + item.addListener(SWT.Modify, new CheckItemValueEnablationsListener(typeCombo, valueCombo, modeCombo, amountTxt)); + + + //Update value text item text when combo selection is changed + modeCombo.addSelectionListener(new ModeComboSelectionListener(modeCombo, valueCombo, item)); + item.addListener(SWT.Modify, new SetAsRandomValueItemListener(item, valueCombo, modeCombo)); + + // Adding action to clear Button + clearBtn.addSelectionListener(getClearButtonSelectionListener(item, typeCombo, valueCombo, modeCombo, + amountTxt)); + + //Adding listener to update items when new contact set is created, if there is contactSet creation button, and + //if we have contact set reference as type. + if(addContactSetButton != null && CreatorEditorSettings.isContactSetReference(typeCombo.getText())){ + addContactSetButton.addListener(SWT.SetData, new AddNewContactSetButtonListener(valueCombo)); + } + + + }else{ + //Update item text when text is modified (and random Combo when value text is modified by fulfill random button) + valueTxt.addModifyListener( new ValueModifyListener(item, valueTxt, typeCombo)); + //Add listener to check this value enablation by selection of another value + item.addListener(SWT.Modify, new CheckItemValueEnablationsListener(typeCombo, valueTxt, modeCombo, amountTxt)); + + //Update value text item text when combo selection is changed + modeCombo.addSelectionListener(new ModeComboSelectionListener(modeCombo, valueTxt, item)); + //When fulfill all values with random -button modifies values, setting also combo and text field values + item.addListener(SWT.Modify, new SetAsRandomValueItemListener(item, valueTxt, modeCombo)); + + // Adding action to clear Button + clearBtn.addSelectionListener(getClearButtonSelectionListener(item, typeCombo, valueTxt, modeCombo, + amountTxt)); + + } + + } + + + + /** + * Creates a value text + * @param value + * @param randomValueText + * @param setFocusToRow + * @param item + * @param typeComboSelection + * @return + */ + private Text createValueText(String value, String randomValueText, + boolean setFocusToRow, final TableItem item, String typeComboSelection) { + final Text valueTxt = new Text(itemsTable, SWT.NONE); + valueTxt.setFont(getUnicodeFont()); + setValueTextAndEnabling(valueTxt, value, randomValueText); + if(setFocusToRow){ + valueTxt.setFocus(); + } + item.setText(1, valueTxt.getText()); + if(CreatorEditorSettings.isContactSetReference(valueTxt.getText())){ + setContextSensitiveHelpID(valueTxt, CreatorHelpContextIDs.CREATOR_HELP_CONTACT_SET); + }else{ + setContextSensitiveHelpIDByComponentType(valueTxt); + } + + setTipTextToValue(valueTxt, typeComboSelection); + + return valueTxt; + } + + /** + * Sets tip text to value if needed + * @param valueTxt + * @param typeComboSelection + */ + private void setTipTextToValue(Text valueTxt, String typeComboSelection) { + AbstractVariables var = getComponent().getVariables(); + String tipText = var.getTipText(typeComboSelection); + if(tipText != null){ + valueTxt.setToolTipText(tipText); + } + } + + /** + * Listener for mode selection combo + */ + private class ModeComboSelectionListener implements SelectionListener{ + + private CCombo modeCombo = null; + private Text text = null; + private TableItem item = null; + private CCombo combo = null; + + public ModeComboSelectionListener(final CCombo modeCombo, final Text text, final TableItem item){ + this.modeCombo = modeCombo; + this.text = text; + this.item = item; + + } + public ModeComboSelectionListener(final CCombo modeCombo, final CCombo combo, final TableItem item){ + this.modeCombo = modeCombo; + this.combo = combo; + this.item = item; + + } + + public void widgetSelected(SelectionEvent event) { + + String rndTxt = modeCombo.getText(); + + if(text!=null){ + if(CreatorEditorSettings.isContactSetReference(rndTxt)){ + setContextSensitiveHelpID(text, CreatorHelpContextIDs.CREATOR_HELP_CONTACT_SET); + }else{ + setContextSensitiveHelpIDByComponentType(text); + } + item.setText(2, rndTxt); + setValueTextAndEnabling(text, null, rndTxt); + } + else{ + if(CreatorEditorSettings.isContactSetReference(rndTxt)){ + setContextSensitiveHelpID(combo, CreatorHelpContextIDs.CREATOR_HELP_CONTACT_SET); + }else{ + setContextSensitiveHelpIDByComponentType(combo); + } + combo.setEnabled(false); + item.setText(2, rndTxt); + setValueTextAndEnabling(combo, null, rndTxt, null); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + //Not needed + } + } + + + /** + * Class for listening value text changes + */ + private class ValueModifyListener implements ModifyListener + + { + private TableItem item = null; + private Text valueText = null; + private CCombo valueCombo = null; + private final CCombo typeCombo; + + public ValueModifyListener(TableItem item , Text valueText, final CCombo typeCombo){ + this.item = item; + this.valueText = valueText; + this.typeCombo = typeCombo; + } + public ValueModifyListener(TableItem item , CCombo valueCombo, final CCombo typeCombo){ + this.item = item; + this.valueCombo = valueCombo; + this.typeCombo = typeCombo; + } + public void modifyText(ModifyEvent e) { + + if(valueText != null){ + item.setText(1, valueText.getText()); + } + else{ + item.setText(1, valueCombo.getText()); + //Check that if something must do to some values by the selection + checkIfNeedToCallCheckItemValueEnablationListenersAndCallIfNeeded( + valueCombo, valueText, typeCombo); + + + } + } + + } + + /** + * Just for enabling to cast Events when using set as random functionality + */ + private class SetRandomEvent extends Event{ + + } + + /** + * Just for enabling to cast Event when checking + * if we should disable/enable some valus by some selection made + */ + private class CheckItemValueEnablationsEvent extends Event{ + + private String type; + private String value; + + + /** + * @return the type + */ + public String getType() { + return type; + } + + /** + * @return the value + */ + public String getValue() { + return value; + } + + public void setType(String type) { + this.type = type; + } + + public void setValue(String value) { + this.value = value; + } + + } + + + /** + * Listener class for setting values as random, used by button. + */ + private class SetAsRandomValueItemListener implements Listener{ + + TableItem item = null; + Text valueTxt = null; + CCombo randomCombo = null; + private CCombo valueCombo = null; + + public SetAsRandomValueItemListener(TableItem item, Text valueTxt, CCombo randomCombo){ + this.item = item; + this.valueTxt = valueTxt; + this.randomCombo = randomCombo; + + } + public SetAsRandomValueItemListener(TableItem item,CCombo valueCombo, CCombo randomCombo){ + this.item = item; + this.valueCombo = valueCombo; + this.randomCombo = randomCombo; + + } + + public void handleEvent(Event e) { + + //Checking that if we have wanted event + if(!(e instanceof SetRandomEvent)){ + return; + } + + String txt = item.getText(1); + + //If value is in text, but not in combo + if (valueTxt!=null) { + + if (e.doit) { + removeNumberVerifyListener(valueTxt); + } + if (txt != null) { + setValueTextAndEnablingAndRandomComboSelection(txt, + valueTxt, randomCombo); + } + } + //else value is in combo + else{ + setValueTextAndEnablingAndRandomComboSelection(txt, valueCombo, randomCombo); + } + } + } + + /** + * Listener class for enabling/disabling items by some other value set in dialog. + * E.g. With File, crypted with CRM-FL, then all CRM-CD parameters will be disabled. + */ + private class CheckItemValueEnablationsListener implements Listener{ + + CCombo typeCombo; + Text valueTxt = null; + Text amountTxt = null; + CCombo modeCombo = null; + private CCombo valueCombo = null; + + public CheckItemValueEnablationsListener(CCombo typeCombo, Text valueTxt, CCombo modeCombo, Text amountTxt){ + this.typeCombo = typeCombo; + this.valueTxt = valueTxt; + this.modeCombo = modeCombo; + this.amountTxt = amountTxt; + + } + public CheckItemValueEnablationsListener(CCombo typeCombo,CCombo valueCombo, CCombo modeCombo, Text amountTxt){ + this.typeCombo = typeCombo; + this.valueCombo = valueCombo; + this.modeCombo = modeCombo; + this.amountTxt = amountTxt; + } + + public void handleEvent(Event e) { + + if(! ( e instanceof CheckItemValueEnablationsEvent )){ + return; + } + + CheckItemValueEnablationsEvent event = (CheckItemValueEnablationsEvent)e; + String type = event.getType(); + String value = event.getValue(); + String typeToBeDisabled = typeCombo.getText(); + + enableOrDisableRowItems(type, value, typeToBeDisabled, valueTxt, valueCombo, modeCombo, amountTxt); + + } + + + } + + /** + * Enables or disable items of row + * @param type + * @param value + * @param typeToBeDisabled + * @param valueTxt + * @param valueCombo + * @param modeCombo + */ + private void enableOrDisableRowItems(String type, String value, + String typeToBeDisabled, + Text valueTxt, + CCombo valueCombo, + CCombo modeCombo, Text amountTxt) { + + boolean enableAllValues = !getComponent().isTypeDisabledByTypeAndValue(type, value, typeToBeDisabled); + boolean enableValue = enableAllValues; + + String currentValueTxt; + if (valueTxt!=null) { + currentValueTxt = valueTxt.getText(); + }else{ + currentValueTxt = valueCombo.getText(); + } + + //Check if current value is random value now + boolean isRandomValue = CreatorEditorSettings.isRandomText(currentValueTxt); + //If value is random, and we try to enable values, dont do that + if (isRandomValue && enableAllValues) + { + enableValue = false; + } + + //If value is in text, but not in combo + if (valueTxt!=null) { + valueTxt.setEnabled(enableValue); + } + //else value is in combo + else{ + valueCombo.setEditable(enableValue); + } + + //dont enable mode combo if its not enabled to this type + boolean isModeEnabled = getComponent().getVariables().isModeEnabledForKey(typeToBeDisabled); + if(isModeEnabled){ + modeCombo.setEnabled(enableAllValues); + } + + //amount field can be enabled or disabled if its in use + if(isAmountFieldsEnabled()){ + amountTxt.setEnabled(enableAllValues); + } + } + + /** + * Listener to set items to Type Combo when selection is made + */ + private class TypeComboItemsSetterListener implements Listener{ + + private final CCombo typeCombo; + + public TypeComboItemsSetterListener(CCombo typeCombo){ + this.typeCombo = typeCombo; + + } + + public void handleEvent(Event event) { + + if(event.doit && event.data != null && event.data instanceof String[]){ + String [] items = (String[]) event.data; + String selectionText = typeCombo.getText(); + typeCombo.setItems(items); + int count = items.length; + if(count > MAX_ITEMS_IN_COMBO){ + count = MAX_ITEMS_IN_COMBO; + } + typeCombo.setVisibleItemCount(count); + typeCombo.setText(selectionText); + } + } + + } + + /** + * Get listener for type combo. + * There is logic for changing value field from text to combo and vice versa. + * @param item + * @param typeCombo + * @param valueTxt + * @param randomCombo + * @param amountTxt + * @return + */ + private class TypeComboSelectionListener implements SelectionListener{ + + private TableItem item; + private CCombo typeCombo; + private Text valueTxt; + private Text amountTxt; + private CCombo valueCombo; + private CCombo modeCombo; + private TableEditor valueEditor; + private TableEditor clrBtnEditor; + private final Button clearBtn; + + public TypeComboSelectionListener ( TableItem item, + TableEditor clrButtonEditor, TableEditor valueEditor, CCombo typeCombo, + Text valueTxt, CCombo valueCombo, CCombo modeCombo, + Text amountTxt, Button clearBtn){ + this.clrBtnEditor = clrButtonEditor; + this.valueEditor = valueEditor; + this.item = item; + this.typeCombo = typeCombo; + this.valueTxt = valueTxt; + this.valueCombo = valueCombo; + this.amountTxt = amountTxt; + this.modeCombo = modeCombo; + this.clearBtn = clearBtn; + + } + + + /* (non-Javadoc) + * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) + */ + public void widgetSelected(SelectionEvent event) { + + String typeComboSelection = typeCombo.getText(); + item.setText(0, typeComboSelection); + + String [] fixedValuesForType = getItemValueAsString(typeComboSelection); + //Will values be in combo afterwards + boolean isValuesInCombo = fixedValuesForType != null && fixedValuesForType.length > 0; + //Was value field type changed by user selection? Will be true if before value was text, and now it will be combo and so on... + boolean isValueFieldTypeChanged = + isValuesInCombo && valueCombo == null || !isValuesInCombo && valueTxt == null + ? true : false; + + + if(CreatorEditorSettings.isContactSetReference(typeComboSelection)) + { + amountTxt.setEnabled(true);//always enabled with contact set reference + modeCombo.setEnabled(false); + modeCombo.setText(AbstractValue.RANDOM_TEXT_NOT_RANDOM);//Setting to edit mode when contact-set is selected + modeCombo.setBackground(getGrey()); + + }else if(!isAmountFieldsEnabled){ + amountTxt.setText(AbstractValue.EMPTY_STRING); + amountTxt.setEnabled(isAmountFieldsEnabled); + setModeComboEnablation(typeComboSelection, modeCombo); + }else{ + amountTxt.setText(AbstractValue.EMPTY_STRING); + setAmountTextEnabletion(typeComboSelection, amountTxt); + setModeComboEnablation(typeComboSelection, modeCombo); + } + + + // Just changing contents when value remains in combo + if (isValuesInCombo && !isValueFieldTypeChanged) { + valueCombo.setItems(fixedValuesForType); + valueCombo.setVisibleItemCount(fixedValuesForType.length); + + //When values was in combo and type was changed to contact set, we must set listeners again to listen contact-set changes. + setItemValueListeners(item, clrBtnEditor, valueEditor, typeCombo, fixedValuesForType, + isValuesInCombo, null, valueCombo, modeCombo, amountTxt, + clearBtn); + } + //value remains in text + else if (!isValuesInCombo && !isValueFieldTypeChanged) { + valueTxt.setText(AbstractValue.EMPTY_STRING); + valueTxt.setEnabled(true); + } + //else isValueFieldTypeChanged == true + else{ + //Removing old control when new will be created + Control editable = valueEditor.getEditor(); + editable.dispose(); + + //value changed from text to combo + if (isValuesInCombo ) { + valueCombo = addValueComboToTable(fixedValuesForType, AbstractValue.EMPTY_STRING, + item, AbstractValue.EMPTY_STRING, typeComboSelection); + valueEditor.setEditor(valueCombo, item, 1); + + setItemValueListeners(item, clrBtnEditor, valueEditor, typeCombo, fixedValuesForType, + isValuesInCombo, null, valueCombo, modeCombo, amountTxt, + clearBtn); + valueTxt = null; + + + } else// if (!isValuesInCombo && isValueFieldTypeChanged) + { + valueTxt = createValueText(AbstractValue.EMPTY_STRING, AbstractValue.EMPTY_STRING, true, item, typeComboSelection); + valueTxt.setEnabled(true); + valueEditor.setEditor(valueTxt, item, 1); + + setItemValueListeners(item, clrBtnEditor, valueEditor, typeCombo, null, + isValuesInCombo, valueTxt, null, modeCombo, amountTxt, + clearBtn); + valueCombo = null;//For removing listners + + } + } + + //setting modeCombo values after all other changes are made + String modeComboValues [] = getModeValues(isValuesInCombo, typeComboSelection); + modeCombo.setItems(modeComboValues); + modeCombo.setText(getModeComboSelection(AbstractValue.EMPTY_STRING, modeComboValues)); + item.setText(2, modeCombo.getText()); + + //Notify table listeners to update item combos + notifyTypeComboDataListeners(); + + } + + + //Not needed. + public void widgetDefaultSelected(SelectionEvent e) { + } + } + + /** + * Notify table listeners to update type combo data + */ + private void notifyTypeComboDataListeners() { + + String addedItems[] = getAddedItems();//get items added allready to dialog + String toBeSetItems[] = getItemTypesAsString(addedItems);//get items to be set to all item types + + Event itemsComboUpdateEvent = new Event(); + itemsComboUpdateEvent.doit = true; + itemsComboUpdateEvent.data = toBeSetItems; + + //Enabling / disabling add row button if there is no rows able to add + if(toBeSetItems.length == 0 && addRowButton != null){ + addRowButton.setEnabled(false); + }else if(addRowButton != null){ + addRowButton.setEnabled(true); + }//else no action + + //Notify all type-combos that new data must be set to combos + itemsTable.notifyListeners(SWT.SetData, itemsComboUpdateEvent); + } + + /** + * Get listener for Clear button + * @param item + * @param typeCombo + * @param valueTxt + * @param randomCombo + * @param amountTxt + * @return + */ + private SelectionAdapter getClearButtonSelectionListener( + final TableItem item, final CCombo typeCombo, final Text valueTxt, + final CCombo randomCombo, final Text amountTxt) { + return new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + + + // Clearing data, also item texts must be cleared + typeCombo.setText(AbstractValue.EMPTY_STRING); + item.setText(0, AbstractValue.EMPTY_STRING); + valueTxt.setText(AbstractValue.EMPTY_STRING); + item.setText(1, AbstractValue.EMPTY_STRING); + randomCombo.setText(AbstractValue.EMPTY_STRING); + item.setText(2, AbstractValue.EMPTY_STRING); + amountTxt.setText(AbstractValue.EMPTY_STRING); + item.setText(3, AbstractValue.EMPTY_STRING); + + typeCombo.setEnabled(true); + valueTxt.setEnabled(true); + randomCombo.setEnabled(true); + amountTxt.setEnabled(true); + + randomCombo.setBackground(getWhite()); + + //Notify table listeners to update item combos + notifyTypeComboDataListeners(); + } + }; + } + + /** + * Get listener for Clear button + * @param item + * @param typeCombo + * @param valueCombo + * @param randomCombo + * @param amountTxt + * @return + */ + private SelectionAdapter getClearButtonSelectionListener( + final TableItem item, final CCombo typeCombo, final CCombo valueCombo, + final CCombo randomCombo, final Text amountTxt) { + return new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + + // Clearing data, also item texts must be cleared + typeCombo.setText(AbstractValue.EMPTY_STRING); + item.setText(0, AbstractValue.EMPTY_STRING); + valueCombo.setText(AbstractValue.EMPTY_STRING); + item.setText(1, AbstractValue.EMPTY_STRING); + randomCombo.setText(AbstractValue.EMPTY_STRING); + item.setText(2, AbstractValue.EMPTY_STRING); + amountTxt.setText(AbstractValue.EMPTY_STRING); + item.setText(3, AbstractValue.EMPTY_STRING); + + typeCombo.setEnabled(true); + valueCombo.setEnabled(true); + randomCombo.setEnabled(true); + amountTxt.setEnabled(true); + + randomCombo.setBackground(getWhite()); + + //Notify table listeners to update item combos + notifyTypeComboDataListeners(); + } + }; + } + + + /** + * When "Set Random" button is pushed, and user wants to set all values as random + * editing value field and random combo selection + * @param txt + * @param valueTxt + * @param modeCombo + */ + private void setValueTextAndEnablingAndRandomComboSelection(String txt, + Text valueTxt, CCombo modeCombo) { + + valueTxt.setTextLimit(Text.LIMIT); + + if(txt == null){ + valueTxt.setEnabled(true); + valueTxt.setText(AbstractValue.EMPTY_STRING); + modeCombo.setText(AbstractValue.RANDOM_TEXT_NOT_RANDOM); + } + // If random is selected, text field is disabled and showing that random + // mode is on + + //random mode with default len + else if (txt.equals(AbstractValue.RANDOM_TEXT_DEFAULT_LENGTH) + || txt.equals(AbstractValue.RANDOM_TEXT_DEFAULT_LENGTH_LONG)) { + + valueTxt.setEnabled(false); + valueTxt.setText(AbstractValue.RANDOM_TEXT_DEFAULT_LENGTH_LONG); + modeCombo.setText(AbstractValue.RANDOM_TEXT_DEFAULT_LENGTH); + } + //Random mode with max len + else if (txt.equals(AbstractValue.RANDOM_TEXT_MAX_LENGTH) + || txt.equals(AbstractValue.RANDOM_TEXT_MAX_LENGTH_LONG)) { + valueTxt.setEnabled(false); + valueTxt.setText(AbstractValue.RANDOM_TEXT_MAX_LENGTH_LONG); + modeCombo.setText(AbstractValue.RANDOM_TEXT_MAX_LENGTH); + } + //random mode with user defined len + else if (txt.equals(AbstractValue.RANDOM_TEXT_USER_DEFINED_LENGTH) + || txt.equals(AbstractValue.RANDOM_TEXT_USER_DEFINED_LENGTH_LONG)) { + valueTxt.setEnabled(true); + modeCombo.setText(AbstractValue.RANDOM_TEXT_USER_DEFINED_LENGTH); + } + //mode is RANDOM_TEXT_INC_FOR_EACH_COPY This should not be able to occur, because RANDOM_TEXT_INC_FOR_EACH_COPY + //value are always phone numbers and will be on text field, just in case implemented. + else if (txt.equals(AbstractValue.RANDOM_TEXT_INC_FOR_EACH_COPY)) { + valueTxt.setEnabled(true); + modeCombo.setText(AbstractValue.RANDOM_TEXT_INC_FOR_EACH_COPY); + } + + //default, not random + else{ + valueTxt.setEnabled(true); + valueTxt.setText(txt); + modeCombo.setText(AbstractValue.RANDOM_TEXT_NOT_RANDOM); + } + } + + /** + * Checks values from type and value (from valueTxt if not null or from valuecombo if txt was null) + * and then checks if other items must check they enablations, + * and enables/disables if required + * + * @param txt + * @param valueCombo + * @param typeCombo + */ + private void checkIfNeedToCallCheckItemValueEnablationListenersAndCallIfNeeded( + CCombo valueCombo, Text valueText, CCombo typeCombo) { + + String value; + if(valueCombo != null){ + value = valueCombo.getText(); + }else{ + value = valueText.getText(); + } + String type = typeCombo.getText(); + + callCheckItemValueEnablationListeners(type, value); + } + + /** + * Check all items from itemsTable, and enables/disables those if required by some else values + */ + private void checkIfNeedToCallItemValueEnablationListners(){ + TableItem[] items = itemsTable.getItems(); + //Looping through all items in table + for (int i = 0; i < items.length; i++) { + + TableItem item = items[i]; + if (item != null) { + String type = item.getText(0); + String value = item.getText(1); + + callCheckItemValueEnablationListeners(type, value); + } + } + } + + /** + * Calls listeners to check they values if required by given type and value. + * + * @see AbstractComponent#hasTypeLimitationsForOtherValues(String, String) + * + * @param value + * @param type + */ + private void callCheckItemValueEnablationListeners(String type, String value) { + + //check from component, if that type and value combination needs to call listeners + boolean wakeUpListners = getComponent().hasTypeLimitationsForOtherValues(type, value); + + //If we need to wake up listners, doing so + if(wakeUpListners){ + + TableItem[] items = itemsTable.getItems(); + //Looping through all items in table + for (int i = 0; i < items.length; i++) { + + TableItem item = items[i]; + if (item != null) { + //Creating special event, so other listeners can check that if they are not intressed of this event + CheckItemValueEnablationsEvent e = new CheckItemValueEnablationsEvent(); + e.setType(type); + e.setValue(value); + e.doit = true; + item.notifyListeners(SWT.Modify, e); + } + } + } + } + + /** + * When "Set Random" button is pushed, and user wants to set all values as random + * editing value field and random combo selection + * @param txt + * @param valueCombo + * @param modeCombo + */ + private void setValueTextAndEnablingAndRandomComboSelection(String txt, + CCombo valueCombo, CCombo modeCombo) { + + valueCombo.setTextLimit(Text.LIMIT); + + if(txt == null){ + valueCombo.setEnabled(true); + valueCombo.setText(AbstractValue.EMPTY_STRING); + modeCombo.setText(AbstractValue.RANDOM_TEXT_NOT_RANDOM); + } + // If random is selected, text field is disabled and showing that random + // mode is on + + //random mode with default len + else if (txt.equals(AbstractValue.RANDOM_TEXT_DEFAULT_LENGTH) + || txt.equals(AbstractValue.RANDOM_TEXT_DEFAULT_LENGTH_LONG)) { + + valueCombo.setEnabled(false); + valueCombo.setText(AbstractValue.RANDOM_TEXT_DEFAULT_LENGTH_LONG); + modeCombo.setText(AbstractValue.RANDOM_TEXT_DEFAULT_LENGTH); + } + //Random mode with max len + else if (txt.equals(AbstractValue.RANDOM_TEXT_MAX_LENGTH) + || txt.equals(AbstractValue.RANDOM_TEXT_MAX_LENGTH_LONG)) { + valueCombo.setEnabled(false); + valueCombo.setText(AbstractValue.RANDOM_TEXT_MAX_LENGTH_LONG); + modeCombo.setText(AbstractValue.RANDOM_TEXT_MAX_LENGTH); + } + //random mode with user defined len + else if (txt.equals(AbstractValue.RANDOM_TEXT_USER_DEFINED_LENGTH) + || txt.equals(AbstractValue.RANDOM_TEXT_USER_DEFINED_LENGTH_LONG)) { + valueCombo.setEnabled(true); + modeCombo.setText(AbstractValue.RANDOM_TEXT_USER_DEFINED_LENGTH); + } + //mode is RANDOM_TEXT_INC_FOR_EACH_COPY This should not be able to occur, because RANDOM_TEXT_INC_FOR_EACH_COPY + //value are always phone numbers and will be on text field, just in case implemented. + else if (txt.equals(AbstractValue.RANDOM_TEXT_INC_FOR_EACH_COPY)) { + valueCombo.setEnabled(true); + modeCombo.setText(AbstractValue.RANDOM_TEXT_INC_FOR_EACH_COPY); + } + //default, not random + else{ + valueCombo.setEnabled(true); + valueCombo.setText(txt); + modeCombo.setText(AbstractValue.RANDOM_TEXT_NOT_RANDOM); + } + } + + + /** + * Adds one value combo to table + * @param values + * @param selectedValue + * @param item + * @param randomValueText + * @param typeComboSelection + * @return + */ + private CCombo addValueComboToTable(String[] values, String selectedValue, + final TableItem item, String randomValueText, String typeComboSelection) { + TableEditor editor; + // + //value combo + // + boolean isContactSetReference = CreatorEditorSettings.isContactSetReference(typeComboSelection); + + editor = new TableEditor(itemsTable); + final CCombo valueCombo = new CCombo(itemsTable, SWT.NONE); + valueCombo.setItems(values); + valueCombo.setEditable(false); + valueCombo.setBackground(getWhite()); + if(selectedValue != null){ + setValueTextAndEnabling(valueCombo, selectedValue, randomValueText, typeComboSelection); + } + + item.setText(1, valueCombo.getText()); + + valueCombo.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + item.setText(1, valueCombo.getText()); + } + }); + + editor.grabHorizontal = true; + editor.setEditor(valueCombo, item, 1); + + if(isContactSetReference){ + setContextSensitiveHelpID(valueCombo, CreatorHelpContextIDs.CREATOR_HELP_CONTACT_SET); + }else{ + setContextSensitiveHelpIDByComponentType(valueCombo); + } + + return valueCombo; + } + + /** + * Get selection value for type Combo by item content (key) and itemIndex + * @param key for returning back if it was not empty + * @param itemIndex a row index just adding + * @param openItemType + * @return a showable Item name or empty string, key if it was not empty or next value for items, + * or empty string if index was over last item index + */ + private String getTypeComboSelection(String key, int itemIndex, boolean openItemType) { + if(key == null ){ + return AbstractValue.EMPTY_STRING; + } + else if(key.equals(AbstractValue.EMPTY_STRING) + && getItemTypesAsString().length > itemIndex) + { + String setThisItemAsDefaultSelection = ""; + if(openItemType){ + setThisItemAsDefaultSelection = getItemTypesAsString()[itemIndex]; + } + return setThisItemAsDefaultSelection; + }else{ + return key; + } + } + + /** + * @return unicode Font + */ + protected Font getUnicodeFont() { + Font defaultFont = itemsTable.getFont(); + FontData defaulFD [] = defaultFont.getFontData(); + FontData fd = new FontData("Arial Unicode MS", defaulFD[0].getHeight(), defaulFD[0].getStyle()); + return new Font(Display.getCurrent(), fd); + } + + /** + * Gets 1 size smaller font for the button + * @return same Font with smaller size + */ + protected Font getButtonFont() { + Font defaultFont = itemsTable.getFont(); + FontData defaulFD [] = defaultFont.getFontData(); + FontData fd = new FontData(defaulFD[0].getName(), defaulFD[0].getHeight()-1, defaulFD[0].getStyle()); + Font font = new Font(Display.getCurrent(), fd); + return font; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) + */ + protected void createButtonsForButtonBar(Composite parent) { + // Creating just OK button + createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, + true); + createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, + true); + + } + + + /* + * Collecting Component data from table fields + * (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#okPressed() + */ + protected void okPressed() { + + //When in edit mode, just removing all attributes and replace them with current editor values + if(isInEditMode()){ + getComponent().removeAllAttributes(); + }else{ + //otherwise creating new component + setComponent(createNewComponent()); + } + + if(itemsTable != null){ + + TableItem [] items = itemsTable.getItems(); + + for (int i = 0; i < items.length; i++) { + + TableItem item = items[i]; + + if(item != null){ + + String type = item.getText(0); + String value = item.getText(1); + + if(type != null && type.trim().length()>0 + && value != null && value.trim().length()>0){ + value = value.trim();//Editor will produce script with no extra spaces. + + AbstractValue aValue = createNewValue(type, value, item.getText(2), item.getText(3)); + + //If field is Contact set reference + if(CreatorEditorSettings.isContactSetReference(type)){ + + AbstractComponent compToReference = getProvider().getComponents() + .getComponentByComponentString( value ); + + aValue.setContactSetReference(true); + aValue.setRandom(false);//contact set reference cannot be random + int id = 0; + try { + id=compToReference.getId(); + } catch (Exception e) { + id = 0; + showWarningDialog("Contact Set not exist", "Contact Set with id: '" +value +"' doesn't exist, please use existing Contact Set IDs."); + } + aValue.setId(id); + + int maxamount = 0; + try { + maxamount=Integer.parseInt(item.getText(3)); + } catch (Exception e) { + maxamount = 0; + } + aValue.setMaxAmount(maxamount); + } + + //Setting random type as user defined and set length by user definition + else if(aValue.getModeValueText().equalsIgnoreCase(AbstractValue.RANDOM_TEXT_USER_DEFINED_LENGTH)){ + aValue.setModeType(ModeTypes.RandomTypeUserDefinedLength); + int randomLen; + try { + randomLen = Integer.parseInt(value); + } catch (NumberFormatException e) { + e.printStackTrace(); + randomLen = AbstractValue.USER_DEFINED_DEFAULT_LENGTH; + showWarningDialog("Invalid random value", "Invalid user defined random lenght value: '" + +value +"'. Value was set to: '" +AbstractValue.USER_DEFINED_DEFAULT_LENGTH +"'."); + + } + aValue.setRandomValueLenght(randomLen); + } + + Vector v = getComponent().getAttribute(type); + if(v == null){ + v = new Vector(); + } + v.add(aValue); + + getComponent().setAttribute(type, v); + } + } + } + + } + //Amount txt for component level + if(amoutTxtToComponent != null){ + String amount = amoutTxtToComponent.getText(); + if(amount != null && amount.trim().length() > 0){ + try { + int am = Integer.parseInt(amount); + getComponent().setAmount(am); + } catch (Exception e) { + //just in case take Exception for parseInt, should not be occur, because of text field data validation + e.printStackTrace(); + getComponent().setAmount(0); + } + } + } + + + //If extra field number is used + if(extraNbrToComponent != null){ + getComponent().addAdditionalParameter(getComponent().getIdByValue(labelForExtraNumberField), extraNbrToComponent.getText()); + } + //If extra field txt is used + if(extraTxtToComponent != null){ + getComponent().addAdditionalParameter(getComponent().getIdByValue(labelForExtraTextField), extraTxtToComponent.getText()); + } + + //Set link to another component if any + setLinkToOtherComponentByComboSelection(); + + super.okPressed(); + + } + + /** + * Show an confirmation dialog + * @param title + * @param message + * @return true if OK pressed, false otherwise + */ + protected boolean showConfirmationDialog(String title, String message) { + Shell sh; + if (getShell() != null) { + try { + sh = getShell(); + } catch (SWTException e) { + sh = CreatorActivator.getCurrentlyActiveWbWindowShell(); + } + + } else { + sh = CreatorActivator.getCurrentlyActiveWbWindowShell(); + } + + return MessageDialog.openConfirm(sh, title, message); + } + + + /** + * Show an information dialog + * @param title + * @param message + */ + protected void showInformationDialog(String title, String message) { + Shell sh; + if (getShell() != null) { + try { + sh = getShell(); + } catch (SWTException e) { + sh = CreatorActivator.getCurrentlyActiveWbWindowShell(); + } + + } else { + sh = CreatorActivator.getCurrentlyActiveWbWindowShell(); + } + + MessageDialog.openInformation(sh, title, message); + } + /** + * Show an warning dialog + * @param title + * @param message + */ + protected void showWarningDialog(String title, String message) { + Shell sh; + if (getShell() != null) { + try { + sh = getShell(); + } catch (SWTException e) { + sh = CreatorActivator.getCurrentlyActiveWbWindowShell(); + } + + } else { + sh = CreatorActivator.getCurrentlyActiveWbWindowShell(); + } + + MessageDialog.openWarning(sh, title, message); + } + /** + * Show an error dialog + * @param title + * @param message + */ + protected void showErrorDialog(String title, String message) { + Shell sh; + if (getShell() != null) { + try { + sh = getShell(); + } catch (SWTException e) { + sh = CreatorActivator.getCurrentlyActiveWbWindowShell(); + } + + } else { + sh = CreatorActivator.getCurrentlyActiveWbWindowShell(); + } + + MessageDialog.openError(sh, title, message); + } + + /* + * (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) + */ + protected Control createDialogArea(Composite parent) { + + try{ + Composite composite = createDialogAreaComposite(parent); + GridLayout gridLayout = new GridLayout(); + composite.setLayout(gridLayout); + + //Create Amount area + createAmountArea(composite); + + //Create table area + createTableArea(composite); + + if(/*showAmountInfoText &&*/ isAmountFieldsEnabled){ + addInformation(composite, AMOUNT_FIELD_INFO_TEXT); + } + + if(wasErrors()){ + showErrorDialog("Errors occured when dialog opened", getErrors()); + } + + return composite; + }catch(Exception e){ + e.printStackTrace(); + showUnableToOpenDialogErrorMsg(e); + } + return null; + } + + /** + * Creates a composite for dialog area + * @param parent + * @return a Composite + */ + protected Composite createDialogAreaComposite(Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + return composite; + } + + /** + * Creating all items to dialog area, a real implementation for createDialogArea(Composite parent) + */ + protected void createTableArea(Composite composite) { + final int cols = 1; + GridLayout gdl = new GridLayout(cols, false); + GridData gd = new GridData(GridData.FILL_BOTH); + + + Composite tableComposite = new Composite(composite, SWT.SIMPLE); + tableComposite.setLayout(gdl); + tableComposite.setLayoutData(gd); + + itemsTable = new Table (tableComposite, SWT.BORDER | SWT.MULTI); + GridData tableGd = new GridData(GridData.FILL_BOTH); + tableGd.heightHint = 300; + itemsTable.setLayoutData(tableGd); + itemsTable.setLinesVisible (true); + itemsTable.setHeaderVisible(true); + itemsTable.setEnabled(isTableEnabled); + + //Create columns to table + createTableColums(); + + AbstractComponent component = (AbstractComponent) getComponent(); + Set keys = component.getKeys(); + Vector keysV = new Vector(keys); + + + //Create rows to table +2 is for new items + int actualComponentItemCount = component.getAttributeCount();// +2; + int allCompoenentItemCount = getItemTypesAsString().length; + //Always create at least 12 rows + if(!isInEditMode() && actualComponentItemCount < INITIAL_ITEMS_NUMBER_IN_TABLE ){ + if(allCompoenentItemCount > INITIAL_ITEMS_NUMBER_IN_TABLE){ + actualComponentItemCount = INITIAL_ITEMS_NUMBER_IN_TABLE; + } + else{ + actualComponentItemCount = allCompoenentItemCount; + } + } + + + //Looping through table and add existing data or empty rows + for (int i=0; i= component.getAttributeCount()){ + try { + addRow(!isInEditMode(), false); + } catch (Exception e) { + handleTableRowCreationError(e); + } + } + //rows of the table where is data added + else{ + String key = (String) keysV.get(i); + Vector values = component.getAttribute(key); + for (Iterator iterator = values.iterator(); iterator.hasNext();) { + AbstractValue value = (AbstractValue) iterator + .next(); + try { + addRow(key, value, false); + } catch (Exception e) { + handleTableRowCreationError(e); + } + + } + //Adding one row to Table + + }//else + } + + //Notify listeners to update values when all rows are set + checkIfNeedToCallItemValueEnablationListners(); + + //Notify table listeners to update item combos + notifyTypeComboDataListeners(); + + //Create add row button + createAddRowButton(tableComposite); + + if(wasErrorsWithDatas){ + showErrorDialog("Errors on script", "There was some errors when opening component, see Console for details."); + } + } + + /** + * Set wasErrorsWithDatas as true and prints console error message + * @param e + */ + private void handleTableRowCreationError(Exception e) { + wasErrorsWithDatas = true; + e.printStackTrace(); + CreatorEditorConsole.getInstance().println(UNEXPECTED_ERROR_WHEN_CREATING_TABLE_AREA_ERROR_WAS +e, CreatorEditorConsole.MSG_ERROR); + } + + /** + * Creates an Add row button to selected composite + * @param parent + */ + private void createAddRowButton(Composite parent) { + addRowButton = new Button(parent, SWT.PUSH); + addRowButton.setText(ADD_ROW_TXT); + //Add add row functionality + addRowButton.addSelectionListener(new SelectionAdapter(){ + + public void widgetSelected(SelectionEvent event) { + try { + addRow(true, true); + //Notify table listeners to update item combos + notifyTypeComboDataListeners(); + + //notify also listners if needed + checkIfNeedToCallItemValueEnablationListners(); + } catch (Exception e) { + handleTableRowCreationError(e); + } + } + + }); + setContextSensitiveHelpID(addRowButton, CreatorHelpContextIDs.CREATOR_HELP_MODIFY_COMPONENT); + } + + /** + * Creates a button to launch "Create new Contact-set" -dialog. + * @param composite + * @param addIndent - If add some empty space before creating button |" "