Usage of vertical field manager with eyelid field

2019-07-31 13:10发布

问题:

I have created 3 tabs in my blackberry application.I now want to add an eyelid field manager that allows for an eye lid component only on the third tab.

With the current code, i am able to create an eyelid but it doesnt show me any of the tabs.

  // setup the tab model with 3 tabs
 final PaneManagerModel model = new PaneManagerModel();
  model.enableLooping( true );

  // setup the first tab
  VerticalFieldManager vfm = new VerticalFieldManager( 
      Field.USE_ALL_HEIGHT | Field.USE_ALL_WIDTH |
      Manager.NO_VERTICAL_SCROLL | Manager.NO_HORIZONTAL_SCROLL );
  LabelField lbl = new LabelField( "Content for tab 1", Field.FOCUSABLE );
  vfm.add( lbl );



  ButtonField _btnGoBack = new ButtonField(" Tab 3 ",ButtonField.FIELD_HCENTER | ButtonField.CONSUME_CLICK);
      _btnGoBack.setChangeListener(new FieldChangeListener() 
      {
            public void fieldChanged(Field field,int context) 
            {

                  System.out.println("Inside button");
                  jumpTo(2,PaneManagerView.DIRECTION_NONE);
            }

       });
  vfm.add(_btnGoBack);



  MyLabelField myLbl = new MyLabelField( "Tab 1" );
  NullField nullFld = new NullField( Field.FOCUSABLE );
  HorizontalFieldManager hfm = new HorizontalFieldManager();
  hfm.add( nullFld );
  hfm.add( myLbl );

  Pane pane = new Pane( hfm, vfm );
  model.addPane( pane );


  // setup the second tab
  vfm = new VerticalFieldManager( 
      Field.USE_ALL_HEIGHT | Field.USE_ALL_WIDTH |
      Manager.NO_VERTICAL_SCROLL | Manager.NO_HORIZONTAL_SCROLL );
  lbl = new LabelField( "Content for tab 2", Field.FOCUSABLE );
  vfm.add( lbl );

  myLbl = new MyLabelField( "Tab 2" );
  nullFld = new NullField( Field.FOCUSABLE );
  hfm = new HorizontalFieldManager();
  hfm.add( nullFld );
  hfm.add( myLbl );

  pane = new Pane( hfm, vfm );
  model.addPane( pane );

  //Setup the third tab
  vfm = new VerticalFieldManager( 
      Field.USE_ALL_HEIGHT | Field.USE_ALL_WIDTH |
      Manager.NO_VERTICAL_SCROLL | Manager.NO_HORIZONTAL_SCROLL );
  lbl = new LabelField( "Content for tab 3", Field.FOCUSABLE );
 vfm.add( lbl );
  myLbl = new MyLabelField( "Tab 3" );
  nullFld = new NullField( Field.FOCUSABLE );
  hfm = new HorizontalFieldManager();
  hfm.add( nullFld );
  hfm.add( myLbl );
  ((LabelField)myLbl).setEnabled(false);
  ((NullField)nullFld).setEnabled(false);

Here i start the implemenatation for eyelid field manager

    _eyelidFieldManager = new EyelidFieldManager();

    // Change the display time from the default 1.2s
    _eyelidFieldManager.setEyelidDisplayTime(2000);

    // Add components to the north eye-lid of the blinker

    _eyelidFieldManager.vfm.addTop(new LabelField(" Do you wish to send report to client?",LabelField.FIELD_HCENTER | LabelField.NON_FOCUSABLE));  
    _eyelidFieldManager.addTop(new LabelField("                                      ",LabelField.FIELD_HCENTER | LabelField.NON_FOCUSABLE));               


  // Add components to the south eye-lid of the blinker
    _eyelidFieldManager.addBottom(new LabelField(" Send Report as: ",LabelField.FIELD_HCENTER | LabelField.NON_FOCUSABLE));
    HorizontalFieldManager buttonPanel = new HorizontalFieldManager(Field.FIELD_HCENTER | Field.USE_ALL_WIDTH);
    buttonPanel.add(new ButtonField("SMS"));
    buttonPanel.add(new ButtonField("Email"));
    _eyelidFieldManager.addBottom(buttonPanel);

    // Add checkbox in non-eyelid region for showing eyelids on user input        
    _showOnInputCheckbox = new CheckboxField("Show eyelids on user input", true, Field.FIELD_HCENTER);
    _showOnInputCheckbox.setChangeListener(this);


    add(_eyelidFieldManager); 

    // Disable virtual keyboard so it doesn't obscure bottom eyelid
    VirtualKeyboard keyboard = getVirtualKeyboard();
    if( keyboard != null )
    {
        keyboard.setVisibility(VirtualKeyboard.IGNORE);
    }

  pane = new Pane( hfm, vfm );
  model.addPane( pane );


  // select the tab to be displayed
  model.setCurrentlySelectedIndex( 0 );    

Now set up the rest of the tab components

  // setup the rest of the components
  HorizontalTabTitleView titleView = new HorizontalTabTitleView( Field.FOCUSABLE );
  titleView.setNumberOfDisplayedTabs( 3 );
  titleView.setModel( model );

  PaneView paneView = new PaneView( Field.FOCUSABLE );
  paneView.setModel( model );

  PaneManagerView view = new PaneManagerView( 
          Field.FOCUSABLE  | Manager.NO_VERTICAL_SCROLL | 
          Manager.NO_HORIZONTAL_SCROLL | Manager.USE_ALL_HEIGHT | 
          Manager.USE_ALL_WIDTH, 
          titleView, paneView );
  view.setModel( model );
  model.setView( view );

  // configure the Controller
  HorizontalTabController controller = new HorizontalTabController();
  controller.setModel( model );
  controller.setView( view );
  model.setController( controller );
  view.setController( controller );

  // add the tab manager to the MainScreen
  this.add( view );
}

Anyone aware on a solution please guide.Thanks