Examples of BScreen


Examples of com.tivo.hme.bananas.BScreen

    setFocusDefault(list);
  }
   
    private BScreen getScreen(Class screenClass) {
        BScreen screen = screenMap.get(screenClass);
        if (screen == null) {
            try {
                Constructor init = screenClass.getConstructor(MovieRentalApplication.class);
                screen = (BScreen)init.newInstance(getBApp());
                screenMap.put(screenClass, screen);
View Full Code Here

Examples of com.tivo.hme.bananas.BScreen

  @Override
  public boolean handleAction(BView view, Object action) {
    if (action.equals("push")) {
      //Go to the screen currently selected in the list.
            Class screenClass = (Class)list.get(list.getFocus());
      BScreen screen = getScreen(screenClass);
      getBApp().push(screen, TRANSITION_LEFT);
      return true;

    } else if (action.equals("pop")) {
      //kill the app
View Full Code Here

Examples of com.tivo.hme.bananas.BScreen

     * If necessary, scrolls the list to show the currently focused row and creates new row views to
     * wrap the elements that are currently visible.
     */
    @SuppressWarnings("unchecked")
    public void refresh() {
        BScreen screen = getScreen();
        Resource anim = animate ? getResource(ANIM) : null;
        animate = false;
        int size = size();

        screen.setPainting(false);
        try {
            //
            // 1. update top so that focused is still visible
            //

            // 0 <= top <= size - nVisibleRows
            top = Math.max(Math.min(top, size - nVisibleRows), 0);

            int max = Math.min(top + nVisibleRows, size) - 1;
            if (focused < top) {
                top = Math.max(0, focused);
            } else if (focused > max) {
                int end = Math.min(focused + 1, size);
                top = Math.max(end - nVisibleRows, 0);
            }

            //
            // 2. determine which rows to update by combining dirty and top.
            //

            // popMin <==> popMax will be populated
            int popMin = Math.max(top - nVisibleRows, 0);
            int popMax = Math.min(top + 2 * nVisibleRows, size());

            // fixMin <==> fixMax will be "fixed" by either being populated
            // or removed

            int fixMin, fixMax;
            if (dirty < top) {
                fixMin = Math.max(dirty - nVisibleRows, 0);
                fixMax = popMax;
            } else {
                fixMin = popMin;
                fixMax = Math.min(dirty + 2 * nVisibleRows, size());
            }
            dirty = top;

            //
            // 3. fix rows
            //

            for (int index = fixMin; index < fixMax; ++index) {
                if (index < popMin || index >= popMax) {
                    BView v = (BView) rows.elementAt(index);
                    if (v != null) {
                        v.remove();
                        rows.setElementAt(null, index);
                    }
                } else {
                    getRow(index);
                }
            }
            getUpDownButton(focused, anim);

            //
            // 4. move to the new top.
            //
            // Note : it is very important to translate the list before updating
            // the highlights, because otherwise the highlights will appear in
            // the wrong location.
            //

            setTranslation(0, -top * rowHeight, anim);

            if (mutable) {
                if (moveMode) {
                    getRowHighlights().setTransparency(TRANSPARENCY, null);
                    getUpDownHighlights().setTransparency(0, null);
                } else {
                    getRowHighlights().setTransparency(0, null);
                    getUpDownHighlights().setTransparency(TRANSPARENCY, null);
                }
            }

            //
            // 5. refresh pageup/pagedown highlights
            //

            BHighlights h = getHighlights();
            BHighlight pageup = h.get(H_PAGEUP);
            BHighlight pagedown = h.get(H_PAGEDOWN);
            if (pageup != null && pagedown != null) {
                pageup.setVisible((top > 0) ? H_VIS_TRUE : H_VIS_FALSE);
                pagedown.setVisible((top + nVisibleRows < rows.size()) ? H_VIS_TRUE : H_VIS_FALSE);
                h.refresh(anim);
            }

            //
            // 6. refresh row highlights if we still have focus
            //

            if (focused != -1) {
                h = getRowHighlights();
                BHighlight up = h.get(H_UP);
                BHighlight down = h.get(H_DOWN);
                if (up != null && down != null) {
                    up.setVisible((focused > 0) ? H_VIS_FOCUS : H_VIS_FALSE);
                    down.setVisible((focused < size - 1) ? H_VIS_FOCUS : H_VIS_FALSE);
                }
                h.refresh(anim);
               
                if (mutable) {
                    h = getUpDownHighlights();
                    up = h.get(H_UP);
                    down = h.get(H_DOWN);
                    if (up != null && down != null) {
                        up.setVisible((focused > 0) ? H_VIS_FOCUS : H_VIS_FALSE);
                        down.setVisible((focused < size - 1) ? H_VIS_FOCUS : H_VIS_FALSE);
                    }
                    h.refresh(anim);
                }
               
            } else if (isAncestorOf(screen.getFocus())) {
                //
                // 7. make sure that focus hasn't been removed
                //

                if (size > 0) {
                    setFocus(0, false);
                } else {
                    screen.setFocus(screen.getFocusDefault());
                }
            }
        } finally {
            screen.setPainting(true);
        }
    }
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.