001: /*
002: * Copyright 2000,2005 wingS development team.
003: *
004: * This file is part of wingS (http://wingsframework.org).
005: *
006: * wingS is free software; you can redistribute it and/or modify
007: * it under the terms of the GNU Lesser General Public License
008: * as published by the Free Software Foundation; either version 2.1
009: * of the License, or (at your option) any later version.
010: *
011: * Please see COPYING for the complete licence.
012: */
013: package org.wings.template.propertymanagers;
014:
015: import org.wings.SAbstractIconTextCompound;
016: import org.wings.SComponent;
017: import org.wings.SURLIcon;
018:
019: /**
020: * @author armin
021: * created at 05.03.2004 10:24:07
022: */
023: public class SAbstractIconTextCompoundPropertyManager extends
024: SComponentPropertyManager {
025: static final Class[] classes = { SAbstractIconTextCompound.class };
026:
027: public SAbstractIconTextCompoundPropertyManager() {
028: }
029:
030: public void setProperty(SComponent comp, String name, String value) {
031: SAbstractIconTextCompound c = (SAbstractIconTextCompound) comp;
032: if (name.equals("TEXT"))
033: c.setText(value);
034: else if (name.startsWith("ICON")) {
035: if (name.equals("ICON"))
036: c.setIcon(new SURLIcon(value));
037: else if (name.equals("ICONWIDTH")) {
038: try {
039: int width = Integer.parseInt(value);
040: if (c.getIcon() != null) {
041: c.getIcon().setIconWidth(width);
042: } // end of if ()
043: if (c.getDisabledIcon() != null) {
044: c.getDisabledIcon().setIconWidth(width);
045: } // end of if ()
046: if (c.getSelectedIcon() != null) {
047: c.getSelectedIcon().setIconWidth(width);
048: } // end of if ()
049: if (c.getRolloverIcon() != null) {
050: c.getRolloverIcon().setIconWidth(width);
051: } // end of if ()
052: if (c.getRolloverSelectedIcon() != null) {
053: c.getRolloverSelectedIcon().setIconWidth(width);
054: } // end of if ()
055: if (c.getPressedIcon() != null) {
056: c.getPressedIcon().setIconWidth(width);
057: } // end of if ()
058: } catch (NumberFormatException ex) {
059: } // end of try-catch
060: } else if (name.equals("ICONHEIGHT")) {
061: try {
062: int height = Integer.parseInt(value);
063: if (c.getIcon() != null) {
064: c.getIcon().setIconHeight(height);
065: } // end of if ()
066: if (c.getDisabledIcon() != null) {
067: c.getDisabledIcon().setIconHeight(height);
068: } // end of if ()
069: if (c.getSelectedIcon() != null) {
070: c.getSelectedIcon().setIconHeight(height);
071: } // end of if ()
072: if (c.getRolloverIcon() != null) {
073: c.getRolloverIcon().setIconHeight(height);
074: } // end of if ()
075: if (c.getRolloverSelectedIcon() != null) {
076: c.getRolloverSelectedIcon().setIconHeight(
077: height);
078: } // end of if ()
079: if (c.getPressedIcon() != null) {
080: c.getPressedIcon().setIconHeight(height);
081: } // end of if ()
082: } catch (NumberFormatException ex) {
083: } // end of try-catch
084: }
085: } else if (name.equals("DISABLEDICON"))
086: c.setDisabledIcon(new SURLIcon(value));
087: else if (name.equals("SELECTEDICON"))
088: c.setSelectedIcon(new SURLIcon(value));
089: else if (name.equals("ROLLOVERSELECTEDICON"))
090: c.setRolloverSelectedIcon(new SURLIcon(value));
091: else if (name.equals("PRESSEDICON"))
092: c.setPressedIcon(new SURLIcon(value));
093: else
094: super .setProperty(comp, name, value);
095: }
096:
097: public Class[] getSupportedClasses() {
098: return classes;
099: }
100: }
|