BTree | |||||
Home | BTree Guide | BTree Performance | Sample Applications | BTree Roadmap | Other Products |
This documentation is supplied as an example of the functionality available with the full distribution. The sample applications provided can also be run on the Palm Operating System. To create an application to run on the Palm OS you will need the following - There are three demo applications available - You can now enter the key for the piece of data that you want to show. You are prompted with a phone text entry box. Use the phones buttons to enter the text. In this case we have entered the text 'BOB'. Then press the 'Show' key at the bottom right of the screen.
The data associated with this key will then be displayed in a text box on the next screen. As you can see the data associated with this key is 'DYLAN'. After you have viewed the data press the 'Back' key on the bottom left of the screen and you will be returned to the main menu. The other keys you can enter are 'STEVIE','TINA','KURT','TOM', 'TROY' and 'ANGIE'. If you are connected to the BTree via HTTP then entering the key 'HTTP' will return the value 'USING HTTP'. If you are connected to the BTree via a socket then entering the key 'SOCKET' will return the value 'USING SOCKET'. This assumes that you have used the SocketTree and/or HTTPTree datasets and installed them in the appropriate location. If neither of these keys is available then the attempt to connect to an external BTree has failed and the default tree has been created.
We can add our own data to the BTree - when you get back to the main menu you should select the option to add a new record. When you do this you will see the screen above The next screen allows you to add the text to be associated with the key entered in the previous screen. It behaves the same as the previous screen. In this case we are associating the text 'SPACEY' with the key 'KEVIN' entered previously. Pressing the 'Add' button (on the bottom right of the screen) will add the data to the BTree. Pressing the 'Back' button (on the bottom left of the screen) will return you to the main menu. Pressing the 'Back' button at this point will mean that the data will not be added.
You can also delete data from the BTree - when you get back to the main menu you should select the option to delete record. When you do this you will see the screen above A screen will now appear confirming that the data has been deleted. Your only option is to press the 'Back' button (on the bottom left of the screen) which will return you to the main menu.
When you exit from the application the BTree will be saved as long as you have connected via a Socket connection and the other end of the socket connection is saving the data to a file. See here for details. Note that if you have carefully followed the example above you will have deleted the entry that you added to the BTree. If you want to test the save functionality you will have to add a new entry, exit the application, restart the application and check that the new entry is there.
When you have installed all of these you then need to create a .PRC file from the Java application.
The first demo is the BTreeDemo which allows you to add delete and view entries in a BTree. If you have modified the code to use a socket to access the data you will also be able to save the data back to the host machine. When you launch the application the main menu appears offering three possible options - View record, Add record and Delete record.You can exit the main menu at any time by pressing the 'Exit' button on the bottom left of the screen.
Since we already have some data in the BTree (either loaded from the external sample BTree or created on the device if the device connection fails) we can use the mouse to move to the 'View record' option and click on this to bring up the next screen.
You can now enter the text of the key that you wish to add to the BTree. We have used the key 'KEVIN'. Press the 'Next' button (on the bottom right of the screen) to go on to the next screen (where you will add the value to be associated with this key) or the 'Back' button (on the bottom left of the screen) to return to the main menu. Pressing the 'Back' button at this point will mean that the data will not be added.
A screen will now appear confirming that the data has been added. Your only option is to press the 'Back' button (on the bottom left of the screen) which will return you to the main menu.
You are now prompted with a phone text entry box. Use the phones buttons to enter the text. In this case we have entered the text 'KEVIN' - the key of the entry that we just added to the BTree. Pressing the 'Delete' button (on the bottom right of the screen) will delete the data from the BTree. Pressing the 'Back' button (on the bottom left of the screen) will return you to the main menu. Pressing the 'Back' button at this point will mean that the data will not be deleted.
Read Only BTree Sample Application
After you have launched the application (either on a Palm device or on the emulator) the main menu will appear offering three possible options - View record, Show all and Show selected.You can exit the main menu at any time by pressing the 'Exit' button on the bottom left of the screen.
Since we already have some data in the BTree we can use the mouse to move to the 'View record' option and click on this to bring up the next screen. You can now enter the key for the piece of data that you want to show. You are prompted with a phone text entry box. Use the phones buttons to enter the text. In this case we have entered the text 'BOB'.You should then press the 'Show' key at the bottom of the screen.
The data associated with this key will then be displayed in a text box on the next screen. As you can see the data associated with this key is 'DYLAN'. After you have viewed the data press the 'Back' key on the bottom left of the screen and you will be returned to the main menu. The other keys you can enter are 'STEVIE','TINA','TOM', 'TROY','KURT' and 'ANGIE'. If you are connected to the HTTP test BTree entering 'HTTP' will return the value 'USING HTTP', If you are connected to the SocketTree test BTree entering 'SOCKET' will return the value 'USING SOCKET'.
We can show all the keys to data in the BTree by selecting the 'Show all' option - you will now see all the keys displayed in a list. If the list is too big for the display area you can scroll down with the arrow keys. When you have reached the key for the record that you want to view you can press the 'Show' button and the associated value will be displayed as if it was using the 'View Record' option.
You can also show selected entries starting with a particular letter by choosing the 'Show selected' option from the menu.You will then be asked to enter the starting letter of the records that you wish to view. In this case we have decided to show all the items starting with 'T'.
The next screen shows all the items starting with the selected string - in this case 'TINA', 'TOM' and 'TROY'.If the list is too big for the display area you can scroll down with the arrow keys. When you have reached the key for the record that you want to view you can press the 'Show' button and the associated value will be displayed as if it was using the 'View Record' option.