Package com.sun.midp.lcdui

Examples of com.sun.midp.lcdui.DynamicCharacterArray


                       w, h, offset, options, cursor);
       
        // just correct cursor index if the charracter has
        // been already committed
        if (str != null && str.length() > 0) {
            getBufferString(new DynamicCharacterArray(str),
                            constraints, cursor, true);
        }
       
        // We'll double check our anchor point in case the Form
        // has scrolled and we need to update our InputModeLayer's
View Full Code Here


                                  TextCursor cursor,
                                  boolean modifyCursor) {
       
        String ret = null;
        if (!bufferedTheSameAsDisplayed(constraints)) {
            DynamicCharacterArray out = new DynamicCharacterArray(dca.length());
           
            if (!modifyCursor) {
                cursor = new TextCursor(cursor);
            }

            if ((constraints & TextField.CONSTRAINT_MASK) ==
                TextField.PHONENUMBER) {
                for (int i = 0, j = 0; i < dca.length(); i++) {
                    char next = dca.charAt(i);
                    if (next == ' ') {
                        if (cursor.index > i) cursor.index--;
                    } else {
                        out.insert(j++, next);
                    }
                }
            }
            ret = out.toString();
        } else {
            ret = dca.toString();
        }
        return ret;
    }
View Full Code Here

                                   char opChar,
                                   int constraints,
                                   TextCursor cursor,
                                   boolean modifyCursor) {
        log("[tf.getDisplayString]");
        DynamicCharacterArray out = new DynamicCharacterArray(dca.length() + 1);

        int index = cursor == null ? dca.length() : cursor.index;
       
        if ((constraints & TextField.PASSWORD) == TextField.PASSWORD) {
            index = getStringForPassword(dca, constraints, index, opChar, out);
        } else { // not password
            out.insert(dca.toCharArray(), 0, dca.length(), 0);

            switch (constraints & TextField.CONSTRAINT_MASK) {
            case TextField.PHONENUMBER:
                index = getStringForPhoneNumber(dca, index, opChar, out);
                break;
            case TextField.DECIMAL:
                index = getStringForDecimal(dca, index, opChar, out);
                break;
            case TextField.NUMERIC:
                index = getStringForNumeric(dca, index, opChar, out);
                break;
            case TextField.EMAILADDR:
            case TextField.URL:
            case TextField.ANY:
                if (opChar > 0 && dca.length() < tf.getMaxSize()) {
                    out.insert(index++, opChar);
                }
                break;
            default:
                // for safety/completeness.
                Logging.report(Logging.ERROR, LogChannels.LC_HIGHUI,
                               "TextFieldLFImpl: constraints=" + constraints);
                if (opChar > 0 && dca.length() < tf.getMaxSize()) {
                    out.insert(index++, opChar);
                }
                break;
            }
        }
       
        if (out == null) {
            out = dca;
        }

        if (modifyCursor && cursor != null) {
            cursor.index = index;
        }

        log("[TF.getDisplayString] getMatchList:");
        pt_matches = inputSession.getMatchList();

        return out.toString();
    }
View Full Code Here

        }

        // just correct cursor index if the charracter has
        // been already committed
        if (str != null && str.length() > 0) {
            getBufferString(new DynamicCharacterArray(str),
                            constraints, cursor, true);
        }

       
        // We'll double check our anchor point in case the Form
View Full Code Here

        log("TF.commit:: " + input);

        synchronized (Display.LCDUILock) {
            try {
                cursor.visible = true;
                DynamicCharacterArray in = tf.buffer;
               
                TextCursor newCursor =  new TextCursor(cursor);
                for (int i = 0; i < input.length(); i++) {
                    String str = getDisplayString(in, input.charAt(i),
                                                  tf.constraints,
                                                  newCursor, true);
                    in = new DynamicCharacterArray(str);
                }
               
              
                if (bufferedTheSameAsDisplayed(tf.constraints)) {
                    if (lValidate(in, tf.constraints)) {
                        tf.delete(0, tf.buffer.length());
                        tf.insert(in.toString(), 0);
                        setCaretPosition(newCursor.index);
                        tf.notifyStateChanged();
                    }
                } else if (tf.buffer.length() < tf.getMaxSize()) {
                    tf.insert(input, cursor.index);
View Full Code Here

        super(label);

        synchronized (Display.LCDUILock) {

            // IllegalArgumentException thrown here
            buffer = new DynamicCharacterArray(maxSize);

      // Constraint value is checked here. Since textFieldLF is not
      // yet created, no LF notification will happen.
            setConstraintsImpl(constraints);
View Full Code Here

        super(label);

        synchronized (Display.LCDUILock) {

            // IllegalArgumentException thrown here
            buffer = new DynamicCharacterArray(maxSize);

      // Constraint value is checked here. Since textFieldLF is not
      // yet created, no LF notification will happen.
            setConstraintsImpl(constraints);
View Full Code Here

            if (length > buffer.capacity()) {
                throw new IllegalArgumentException();
            }
           
            if (length > 0) {
                DynamicCharacterArray dca =
                    new DynamicCharacterArray(length);
               
                dca.set(data, offset, length);
               
                if (!textFieldLF.lValidate(dca, constraints)) {
                    throw new IllegalArgumentException();
                }
            }
View Full Code Here

TOP

Related Classes of com.sun.midp.lcdui.DynamicCharacterArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.