コード例 #1
0
 public String getA_Kontonummer() {
   Perl5Util re = new Perl5Util();
   String erg = extract(60, 10);
   re.match("/^[0 ]*([1-9].*$)/", erg); // führende Leerstellen und Nullen abschneiden
   return re.group(1);
 }
コード例 #2
0
ファイル: RGGLabelFactory.java プロジェクト: rforge/rgg
  public RElement createRGGElement(Element element, RGG rggInstance) {
    if (element.getNodeType() != Element.ELEMENT_NODE)
      throw new IllegalArgumentException("elements node type must be ELEMENT_NODE");

    /**
     * **************** initialize and set attributes values *************************************
     */
    String text = element.getAttribute(RGG.getConfiguration().getString("TEXT"));
    String colspan = element.getAttribute(RGG.getConfiguration().getString("COLUMN-SPAN"));
    String alignment = element.getAttribute(RGG.getConfiguration().getString("ALIGNMENT"));
    String enabled = element.getAttribute(RGG.getConfiguration().getString("ENABLED"));
    /**
     * ********************************************************************************************
     */
    Perl5Util util = new Perl5Util();

    VLabel vlabel = new VLabel(text);
    if (StringUtils.isNotBlank(colspan)) {
      if (StringUtils.isNumeric(colspan)) {
        vlabel.setColumnSpan(Integer.parseInt(colspan));
      } else if (StringUtils.equals(colspan, RGG.getConfiguration().getString("FULL-SPAN")))
        vlabel.setColumnSpan(LayoutInfo.FULL_SPAN);
      else
        throw new NumberFormatException(
            RGG.getConfiguration().getString("COLUMN-SPAN")
                + " seems not to be a number: "
                + colspan);
    }

    if (StringUtils.isNotBlank(alignment)) {
      if (StringUtils.equalsIgnoreCase(RGG.getConfiguration().getString("CENTER"), alignment)) {
        vlabel.setHorizontalAlignment(SwingConstants.CENTER);
      } else if (StringUtils.equalsIgnoreCase(
          RGG.getConfiguration().getString("RIGHT"), alignment)) {
        vlabel.setHorizontalAlignment(SwingConstants.RIGHT);
      } else if (StringUtils.equalsIgnoreCase(
          RGG.getConfiguration().getString("LEFT"), alignment)) {
        vlabel.setHorizontalAlignment(SwingConstants.LEFT);
      } else if (StringUtils.equalsIgnoreCase(RGG.getConfiguration().getString("TOP"), alignment)) {
        vlabel.setHorizontalAlignment(SwingConstants.TOP);
      } else if (StringUtils.equalsIgnoreCase(
          RGG.getConfiguration().getString("BOTTOM"), alignment)) {
        vlabel.setHorizontalAlignment(SwingConstants.BOTTOM);
      }
    }

    if (StringUtils.isNotBlank(enabled)) {
      if (util.match("/(\\w+)\\./", enabled)) {
        String id = util.group(1);
        enabled = util.substitute("s/" + id + "\\.//g", enabled);
        AutoBinding<Object, Object, Object, Object> binding =
            Bindings.createAutoBinding(
                AutoBinding.UpdateStrategy.READ, // one-way binding
                rggInstance.getObject(id), // source of value
                ELProperty.create(enabled), // the property to get
                vlabel, // the "backing bean"
                BeanProperty.create("enabled") // property to set
                );
        binding.bind();
      }
    }

    RLabel rLabel = new RLabel(vlabel);
    if (element.hasChildNodes()) { // it can only be <iport>
      setInputPorts(rLabel, element);
    }
    return rLabel;
  }