1 14 package org.wings.template; 15 16 import org.wings.SAbstractIconTextCompound; 17 import org.wings.SComponent; 18 import org.wings.SURLIcon; 19 20 24 public class SAbstractIconTextCompoundPropertyManager extends SComponentPropertyManager { 25 static final Class [] classes = {SAbstractIconTextCompound.class}; 26 27 public SAbstractIconTextCompoundPropertyManager() { 28 } 29 30 public void setProperty(SComponent comp, String name, String value) { 31 SAbstractIconTextCompound c = (SAbstractIconTextCompound) comp; 32 if (name.equals("TEXT")) 33 c.setText(value); 34 else if (name.startsWith("ICON")) { 35 if (name.equals("ICON")) 36 c.setIcon(new SURLIcon(value)); 37 else if (name.equals("ICONWIDTH")) { 38 try { 39 int width = Integer.parseInt(value); 40 if (c.getIcon() != null) { 41 c.getIcon().setIconWidth(width); 42 } if (c.getDisabledIcon() != null) { 44 c.getDisabledIcon().setIconWidth(width); 45 } if (c.getSelectedIcon() != null) { 47 c.getSelectedIcon().setIconWidth(width); 48 } if (c.getRolloverIcon() != null) { 50 c.getRolloverIcon().setIconWidth(width); 51 } if (c.getRolloverSelectedIcon() != null) { 53 c.getRolloverSelectedIcon().setIconWidth(width); 54 } if (c.getPressedIcon() != null) { 56 c.getPressedIcon().setIconWidth(width); 57 } } catch (NumberFormatException ex) { 59 } } else if (name.equals("ICONHEIGHT")) { 61 try { 62 int height = Integer.parseInt(value); 63 if (c.getIcon() != null) { 64 c.getIcon().setIconHeight(height); 65 } if (c.getDisabledIcon() != null) { 67 c.getDisabledIcon().setIconHeight(height); 68 } if (c.getSelectedIcon() != null) { 70 c.getSelectedIcon().setIconHeight(height); 71 } if (c.getRolloverIcon() != null) { 73 c.getRolloverIcon().setIconHeight(height); 74 } if (c.getRolloverSelectedIcon() != null) { 76 c.getRolloverSelectedIcon().setIconHeight(height); 77 } if (c.getPressedIcon() != null) { 79 c.getPressedIcon().setIconHeight(height); 80 } } catch (NumberFormatException ex) { 82 } } 84 } else if (name.equals("DISABLEDICON")) 85 c.setDisabledIcon(new SURLIcon(value)); 86 else if (name.equals("SELECTEDICON")) 87 c.setSelectedIcon(new SURLIcon(value)); 88 else if (name.equals("ROLLOVERSELECTEDICON")) 89 c.setRolloverSelectedIcon(new SURLIcon(value)); 90 else if (name.equals("PRESSEDICON")) 91 c.setPressedIcon(new SURLIcon(value)); 92 else 93 super.setProperty(comp, name, value); 94 } 95 96 public Class [] getSupportedClasses() { 97 return classes; 98 } 99 } 100 | Popular Tags |