A wrapper for the Swing JComboBox class
Copyright (c) Xoetrope Ltd., 1998-2003 License: see license.txt @version 1.0
188189190191192193194195196197198199200201202203204205206
} break; case Component.XTYPE_XCOMBOBOX : XComboBox xComboBox = (XComboBox) UnoRuntime.queryInterface(XComboBox.class, compObject); if (listener instanceof ActionListener) { xComboBox.addActionListener((XActionListener) listener); } else if (listener instanceof ItemListener) { xComboBox.addItemListener((XItemListener) listener); } break; case Component.XTYPE_XLISTBOX :
444445446447448449450451452453454455456
} Collections.sort(responses, new Comparer()); fillItemsList(); XComboBox xComboBox = (XComboBox) UnoRuntime.queryInterface(XComboBox.class, xControlContainer.getControl(COMBO_PATH)); xComboBox.addItem(currentHref, (short) 0); XTextComponent xComboText = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, xControlContainer .getControl(COMBO_PATH)); xComboText.setText(currentHref);
202203204205206207208209210211212213214215216217218219220221
return getTypedFileInfo(fileName); } public String[] getTypedFileInfo(String fileName) throws DialogException { XComboBox xComboType = (XComboBox) UnoRuntime.queryInterface(XComboBox.class, xControlContainer.getControl(COMBO_TYPE)); String comboText = getEditFilterValue(); int index = -1; for (int i = 0; i < xComboType.getItemCount(); i++) { String comboValue = xComboType.getItem((short) i); if (comboValue.equals(comboText)) { index = i; break; }
412413414415416417418419420421422423424425426427428429430431432
return false; } try { XComboBox xComboType = (XComboBox) UnoRuntime.queryInterface(XComboBox.class, xControlContainer.getControl(COMBO_TYPE)); ArrayList<FilterType> filters = filterLoader.getFilterTypes(currentModelName); if (filters.size() != 0) { for (int i = filters.size() - 1; i >= 0; i--) { FilterType currentFilter = filters.get(i); String filterStr = currentFilter.getLocalizedName() + " [." + currentFilter.getFileExtension() + "]"; xComboType.addItem(filterStr, (short) 0); if (i == 0) { setEditFilterValue(filterStr); } }
195196197198199200201202203204205206207208209210211
} } public static void fillComboBox(Object list, Object[] items, Renderer renderer) { XComboBox xComboBox = (XComboBox) UnoRuntime.queryInterface(XComboBox.class, list); Helper.setUnoPropertyValue(UnoDataAware.getModel(list), "StringItemList", new String[] { }); for (short i = 0; i < items.length; i++) { if (items[i] != null) { xComboBox.addItem((renderer != null ? renderer.render(items[i]) : items[i].toString()), i); } } }
125126127128129130131132133134135136
} } public void enableCombo() { XCheckbox check1 = (XCheckbox)findComponent( obj, "check1" ); XComboBox combo = (XComboBox)findComponent( "combo" ); if ( check1.isSelected() ) { combo.setEnabled( false ); } else { combo.setEnabled( true ); } }
227228229230231232233234235236237238
} } public void visibleCombo() { XCheckbox check2 = (XCheckbox)findComponent( obj, "check2" ); XComboBox combo = (XComboBox)findComponent( "combo" ); if ( check2.isSelected() ) { combo.setVisible( false ); } else { combo.setVisible( true ); } }
317318319320321322323324325326327328
} } public void changeColorCombo() { XCheckbox check3 = (XCheckbox)findComponent( obj, "check3" ); XComboBox combo = (XComboBox)findComponent( "combo" ); if ( check3.isSelected() ) { combo.setBackgroundColor( "#FF3333" ); } else { combo.setBackgroundColor( "" ); } }
375376377378379380381382383384385386
} } public void changeFontColorCombo() { XCheckbox check4 = (XCheckbox)findComponent( obj, "check4" ); XComboBox combo = (XComboBox)findComponent( "combo" ); if ( check4.isSelected() ) { combo.setFontColor( "#CCEEEE" ); } else { combo.setFontColor( "" ); } }
510511512513514515516517518519
} } public void font10Combo() { XRadioButton radio1 = (XRadioButton)findComponent( obj, "radio1" ); XComboBox combo = (XComboBox)findComponent( "combo" ); if ( radio1.isSelected() ) { combo.setFontSize( 10 ); } }