Class WTQuery
- All Implemented Interfaces:
ActionListener,ItemListener,PropertyChangeListener,EventListener
WTQuery provides a tool that allows you to include in your application the
ability to search for objects in the local Windchill database. WTQuery is
comprised of an optional title, a Tab panel containing an input area for search criteria, 3 required
buttons, 3 optional buttons, a check box indicating whether to append to or replace the search
results and a list area for displaying search results.
A WTQuery object provides the ability to search for objects
of a specified class. A WTSchema object is
used to specify which modeled Windchill business class and associated attributes
are to be used in configuring the WTQuery object. The Tab panel and
results viewing list are dynamically constructed based on the schema provided.
When calling WTQuery it is necessary to specify a
WTSchema object.
The search results viewing list presents the results of the database query. The user can clear this area by clicking the clear button. There is a check box available to the user that determines whether to clear the list area between invocations of clicking the Find button. By default the list area allows multiple objects to be selected. To restrict the list area to single selection use the setMultipleMode() method. To obtain the list of selected objects use either the getSelectedDetails() or getSelectedDetail() method depending on whether multiple or single selection mode is in use.
The buttons display in two columns. The required column contains Find, Stop and Clear.
The optional column contains OK, Close and Help. The functionality for the required
buttons and the Help button is handled by WTQuery. The calling application can register a
listener to be notified when the OK or Close buttons are clicked. To register
a listener, create a WTQueryListener object and call the addListener() method
using the WTQueryListener object as input.
For example to add WTQuery to a panel:
Panel queryPanel;
try {
// Create WTQuery without a status area.
WTQuery myQuery = new WTQuery("My Query Panel", SearchTask.ALL_VERSIONS, false);
myQuery.setSchema("C:wt.doc.WTDocument; G:Search Criteria; A:name; D:versionIdentifier; G:More Search Criteria; A:description;");
// Set single selection mode
myQuery.setMultipleMode(false);
// --- Hide the right column of buttons.
myQuery.setDialogButtonsVisible(false);
// Set Layout.
queryPanel.setLayout(new BorderLayout());
queryPanel.add("Center", myQuery);
// Add event listener.
myQuery.addListener(new WTQueryListener() {
public void queryEvent(WTQueryEvent e)
{
if (e.getType().equals(WTQueryEvent.COMMAND ))
{
if (e.getCommand().equals(WTQuery.OkCMD) )
{
// The Ok button is clicked, get the selected objects.
WTQuery query_source = (WTQuery)e.getSource();
WTObject[] objs = query_source.getSelectedDetails();
// Continue with code that will process the selected object array
}
}
}
// Add help listener
myQuery.addHelpListener(helpListener);
}catch (Exception e) {}
Supported API: true
Extendable: true
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe value for the "Clear button clicked" command event type.static final StringThe value for the "Find button clicked" command event type.static final StringThe value for the "OK button clicked" command event type.static final StringThe value for the "Close button clicked" command event type.static final StringThe value for the "Stop button clicked" command event type. -
Constructor Summary
ConstructorsConstructorDescriptionWTQuery()Default no-arg constructor.Constructor specifying a title, search filter and whether to include a status display area as part of this component.Constructor specifying a title, search filter, status display flag and a IBA tab flag.WTQuery(String a_title, String search_filter, boolean show_status, boolean show_iba, boolean doc_finder) Constructor specifying a title, search filter and whether to include a status display area as part of this component, as well as showing IBA associated and if to allow for the searching of Documents. -
Method Summary
Modifier and TypeMethodDescriptionvoidMethodaddHelpListeneradds the given listener to be notified ofPropertyChangeEventsin the help system.voidaddListener(WTQueryListener a_listener) MethodaddListeneradds the given listener to be notified ofWTQueryEvents.String[]Returns a string array containing the width of each column in the results viewing area.intGets the default width for each column in the results viewing area.getDetail(int a_index) Return the object at the specified row in the results list area.booleanReturn true if multiple selection mode is enabled in the results list area, false if single selection mode is in use.Return the schema currently being used.Return the selected object in the results list area.WTObject[]Return the list of selected objects in the results list area.voidMethodremoveHelpListenerremoves a listener which was being notified ofPropertyChangeEventsin the help system.voidremoveListener(WTQueryListener a_listener) MethodremoveHelpListenerremoves a listener which was being notified ofPropertyChangeEventsin the help system.voidsetColumnSizes(String[] list) Sets the width of each column in the results viewing area.voidsetColumnWidth(int width) Sets the default width for each column in the results viewing area.voidsetMultipleMode(boolean mode) Set the multiple selection mode in the results list area.voidSet the schema to use.voidsetStatusVisible(boolean visible) Set the visibility of the status area.intReturn the current number of objects in the results list area.
-
Field Details
-
FindCMD
The value for the "Find button clicked" command event type. AWTQueryEventis fired when the Find button is clicked with aWTQueryEvent.COMMANDtype and command value ofFindCMD.
Supported API: true- See Also:
-
StopCMD
The value for the "Stop button clicked" command event type. AWTQueryEventis fired when the Stop button is clicked with aWTQueryEvent.COMMANDtype and command value ofStopCMD.
Supported API: true- See Also:
-
ClearCMD
The value for the "Clear button clicked" command event type. AWTQueryEventis fired when the Clear button is clicked with aWTQueryEvent.COMMANDtype and command value ofClearCMD.
Supported API: true- See Also:
-
OkCMD
The value for the "OK button clicked" command event type. AWTQueryEventis fired when the OK button is clicked with aWTQueryEvent.COMMANDtype and command value ofOkCMD.
Supported API: true- See Also:
-
QuitCMD
The value for the "Close button clicked" command event type. AWTQueryEventis fired when the Close button is clicked with aWTQueryEvent.COMMANDtype and command value ofQuitCMD.
Supported API: true- See Also:
-
-
Constructor Details
-
WTQuery
public WTQuery()Default no-arg constructor.
Supported API: true -
WTQuery
Constructor specifying a title, search filter and whether to include a status display area as part of this component.
Supported API: true- Parameters:
a_title- the title displayed above the Tab panel. when processing the query command. Seewt.query.SearchTaskfor search filter string constants.show_status- set to true if a status area should be created to display status messages, otherwise false.- See Also:
-
SearchTask
-
WTQuery
public WTQuery(String a_title, String search_filter, boolean show_status, boolean show_iba, boolean doc_finder) Constructor specifying a title, search filter and whether to include a status display area as part of this component, as well as showing IBA associated and if to allow for the searching of Documents.
Supported API: true- Parameters:
a_title- the title displayed above the Tab panel. when processing the query command. Seewt.query.SearchTaskfor search filter string constants.show_status- set to true if a status area should be created to display status messages, otherwise false.show_iba-doc_finder-- See Also:
-
SearchTask
-
WTQuery
Constructor specifying a title, search filter, status display flag and a IBA tab flag.
Supported API: true- Parameters:
a_title- the title displayed above the Tab panel.search_filter- used when processing the query command. Seewt.query.SearchTaskfor search filter string constants.show_status- set to true if a status area should be created to display status messages, otherwise false.show_iba- set to true if the IBA tab should be shown- See Also:
-
SearchTask
-
-
Method Details
-
setColumnSizes
Sets the width of each column in the results viewing area. The width is set in pixels. Setting the column sizes to null will turn auto resizing on.
Supported API: true- Parameters:
list- a string array containing results viewing area column sizes in pixels- Throws:
PropertyVetoException- if the specified property value is unacceptable- See Also:
-
getColumnSizes
Returns a string array containing the width of each column in the results viewing area. The width of the column is in pixels. If columns are being automatically sized, it will return null.
Supported API: true- Returns:
- a string array containing column sizes in pixels
- See Also:
-
setColumnWidth
public void setColumnWidth(int width) Sets the default width for each column in the results viewing area. The width is set in pixels. Setting the column width will cause each column in the results viewing area to have the same initial size. In order to set a separate width for each column usesetColumnSizes. Setting this vaule to 0 turns, auto resizing on.
Supported API: true- Parameters:
width- the default results viewing area column size in pixels- See Also:
-
getColumnWidth
public int getColumnWidth()Gets the default width for each column in the results viewing area. The width is returned in pixels.
Supported API: true- Returns:
- default results area column size in pixels
- See Also:
-
addHelpListener
MethodaddHelpListeneradds the given listener to be notified ofPropertyChangeEventsin the help system. Tool descriptionPropertyChangeEventsare generated when the user mouses over the buttons and list ofContentItemsin this panel. The given listener will be notified of those events.
Supported API: true- Parameters:
pcl- ThePropertyChangeListenerto be notified ofPropertyChangeEventsgenerated by the help system.- See Also:
-
removeHelpListener
MethodremoveHelpListenerremoves a listener which was being notified ofPropertyChangeEventsin the help system. If the given listener is not currently a listener, no changes are made.
Supported API: true- Parameters:
pcl- thePropertyChangeListenerto be removed as a listener of events generated by the help system of this panel.- See Also:
-
getSchema
Return the schema currently being used. The schema describes the attributes to be used as search criteria in the Tab panel and attributes to be displayed in the results list area.
Supported API: true- Returns:
- the current schema that is in use.
-
setSchema
Set the schema to use. The schema describes the attributes to be used as search criteria in the Tab panel and attributes to be displayed in the results list area.
Supported API: true- Parameters:
a_schema- The schema used to obtain attributes for the Tab panel and results list area.
-
setStatusVisible
public void setStatusVisible(boolean visible) Set the visibility of the status area. The status area is an optional component whose visibility can be controlled by this method.
Supported API: true- Parameters:
visible- true if the status area is visible, otherwise false.
-
setMultipleMode
Set the multiple selection mode in the results list area.
Supported API: true- Parameters:
mode- true enables multiple selection, false enables single selection.- Throws:
PropertyVetoException- if the specified property value is unacceptable.
-
getMultipleMode
public boolean getMultipleMode()Return true if multiple selection mode is enabled in the results list area, false if single selection mode is in use.
Supported API: true- Returns:
- true if multiple selection mode is in use, false for single selection.
-
totalDetails
public int totalDetails()Return the current number of objects in the results list area.
Supported API: true- Returns:
- The current number of objects in the results list area.
-
getDetail
Return the object at the specified row in the results list area.
Supported API: true- Parameters:
a_index- The index of the row to obtain the object.- Returns:
- the object at the specified row in the results list area.
-
getSelectedDetail
Return the selected object in the results list area.
Supported API: true- Returns:
- the selected object in the results list area.
-
getSelectedDetails
Return the list of selected objects in the results list area.
Supported API: true- Returns:
- the list of selected objects in the results list area.
-
addListener
MethodaddListeneradds the given listener to be notified ofWTQueryEvents. AWTQueryEventis fired when a button is clicked, a status message is ready or the selection has been changed in the results viewing area.
Supported API: true- Parameters:
a_listener- TheWTQueryListenerto be notified ofWTQueryEvents.- See Also:
-
removeListener
MethodremoveHelpListenerremoves a listener which was being notified ofPropertyChangeEventsin the help system. If the given listener is not currently a listener, no changes are made.
Supported API: true- Parameters:
a_listener- theWTQueryistenerto be removed as a listener of events generated by the help system of this panel.- See Also:
-