PDA

View Full Version : how to set ComboBoxValue !?!


ng-first
03-15-2007, 02:56 AM
:cool: Hi all,
I defined "myAttributeEditor" that extends WMAttEditorComboBox.

Than I work with it, to find out the values to set another Attribute that has "secondAttributeEditor".
To do so:

from 'myAttributeEditor' I find the Object(WMElement) who's attribute is being edited;
from this object I find its WMAttributeSet;
from WMAttributeSet, I find the WMAttribute of 'secondAttributeEditor'
from the WMAttribute of 'secondAttributeEditor'
I would like to find the reference its JComboBox, to set the new values !!!!!In this way (I copy below my java code):

...

if(myAttributeEditor.this.getDBObject() != null)
{
WMAttributeSet attributeSet ;
try
{
//1- find WMAttributeSet
attributeSet = myAttributeEditor.getDBObject().getWMClass().getAttributes();
for (int i = 0; i < attributeSet.size(); ++i)
{
//2- find WMAttribute
WMAttribute att = attributeSet.getAttribute(i);
if (att.getAttributeName().equalsIgnoreCase("secondAttributeEditor") == true )
{
//3- find AttributeEditor and its ComboBox
((ComboBoxEditorRenderer) att.getAttEditor().getJComponent()).getComboBox().removeAllItems();
((ComboBoxEditorRenderer) att.getAttEditor().getJComponent()).getComboBox().addItem("PIPPO !!!");
}
}
}


but why this instructions:
"...
((ComboBoxEditorRenderer) att.getAttEditor().getJComponent()).getComboBox().removeAllItems();
((ComboBoxEditorRenderer) att.getAttEditor().getJComponent()).getComboBox().addItem("PIPPO !!!");
... "
doesn't work ?!?!?!?
The secondCOmboBox don't change its value !!!!
(I have add an actionListener to the myAttributeEditor, and I have implemented the ActionPerformed method)

Please HELP ME !!! I'm going crazy :eek: !!!!
Nadia

jdh
04-19-2007, 06:54 AM
I am not sure what you are trying to do but you might look at the com.osm.editor.EditorUtil object. It should help you track down all editors for a particular object instance independent of which UI is displayed (save ui, properties ui, search ui, etc.).

This was developed to "help" create inter-dependent combox boxes (i.e., combo boxes who's possible values are dependent on what was selected in other combo boxes.) Its still quite a bit of work but at least you can track down the editors independent of the UI being displayed.

ng-first
05-02-2007, 12:15 AM
Hi all,
thank to all for help.

I solved my problems with combobox and its values :D :D :D !!!
I used the EditorUtil class and I extended the EditorCombox class, to find out the structure of the window.

By,
Nadia :)