Esempio n. 1
0
  private void rewriteCompletion() {
    StringBuilder sb = new StringBuilder();

    boolean toUpperCase = false;
    for (char c : completion.toCharArray()) {
      if (Character.isLetterOrDigit(c)) {
        sb.append(toUpperCase ? Character.toUpperCase(c) : Character.toLowerCase(c));
        toUpperCase = false;
      } else {
        sb.append(c);
        toUpperCase = true;
      }
    }
    completion = sb.toString();
  }
Esempio n. 2
0
 public void keyTyped(char ch) {
   if (this.emuSys != null) {
     if (this.emuSys.getSwapKeyCharCase()) {
       if (Character.isUpperCase(ch)) {
         ch = Character.toLowerCase(ch);
       } else if (Character.isLowerCase(ch)) {
         ch = Character.toUpperCase(ch);
       }
     }
     if (this.emuSys.getConvertKeyCharToISO646DE()) {
       this.emuSys.keyTyped(TextUtil.toISO646DE(ch));
     } else {
       this.emuSys.keyTyped(ch);
     }
   }
 }
Esempio n. 3
0
  public void resolveImpliedKeys() {
    String util = (String) super.transientKeys.get("jrfImpl");
    if (util == null) {
      util = (String) super.transientKeys.get("dbType");
      if (util == null)
        throw new IllegalArgumentException(this + ": neither jrfImpl or dbType is specified.");
      String t = (String) dbTypeToJrfImplMap.getProperty(util);
      if (t == null) {
        throw new IllegalArgumentException(
            this + ": no JRF column impl translation found for " + util);
      }
      util = t;
    }
    // fill out if required.
    if (util.indexOf(".") == -1) {
      util = "net.sf.jrf.column.columnspecs." + util;
    }
    super.transientKeys.put("jrfImpl", util);
    try {
      ColumnSpec spec = (ColumnSpec) Class.forName(util).newInstance();
      if (spec instanceof DayOfWeekColumnSpec) type = T_DOW;
      else if (spec instanceof TextColumnSpec) type = T_TEXT;
      else if (spec instanceof NumericColumnSpec) type = T_NUMERIC;
      else if (spec instanceof DateColumnSpec) type = T_DATE;
      else type = T_OTHER;
      jrfColumnClassName = spec.getColumnClass().getName();
    } catch (Exception ne) {
      throw new IllegalArgumentException(this + ": No such class: " + util);
    }
    if (nullable && type != T_DOW) {
      // If is nullable -- CANNOT be a primitive -- override default.
      usePrimitives = false;
    }
    util = (String) super.transientKeys.get("objectName");
    if (util == null) {
      if (initCapNameOnly) {
        util = (String) super.transientKeys.get("name");
        super.transientKeys.put(
            "objectName", java.lang.Character.toUpperCase(util.charAt(0)) + util.substring(1));
      } else
        super.transientKeys.put(
            "objectName",
            JRFGeneratorUtil.databaseNameToFieldName((String) super.transientKeys.get("name")));
      util = (String) super.transientKeys.get("objectName");
    }
    super.transientKeys.put("propertyName", generatePropertyName(util));
    getterSetter = super.transientKeys.get("objectName") + "GetterSetter";
    fieldName = "f_" + ((String) super.transientKeys.get("objectName"));
    util = (String) transientKeys.get("maxValue");
    if (util == null) {
      super.transientKeys.put("maxValue", "null");
    }
    util = (String) super.transientKeys.get("minValue");
    if (util == null) {
      super.transientKeys.put("minValue", "null");
    }
    util = (String) super.transientKeys.get("default");
    if (util == null || type == T_DOW) {
      super.transientKeys.put("default", "null");
    }
    if (type == T_DOW) {
      if (util == null) {
        defaultBeanValue = "net.sf.jrf.column.columnspecs.DayOfWeekColumnSpec.NULLDAYOFWEEK";
      } else {
        defaultBeanValue = util;
      }
    }
    if (util != null) {
      if (!util.startsWith("new")) {
        super.transientKeys.put(
            "default", JRFGeneratorUtil.getLiteralValueCode(jrfColumnClassName, util));
      }
    }

    util = (String) super.transientKeys.get("size");
    if (util == null) {
      super.transientKeys.put("size", "255");
    }
    super.transientKeys.put("listOfValues", "null");
    super.transientKeys.put("listOfValuesAdd", "");
    setDescriptionColor(primaryKey ? defaultPKColor : defaultColor);
    util = (String) super.transientKeys.get("writeOnce");
    if (util.equals("true") && !primaryKey) {
      super.transientKeys.put("writeOnceAdd", "    colVar.setWriteOnce(true);");
    } else {
      super.transientKeys.put("writeOnceAdd", "");
    }
  }
Esempio n. 4
0
 public ceylon.language.Character uppercase() {
   return instance(java.lang.Character.toUpperCase(value));
 }