Table of Contents Previous Section

Palettes

A palette is a collection of resources (such as images, static or dynamic HTML elements, and components). You can drag elements from a palette to a component to use them. You can also drag elements from a component to a palette to store them.

 Palettes appear in WebObjects Builder's palette window. To open the palette window, click  on the toolbar or choose Tools Palette.

 

The icons at the top of the palette window show the available palettes. To select a palette, click its icon. Two pre-configured palettes are provided: Java client-side components and components from the WOExtensions framework.

You can create your own palettes to store frequently-used items, such as custom forms, tables, or images, and you can load palettes created by someone else.

 To create a new palette, choose Palettes New Palette. A panel appears, asking you to specify a location to save the palette. (A palette is represented on disk as a folder with the extension .wbpalette.) The palette appears in the palette window with the default palette icon . To change the palette's icon, see "Changing a Palette Icon".

 To add an existing palette to the palette window:

  1. Choose Palettes Open Palette. 
  2. Navigate to the palette's location and click Open.
To remove a palette from the palette window:
  1. Select the palette in the palette window. 
  2. Choose Palettes Close Palette.

Creating and Using Palette Items

To add an item from a component to a palette:
  1. Make the palette editable. 
  2. If the palette's background is gray, you can't make any changes to it. To enable editing, choose Palettes Make Editable. The palette's background changes to white and its title says "Alt-drag to insert item." Note: When you first create a palette, it is editable until you save it.

     

  3. In the component window, select the element or elements that you want to add to the palette. 
  4. Hold down the Alt key and drag the selection to the palette. 
  5. The cursor changes to  and displays in the palette when you are done dragging. You can change the title of the item by selecting its name and typing. To change the item's icon, see "Changing a Palette Icon".

     

You can also add any item from the file system to a palette (including such things as a component, an image, or an EOModel). To do so:
  1. Make the palette editable. 
  2. Locate the item in the file system. 
  3. Drag the item onto the palette. 
  4. For example, to add a component to a palette, you would drag its .wo folder to the palette.

     

    Note: On Windows NT, you can't drag an item directly to the palette, because the palette window doesn't appear unless a WebObjects Builder window is in the foreground. Therefore, you must drag the item to WebObjects Builder's icon in the taskbar at the bottom of the screen and hold it until the palette window appears. With the mouse button still down, drag the item to the palette.

     

When you are done adding elements to your palette, choose Palettes Save Palette. The background changes to gray, indicating that the palette is no longer editable.

 To copy an item from a palette to the component window:

  1. Make sure the palette is not editable (if its background is white, choose Palettes Make Editable). 
  2. Note: If the palette is editable, you can drag the item to the window, but it will disappear from the palette.

     

  3. Drag the item from the palette to the location in the component window where you want it to appear.

Changing a Palette Icon

You can replace the icon of any palette, or any item in a palette, with an image of your own choosing. To do so:
  1. Open the palette window and select the palette whose icon you want to change. 
  2. Make the palette editable. 
  3. Drag an image from the file system onto the palette's icon. 
  4. You can use any image file recognized by WebObjects Builder (such as a .gif, .tif or .jpg file) to change the icon of a palette or of any item in the palette.

    Note: The same caveat for dragging items to the palette on Windows NT applies (see "Creating and Using Palette Items").

     

  5. Save the palette.