Examples of StringProvider


Examples of net.rim.device.api.util.StringProvider

        add(separator);
        _testField = new TestField("Test Field: ", "");
        add(_testField);

        _spellCheckItem =
                new MenuItem(new StringProvider("Spell check"), 0x230010, 1);
        _spellCheckItem.setCommand(new Command(new CommandHandler() {
            /**
             * Checks the spelling in the TestField.
             *
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                if (_testField.getText().length() == 0) {
                    Dialog.alert("Test field cannot be empty");
                } else {
                    _app.spellCheck(_testField);
                }
            }
        }));

        _learnWordItem =
                new MenuItem(new StringProvider("Learn word"), 0x230020, 1);
        _learnWordItem.setCommand(new Command(new CommandHandler() {
            /**
             * Learns the word in the TestField.
             *
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                if (_testField.getText().length() == 0) {
                    Dialog.alert("Test field cannot be empty");
                } else {
                    _app.learnWord(_testField.getText());
                }
            }
        }));

        _learnCorrectionItem =
                new MenuItem(new StringProvider("Learn correction"), 0x230030,
                        2);
        _learnCorrectionItem.setCommand(new Command(new CommandHandler() {
            /**
             * Shows the user a list of possible corrections for the word in the
             * TestField.
 
View Full Code Here

Examples of org.apache.wink.common.internal.providers.entity.StringProvider

            public <T> MessageBodyReader<T> getMessageBodyReader(Class<T> type,
                                                                 Type genericType,
                                                                 Annotation[] annotations,
                                                                 MediaType mediaType) {
                return (MessageBodyReader<T>)new StringProvider();
            }

            @SuppressWarnings("unchecked")
            public <T> MessageBodyWriter<T> getMessageBodyWriter(Class<T> type,
                                                                 Type genericType,
                                                                 Annotation[] annotations,
                                                                 MediaType mediaType) {
                return (MessageBodyWriter<T>)new StringProvider();
            }
        };

    }
View Full Code Here

Examples of org.apache.wink.common.internal.providers.entity.StringProvider

    public void testMessageBodyWriters() {
        ProvidersRegistry providers = createProvidersRegistryImpl();

        ByteArrayProvider byteArrayProvider = new ByteArrayProvider();
        InputStreamProvider inputStreamProvider = new InputStreamProvider();
        StringProvider stringProvider = new StringProvider();
        String2Provider string2Provider = new String2Provider();
        FileProvider fileProvider = new FileProvider();
        IntegerMessageBodyProvider objectMessageBodyProvider = new IntegerMessageBodyProvider();

        providers.addProvider(byteArrayProvider, WinkApplication.SYSTEM_PRIORITY);
View Full Code Here

Examples of org.apache.wink.common.internal.providers.entity.StringProvider

    public void testMessageBodyWritersMediaTypes() {
        ProvidersRegistry providers = createProvidersRegistryImpl();

        ByteArrayProvider byteArrayProvider = new ByteArrayProvider();
        InputStreamProvider inputStreamProvider = new InputStreamProvider();
        StringProvider stringProvider = new StringProvider();
        String2Provider string2Provider = new String2Provider();
        FileProvider fileProvider = new FileProvider();
        IntegerMessageBodyProvider objectMessageBodyProvider = new IntegerMessageBodyProvider();

        providers.addProvider(byteArrayProvider);
View Full Code Here

Examples of org.apache.wink.common.internal.providers.entity.StringProvider

    private static void verifyResponseGZIPContentEncodedForRepeatedStrings(ClientResponse response)
        throws IOException {
        assertEquals(200, response.getStatusCode());
        InputStream is = response.getEntity(InputStream.class);
        GZIPInputStream gzipIS = new GZIPInputStream(is);
        StringProvider sp = new StringProvider();
        String responseEntity =
            sp.readFrom(String.class,
                        String.class,
                        new Annotation[] {},
                        MediaType.TEXT_PLAIN_TYPE,
                        null,
                        gzipIS);
View Full Code Here

Examples of org.apache.wink.common.internal.providers.entity.StringProvider

    private static void verifyResponseDeflateContentEncodedForRepeatedStrings(ClientResponse response)
        throws IOException {
        assertEquals(200, response.getStatusCode());
        InputStream is = response.getEntity(InputStream.class);
        InflaterInputStream inflaterIS = new InflaterInputStream(is);
        StringProvider sp = new StringProvider();
        String responseEntity =
            sp.readFrom(String.class,
                        String.class,
                        new Annotation[] {},
                        MediaType.TEXT_PLAIN_TYPE,
                        null,
                        inflaterIS);
View Full Code Here

Examples of org.apache.wink.common.internal.providers.entity.StringProvider

        assertEquals("gzip", response.getHeaders().getFirst(HttpHeaders.CONTENT_ENCODING));
        assertEquals(1, response.getHeaders().get(HttpHeaders.CONTENT_ENCODING).size());

        InputStream is = response.getEntity(InputStream.class);
        GZIPInputStream gzipIS = new GZIPInputStream(is);
        StringProvider sp = new StringProvider();
        String responseEntity =
            sp.readFrom(String.class,
                        String.class,
                        new Annotation[] {},
                        MediaType.TEXT_PLAIN_TYPE,
                        null,
                        gzipIS);
View Full Code Here

Examples of org.apache.wink.common.internal.providers.entity.StringProvider

        assertEquals("gzip", response.getHeaders().getFirst(HttpHeaders.CONTENT_ENCODING));
        assertEquals(1, response.getHeaders().get(HttpHeaders.CONTENT_ENCODING).size());

        InputStream is = response.getEntity(InputStream.class);
        GZIPInputStream gzipIS = new GZIPInputStream(is);
        StringProvider sp = new StringProvider();
        String responseEntity =
            sp.readFrom(String.class,
                        String.class,
                        new Annotation[] {},
                        MediaType.TEXT_PLAIN_TYPE,
                        null,
                        gzipIS);
View Full Code Here

Examples of org.apache.wink.common.internal.providers.entity.StringProvider

        assertEquals("gzip", response.getHeaders().getFirst(HttpHeaders.CONTENT_ENCODING));
        assertEquals(1, response.getHeaders().get(HttpHeaders.CONTENT_ENCODING).size());

        InputStream is = response.getEntity(InputStream.class);
        GZIPInputStream gzipIS = new GZIPInputStream(is);
        StringProvider sp = new StringProvider();
        String responseEntity =
            sp.readFrom(String.class,
                        String.class,
                        new Annotation[] {},
                        MediaType.TEXT_PLAIN_TYPE,
                        null,
                        gzipIS);
View Full Code Here

Examples of org.apache.wink.common.internal.providers.entity.StringProvider

            public <T> MessageBodyReader<T> getMessageBodyReader(Class<T> type,
                                                                 Type genericType,
                                                                 Annotation[] annotations,
                                                                 MediaType mediaType) {
                return (MessageBodyReader<T>)new StringProvider();
            }

            @SuppressWarnings("unchecked")
            public <T> MessageBodyWriter<T> getMessageBodyWriter(Class<T> type,
                                                                 Type genericType,
                                                                 Annotation[] annotations,
                                                                 MediaType mediaType) {
                return (MessageBodyWriter<T>)new StringProvider();
            }
        };

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.