Пример #1
0
 /** Creates a new html tag handler */
 public HtmlTagHandler() {
   // #ifdef polish.i18n.useDynamicTranslations
   if (Locale.get("polish.command.followlink") != CMD_LINK.getLabel()) {
     CMD_LINK = new Command(Locale.get("polish.command.followlink"), Command.OK, 2);
     CMD_SUBMIT = new Command(Locale.get("polish.command.submit"), Command.ITEM, 2);
     CMD_BACK = new Command(Locale.get("polish.command.back"), Command.BACK, 10);
   }
   // #endif
   STYLE_LINE_BREAK.layout = Item.LAYOUT_NEWLINE_AFTER;
 }
Пример #2
0
  private Style createStyle(Style baseStyle, Style extendStyle) {
    if (baseStyle != null && extendStyle != null) {
      if (baseStyle.name.equals(extendStyle.name)) {
        return baseStyle;
      }
    }

    // #debug sl.debug.style
    System.out.println("extending style " + baseStyle.name + " with style " + extendStyle.name);

    Style result = new Style(baseStyle);

    result.name = baseStyle.name + "." + extendStyle.name;

    if (extendStyle.layout != Item.LAYOUT_DEFAULT) {
      result.layout = extendStyle.layout;
    }

    if (extendStyle.border != null) {
      result.border = extendStyle.border;
    }

    if (extendStyle.background != null) {
      result.background = extendStyle.background;
    }

    Style baseFocusedStyle = (Style) baseStyle.getObjectProperty("focused-style");
    short[] keys = extendStyle.getRawAttributeKeys();

    if (keys != null) {
      for (int i = 0; i < keys.length; i++) {
        short key = keys[i];
        Object value = extendStyle.getObjectProperty(key);

        if (key == FOCUSED_STYLE_KEY && baseFocusedStyle != null && value != null) {
          Style extendFocusedStyle = (Style) value;
          Style resultFocusedStyle = createStyle(baseFocusedStyle, extendFocusedStyle);
          result.addAttribute(key, resultFocusedStyle);
        } else {
          if (value != null) {
            result.addAttribute(key, value);
          }
        }
      }
    }

    return result;
  }