Examples of PaneManagerModel


Examples of net.rim.device.api.ui.component.pane.PaneManagerModel

         */
        public PaneManagerDemoScreen() {
            super(Field.FOCUSABLE);

            // Instantiate the model for the pane manager and enable looping
            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);

            // Create the header and initialize the model and visual properties
            TitleView header;
            PaneManagerController controller;
            header = new HorizontalScrollableTitleView(Field.FOCUSABLE);
            ((HorizontalScrollableTitleView) header).enableArrows(true);
            controller = new HorizontalScrollableController();
            header.setModel(model);
            final XYEdges edgesFour = new XYEdges(4, 4, 4, 4);
            header.setBorder(BorderFactory.createRoundedBorder(edgesFour));

            // Set arrow images
            final Bitmap leftArrow = Bitmap.getBitmapResource("leftArrow.png");
            final Bitmap rightArrow =
                    Bitmap.getBitmapResource("rightArrow.png");
            if (leftArrow != null) {
                header.setLeftArrow(leftArrow);
            }
            if (rightArrow != null) {
                header.setRightArrow(rightArrow);
            }

            // Create the PaneView object, which will display the panes and is
            // controlled by the model.
            final PaneView paneView = new PaneView(Field.FOCUSABLE);
            paneView.setBorder(BorderFactory.createSimpleBorder(edgesOne));
            paneView.setModel(model);

            // Initialize the PaneManagerView
            final PaneManagerView paneManagerView =
                    new PaneManagerView(Field.FOCUSABLE, header, paneView);
            paneManagerView.setModel(model);
            paneManagerView.setBorder(BorderFactory
                    .createRoundedBorder(edgesFour));
            model.setView(paneManagerView);

            // Initialize the Controller
            controller.setModel(model);
            controller.setView(paneManagerView);
            model.setController(controller);
            paneManagerView.setController(controller);

            add(paneManagerView);

            final MenuItem myItem =
View Full Code Here

Examples of net.rim.device.api.ui.component.pane.PaneManagerModel

                final Object context) {
            // Check to be sure everything is instantiated
            if (_paneManagerView == null) {
                return;
            }
            final PaneManagerModel model = _paneManagerView.getModel();
            TitleView header = _paneManagerView.getTitle();
            if (header == null || model == null) {
                return;
            }

            PaneManagerController controller = null;

            // Switch the header style based on current style
            if (header instanceof HorizontalScrollableTitleView) {
                header = new HorizontalTabTitleView(Field.FOCUSABLE);
                ((HorizontalTabTitleView) header)
                        .setNumberOfDisplayedTabs(model.numberOfPanes());
                controller = new HorizontalTabController();
            } else if (header instanceof HorizontalTabTitleView) {
                header = new HorizontalScrollableTitleView(Field.FOCUSABLE);
                ((HorizontalScrollableTitleView) header).enableArrows(true);
                controller = new HorizontalScrollableController();

                if (_leftArrow != null) {
                    header.setLeftArrow(_leftArrow);
                }
                if (_rightArrow != null) {
                    header.setRightArrow(_rightArrow);
                }
            }

            // Set up references between objects
            header.setModel(model);
            header.setBorder(BorderFactory.createRoundedBorder(_edgesFour));
            if (controller != null) {
                _paneManagerView.setController(controller);
                model.setController(controller);
                controller.setView(_paneManagerView);
                controller.setModel(model);
            }

            _paneManagerView.setTitle(header);
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.