1 27 28 package org.nightlabs.editor2d.properties; 29 30 31 import org.eclipse.swt.widgets.Composite; 32 33 import org.nightlabs.base.property.ComboBoxCellEditor; 34 import org.nightlabs.util.FontUtil; 35 36 public class FontSizeCellEditor 37 extends ComboBoxCellEditor 38 { 39 40 public FontSizeCellEditor(Composite parent) { 41 super(parent, FontUtil.getFontSizes()); 42 } 43 44 protected Object doGetValue() 49 { 50 return new Integer (items[comboBox.getSelectionIndex()]); 51 } 52 53 protected void doSetValue(Object value) 54 { 55 String string = ""; 56 57 if (value instanceof String ) { 58 string = (String ) value; 59 } 60 else if (value instanceof Integer ) { 61 string = ((Integer )value).toString(); 62 } 63 64 for (int i=0; i<items.length; i++) { 65 String s = items[i]; 66 if (s.equals(string)) { 67 comboBox.select(i); 68 break; 69 } 70 } 71 72 } 73 74 } 75 | Popular Tags |