org.netbeans.microedition.svg
Class SVGComboBox

java.lang.Object
  extended by org.netbeans.microedition.svg.SVGComponent
      extended by org.netbeans.microedition.svg.SVGComboBox
All Implemented Interfaces:
DataListener, SVGActionListener, SVGForm.FocusListener

public class SVGComboBox
extends SVGComponent
implements DataListener, SVGActionListener

Suggested svg snippet :

 <g id="country_combobox" transform="translate(20,180)">
   <!-- Metadata information. Please don't edit. -->
   <text display="none">type=combobox</text>

       <rect x="0" y="-5" rx="5" ry="5" width="90" height="30" fill="none" stroke="rgb(255,165,0)" 
              stroke-width="2" visibility="hidden">
           <set attributeName="visibility" attributeType="XML" begin="country_combobox.focusin" 
               fill="freeze" to="visible"/>
           <set attributeName="visibility" attributeType="XML" begin="country_combobox.focusout" 
               fill="freeze" to="hidden"/>
       </rect>
       <rect  x="5.0" y="0.0" width="80" height="20" fill="none" stroke="black" stroke-width="2"/>
   <g>
       <!-- Metadata information. Please don't edit. -->
       <text display="none">type=button</text>

       <rect  id="country_combobox_button"  x="66.0" y="1.0" width="18" height="18" fill="rgb(220,220,220)" 
               stroke="black" stroke-width="1.5">
           <animate  id="country_combobox_button_pressed" attributeName="fill" attributeType="XML" begin="indefinite" dur="0.25s" 
               fill="freeze" to="rgb(170,170,170)"/>
           <animate  id="country_combobox_button_released" attributeName="fill" attributeType="XML" begin="indefinite" dur="0.25s" 
               fill="freeze" to="rgb(220,220,220)"/>
   </rect>
   </g>
   <polygon transform="translate(73,8)"  points="0,0 4,0 2,4" fill="blue" 
                 stroke="black" stroke-width="2"/>
   <g id="country_combobox_editor" >
       <!-- this editor is SVGTextField component -->

       <!-- Metadata information. Please don't edit. -->
       <text display="none">type=editor</text>
       <text display="none">editable=false</text>
       <text display="none">enabled="true"</text>

       <g>
       <text id="country_combobox_editor_text" x="10" y="15" stroke="black" 
              font-size="15" font-family="SunSansSemiBold">Item 1</text>
              <!-- Metadata information. Please don't edit. -->
              <text display="none">type=text</text>
       </g>
       <!-- The rectangle below is difference between rectangle that bound 
         combobox and combobox button ( the latter 
       has id = country_combobox_button ). It needed for counting bounds of input text area .
       It should be created via source code or SVGTextField should have API for dealing with "width"
       of editor not based only on width of text field component.-->
       <rect visibility="hidden" x="5.0" y="0" width="60" height="20" />
   </g>
   </g>

 
Also the following snippet should be placed at the end of XML document ( this is because it should be on very top of any figure ).
 <g id="country_combobox_list" visibility="hidden" transform="translate(20,200)">
       <!-- Metadata information. Please don't edit. -->
       <text display="none">ref=country_combobox</text>
       <text display="none">type=list</text>

       <!-- This is not standalone component ! It reelates to combobox component. This is list that is shown
       for user when he press to button. It should be outside of ComboBox component figure ( and should
       be at the very end of XML file between other such figures ) because in this case it will be 
       on top of any other figure. Otherwise it will be hidden by following sibling component. -->
       <g>
           <text id="country_combobox_list_hidden_text" visibility="hidden" x="10" y="13" stroke="black" font-size="15" 
                  font-family="SunSansSemiBold">
           HIDDEN TEXT</text>
           <!-- Metadata information. Please don't edit. -->
           <text display="none">type=hidden_text</text>
       </g>
       <g>
           <!-- Metadata information. Please don't edit. -->
           <text display="none">type=bound</text>
           <rect id="country_combobox_list_bound" x="5.0" y="0.0" width="80" height="60" fill="white" stroke="black" stroke-width="2" visibility="inherit"/>
       </g>
       <g>
           <!-- Metadata information. Please don't edit. -->
           <text display="none">type=selection</text>
           <rect id="country_combobox_list_selection" x="5" y="0" stroke="black" stroke-width="1" fill="rgb(200,200,255)" visibility="inherit" width="80" height="0"/>
       </g>
       <g  id="country_combobox_list_content" visibility="inherit">
           <!-- Metadata information. Please don't edit. -->
           <text display="none">type=content</text>
           </g>
   </g
 


Nested Class Summary
static interface SVGComboBox.ComboBoxEditor
           
static interface SVGComboBox.ComboBoxModel
           
static class SVGComboBox.DefaultModel
           
 
Field Summary
 
Fields inherited from class org.netbeans.microedition.svg.SVGComponent
actionListeners, DASH, ENABLED, form, LABEL_FOR, REF, SVG_NS, TR_VALUE_HIDDEN, TR_VALUE_INHERIT, TR_VALUE_VISIBLE, TRAIT_FILL, TRAIT_TEXT, TRAIT_VISIBILITY, TRAIT_X, TRAIT_Y, TYPE, wrapperElement
 
Constructor Summary
SVGComboBox(SVGForm form, java.lang.String elemId)
           
 
Method Summary
 void actionPerformed(SVGComponent comp)
           
 void contentsChanged(java.lang.Object source)
           
 void focusGained()
           
 void focusLost()
           
 SVGComboBox.ComboBoxEditor getEditor()
           
 InputHandler getInputHandler()
           
 SVGComboBox.ComboBoxModel getModel()
           
 SVGListCellRenderer getRenderer()
           
 java.lang.Object getSelectedItem()
           
 void setEditor(SVGComboBox.ComboBoxEditor editor)
           
 void setModel(SVGComboBox.ComboBoxModel model)
           
 void setRenderer(SVGListCellRenderer renderer)
           
 void setSelectedItem(java.lang.Object value)
           
 
Methods inherited from class org.netbeans.microedition.svg.SVGComponent
addActionListener, fireActionPerformed, getElement, getElementById, getElementByMeta, getElementByMeta, getForm, getLabel, getNestedElementByMeta, getProperty, isFocusable, removeActionListener, requestFocus, setFocusable, setProperty, setTraitSafely, setTraitSafely
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SVGComboBox

public SVGComboBox(SVGForm form,
                   java.lang.String elemId)
Method Detail

focusGained

public void focusGained()
Specified by:
focusGained in interface SVGForm.FocusListener
Overrides:
focusGained in class SVGComponent

focusLost

public void focusLost()
Specified by:
focusLost in interface SVGForm.FocusListener
Overrides:
focusLost in class SVGComponent

getInputHandler

public InputHandler getInputHandler()
Overrides:
getInputHandler in class SVGComponent

getModel

public SVGComboBox.ComboBoxModel getModel()

setModel

public void setModel(SVGComboBox.ComboBoxModel model)

getEditor

public SVGComboBox.ComboBoxEditor getEditor()

setEditor

public void setEditor(SVGComboBox.ComboBoxEditor editor)

getRenderer

public SVGListCellRenderer getRenderer()

setRenderer

public void setRenderer(SVGListCellRenderer renderer)

getSelectedItem

public java.lang.Object getSelectedItem()

setSelectedItem

public void setSelectedItem(java.lang.Object value)

contentsChanged

public void contentsChanged(java.lang.Object source)
Specified by:
contentsChanged in interface DataListener

actionPerformed

public void actionPerformed(SVGComponent comp)
Specified by:
actionPerformed in interface SVGActionListener