Package net.rim.device.api.ui.component

Examples of net.rim.device.api.ui.component.LabelField


        private final SubMenu _phoneSubMenu;

        // Creates a new MenuDemoScreen object
        MenuDemoScreen() {
            setTitle("Menu Demo");
            add(new LabelField(
                    "Press the menu key to view the customized menu."));
            add(new SeparatorField());

            // Initialize font family and menu font
            _fontFamilies = FontFamily.getFontFamilies();
View Full Code Here


     * Initializes map.
     */
    public DemoMapField() {
        // Sample label is only used to determine the instructive text height
        // and is declared null right after use.
        _sampleLabel = new LabelField();
        _textHeight = _sampleLabel.getPreferredHeight();
        _sampleLabel = null;

        // Zoom in to the deepest level
        setZoom(getMinZoom());
View Full Code Here

    public SimpleListScreen(final DemoStringTokenizer deviceData) {
        super(Manager.NO_VERTICAL_SCROLL);

        setTitle("Simple List Screen");

        add(new LabelField("BlackBerry Devices", Field.FIELD_HCENTER));
        add(new SeparatorField());

        // Get this screen's main manager (VerticalFieldManager)
        final Manager mainManager = getMainManager();
View Full Code Here

    public AdjustmentScreen() {
        super(NO_VERTICAL_SCROLL);

        setTitle("Adjustment Screen");

        final LabelField directions =
                new LabelField(
                        "Use the spin box to change the RGB values of the color displayed in the bottom field.");
        add(directions);

        add(new SeparatorField());
View Full Code Here

         * Creates a new AutoCompleteFieldDemoScreen object
         */
        AutoCompleteFieldDemoScreen() {
            setTitle("Auto Complete Field Demo");

            add(new LabelField("Type in a field to search"));
            add(new SeparatorField());

            // Create the filtered lists
            _filteredListContacts = new BasicFilteredList();
            final BasicFilteredList filteredListMedia = new BasicFilteredList();
            final BasicFilteredList filteredListMonths =
                    new BasicFilteredList();

            // Add data source for contacts
            _filteredListContacts.addDataSource(0,
                    BasicFilteredList.DATA_SOURCE_CONTACTS,
                    BasicFilteredList.DATA_FIELD_CONTACTS_NAME_FULL
                            | BasicFilteredList.DATA_FIELD_CONTACTS_COMPANY
                            | BasicFilteredList.DATA_FIELD_CONTACTS_EMAIL,
                    BasicFilteredList.DATA_FIELD_CONTACTS_NAME_FULL,
                    BasicFilteredList.DATA_FIELD_CONTACTS_EMAIL, -1, null,
                    BasicFilteredList.COMPARISON_IGNORE_CASE);

            // Add data source for music
            filteredListMedia.addDataSource(0,
                    BasicFilteredList.DATA_SOURCE_MUSIC,
                    BasicFilteredList.DATA_FIELD_MUSIC_SONG,
                    BasicFilteredList.DATA_FIELD_MUSIC_ARTIST
                            | BasicFilteredList.DATA_FIELD_MUSIC_ALBUM
                            | BasicFilteredList.DATA_FIELD_MUSIC_SONG,
                    BasicFilteredList.DATA_FIELD_MUSIC_SONG, -1, null,
                    BasicFilteredList.COMPARISON_IGNORE_CASE);

            // Add data source for pictures
            filteredListMedia.addDataSource(0,
                    BasicFilteredList.DATA_SOURCE_PICTURES,
                    BasicFilteredList.DATA_FIELD_PICTURES_TITLE,
                    BasicFilteredList.DATA_FIELD_PICTURES_TITLE, -1, -1, null,
                    BasicFilteredList.COMPARISON_IGNORE_CASE);

            // Add data source for videos
            filteredListMedia.addDataSource(0,
                    BasicFilteredList.DATA_SOURCE_VIDEOS,
                    BasicFilteredList.DATA_FIELD_VIDEOS_TITLE,
                    BasicFilteredList.DATA_FIELD_VIDEOS_TITLE, -1, -1, null,
                    BasicFilteredList.COMPARISON_IGNORE_CASE);

            // Add data set for months
            final String[] months =
                    { "January", "February", "March", "April", "May", "June",
                            "July", "August", "September", "October",
                            "November", "December" };
            filteredListMonths.addDataSet(0, months, "Month",
                    BasicFilteredList.COMPARISON_IGNORE_CASE);

            // Create AutoCompleteFields
            final AutoCompleteField autoCompleteFieldContacts =
                    new AutoCompleteField(_filteredListContacts,
                            AutoCompleteField.LIST_STATIC
                                    | AutoCompleteField.LIST_DROPDOWN);
            final AutoCompleteField autoCompleteFieldMedia =
                    new AutoCompleteField(filteredListMedia,
                            AutoCompleteField.LIST_STATIC
                                    | AutoCompleteField.LIST_SHOW_DATA_SET_NAME
                                    | AutoCompleteField.LIST_DROPDOWN);
            final AutoCompleteField autoCompleteFieldMonths =
                    new AutoCompleteField(filteredListMonths,
                            AutoCompleteField.LIST_STATIC
                                    | AutoCompleteField.LIST_DROPDOWN);

            // Add the AutoCompleteFields to the screen
            add(new LabelField("Choose a contact"));
            add(autoCompleteFieldContacts);
            add(new LabelField("Choose media"));
            add(autoCompleteFieldMedia);
            add(new LabelField("Choose a month"));
            add(autoCompleteFieldMonths);
        }
View Full Code Here

    public TreeScreen(final DemoStringTokenizer deviceData) {
        super(Manager.NO_VERTICAL_SCROLL);

        setTitle("Tree Screen");

        add(new LabelField("BlackBerry Devices", Field.FIELD_HCENTER));
        add(new SeparatorField());

        // Initialize the model if it has not yet been loaded
        _tableModel =
                new SortedTableModel(StringComparator.getInstance(true), 2);

        // Populate the list
        while (deviceData.hasMoreTokens()) {
            final String modelNumber = deviceData.nextToken().trim();

            final StringBuffer displayName = new StringBuffer(modelNumber);

            final String modelName = deviceData.nextToken().trim();
            if (!modelName.equals(modelNumber)) {
                displayName.append(" (");
                displayName.append(modelName);
                displayName.append(")");
            }

            final String os = deviceData.nextToken().trim();
            final String imageFileName = modelNumber + ".png";
            final Bitmap bitmap = Bitmap.getBitmapResource(imageFileName);
            final String year = deviceData.nextToken().trim();
            final String interfaces = deviceData.nextToken().trim();

            _tableModel.addRow(new Object[] { bitmap, displayName.toString(),
                    os, year, interfaces });
        }

        // Create and apply style
        final RegionStyles style =
                new RegionStyles(BorderFactory.createSimpleBorder(new XYEdges(
                        1, 1, 1, 1), Border.STYLE_SOLID), null, null, null,
                        RegionStyles.ALIGN_LEFT, RegionStyles.ALIGN_TOP);

        // Create the view and controller
        final TableView tableView = new TableView(_tableModel);
        final TableController tableController =
                new TableController(_tableModel, tableView);

        // Set the controller focus policy to highlight rows
        tableController.setFocusPolicy(TableController.ROW_FOCUS);

        // Set the behaviour of the controller when a table item is clicked
        tableController.setCommand(new Command(new CommandHandler() {
            /**
             * @see CommandHandler#execute(ReadOnlyCommandMetadata, Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                Dialog.alert("Command Executed");
            }
        }));

        tableView.setController(tableController);

        // Create a DataTemplate that suppresses the third column
        final DataTemplate dataTemplate = new DataTemplate(tableView, 2, 3) {
            /**
             * @see DataTemplate#getDataFields(int)
             */
            public Field[] getDataFields(final int modelRowIndex) {
                final Object[] data =
                        (Object[]) ((TableModel) getView().getModel())
                                .getRow(modelRowIndex);

                final Field[] fields = new Field[4];
                fields[0] = new BitmapField((Bitmap) data[0]);
                fields[1] =
                        new LabelField(data[1], Field.FOCUSABLE
                                | DrawStyle.HCENTER);
                fields[2] = new LabelField(data[3], Field.FOCUSABLE);
                fields[3] = new LabelField(data[4], Field.FOCUSABLE);

                return fields;
            }
        };

View Full Code Here

            final PaneManagerModel model = new PaneManagerModel();
            model.enableLooping(true);

            // Create a pane
            VerticalFieldManager vfm = new VerticalFieldManager();
            vfm.add(new LabelField("Data 1"));
            final XYEdges edgesOne = new XYEdges(1, 1, 1, 1);
            vfm.setBorder(BorderFactory.createRoundedBorder(edgesOne));
            final Pane pane =
                    new Pane(new LabelField("Pane 1", Field.FOCUSABLE
                            | Field.FIELD_HCENTER), vfm);

            // Add the pane to the model
            model.addPane(pane);

            // Create a second pane
            vfm = new VerticalFieldManager();
            for (int i = 0; i < 30; i++) {
                vfm.add(new LabelField("Data " + i, Field.FOCUSABLE));
            }
            final LabelField iconTextLabelField =
                    new LabelField("Pane 2", Field.FOCUSABLE
                            | Field.FIELD_HCENTER);
            model.addPane(new Pane(iconTextLabelField, vfm));

            // Create a third pane
            vfm = new VerticalFieldManager();
            final ButtonField button =
                    new ButtonField("Button", ButtonField.CONSUME_CLICK
                            | ButtonField.NEVER_DIRTY);
            button.setChangeListener(new FieldChangeListener() {
                public void fieldChanged(final Field field, final int context) {
                    Dialog.inform("Button activated.");
                }
            });
            vfm.add(button);
            model.addPane(new Pane(new LabelField("Pane 3", Field.FOCUSABLE
                    | Field.FIELD_HCENTER), vfm));

            // Choose which pane the model is displaying
            model.setCurrentlySelectedIndex(1);
View Full Code Here

                        "Illuminate with square border", "Square border",
                        "Magnify lens", "Shrink lens",
                        "Illuminate with magnify lens",
                        "Illuminate with shrink lens" };
        add(new SeparatorField());
        add(new LabelField("Select highlight style", Field.FIELD_HCENTER));
        _choiceField =
                new ObjectChoiceField("", choices, HighlightStyle.ILLUMINATE,
                        Field.FIELD_HCENTER);
        _choiceField.setChangeListener(this);
        add(_choiceField);
View Full Code Here

        _searchButton.setChangeListener(this);
        add(_searchButton);

        add(new SeparatorField());

        _resultsField = new LabelField();
        add(_resultsField);
    }
View Full Code Here

            final String[] choices =
                    { "New York", "Paris", "Barcelona", "Beijing", "Moscow",
                            "Brasilia", "Melbourne" };
            _spinBoxField = new TextSpinBoxField(choices);
            _spinBoxField.setVisibleRows(3);
            add(new LabelField("Choose city:"));
            add(new SeparatorField());
            final HorizontalFieldManager hfm =
                    new HorizontalFieldManager(Field.FIELD_HCENTER);
            hfm.add(_spinBoxField);
            add(hfm);
View Full Code Here

TOP

Related Classes of net.rim.device.api.ui.component.LabelField

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.