AF:poll | Throwing IllegalStateException

Hi all

My version of JDev is 11.1.1.7.0.

I am facing problems with af:poll and session invalidation.

< af:panelGroupLayout id = "pollCont" >

< af:image id = "loadingImage.

source="/images/loading.gif".

styleClass = "load-status".

shortDesc = "Please wait while the data is filled...". "/ >

< af:poll id = "pollOrder" interval = "1400".

pollListener="#{backingBeanScope.loadingBean.pollForLoad}"/ >

< / af:panelGroupLayout >

If I click on logout, as this election continues, I'm IllegalStateException, saying that the model bindings.region is null.

Which is logic that the Session is invalidated, but pollListener, being a component client side, trying again to interrogate a disabled listener.

An excerpt from the newspaper.

< UIXRegion > < getRegionModel >

java.lang.IllegalStateException: the expression "#{bindings. . "{loadSectionTF1.regionModel}" (which has been specified for the "value" attribute RegionModel of the component of the region with the id "r1") evaluated to null.

This is usually due to an error in the configuration of the objects referred to by this term.

If it helps, the expression "#{bindings.loadSectionTF1} ' value 'null '.

The same is used in the other boxes present in the same page, but there are no problems with those.

I tried to change the scope, but the result is always the same.

Anyone have an idea about this?

Found the solution.

With immediate disconnection of marking button did the trick.

Ideally he should have been there from the beginning. My bad.

Tags: Java

Similar Questions

  • Addition of locationPicker throws IllegalStateException

    Thread [Ritis_Maps(180)id=253124608] (Suspended (exception IllegalStateException))
        LocationPicker(Screen).setManager(Manager, int) line: 6219
        VerticalFieldManager(Manager).insertInternal(Field, int) line: 2203
        VerticalFieldManager(Manager).add(Field) line: 545
        TitleStatusManager.add(Field) line: 609
        AdvancedIncidentListOptions(Screen).add(Field) line: 288
        AdvancedIncidentListOptions.addComponents() line: 147
        AdvancedIncidentListOptions.() line: 93
    

    I have a screen where I add my LocationPicker. I call add (locationPicker);

    I call this method before, to set up the locationPicker.

    private void readyLocationPicker(){
        Vector locationpick = new Vector();
    
        locationpick.addElement(GPSLocationPicker.getInstance());
    
        Landmark[] landmarks = new Landmark[1];
        landmarks[0] = new Landmark("DC Beltway", "Center of 495 Beltway", new QualifiedCoordinates(LATITUDE_CENTER_OF_DC_BELTWAY, LONGITUDE_CENTER_OF_DC_BELTWAY, Float.NaN, Float.NaN, Float.NaN), null);
        final SuggestedLocationPicker slp = SuggestedLocationPicker.getInstance("Suggested Locations...", landmarks);
        locationpick.addElement(slp);
    
        locationpick.addElement(EnterLocationPicker.getInstance(true));
        locationpick.addElement(MapsLocationPicker.getInstance());
        locationpick.addElement(RecentLocationPicker.getInstance());
        locationpick.addElement(ContactsLocationPicker.getInstance(true));
    
        LocationPicker.Picker[] locationPickersArray = new LocationPicker.Picker[locationpick.size()];
        locationpick.copyInto(locationPickersArray);
    
        locationPicker = LocationPicker.getInstance(locationPickersArray);
        locationPickListener = new LocationPicker.Listener() {
    
            public void locationPicked(Picker picker, Landmark location) {
                if(picker==slp){
                    //TODO: Change radius field to 30 Miles
                    choiceRadius.setSelectedValue(30);
                }
                System.out.println("Landmark: " + location);
            }
        };
        locationPicker.setListener(locationPickListener);
    }
    

    I don't know what is happening and why it will not work.

    Thank you.

    Oh, it extends screen. Ridicule me. Here's how I got to work:

    locationPickerButton = new ButtonField("Location", ButtonField.CONSUME_CLICK | ButtonField.FIELD_RIGHT);
    locationPickerButton.setChangeListener(new FieldChangeListener() {
        public void fieldChanged(Field field, int context) {
    
            locationPicker.show();
            locationPickerButton.setLabel(locationPickerLocation.getName());
    
        }
    });
    
  • Locator.geocode thorws IllegalStateException

    I want to have the latitude and longitude of an address, and I used

    Locator.geocode

    but it throws IllegalStateException, application is made on the event dispatch thread

    How can I solve this?

    is possible to use Locator.geocode in my application, because if I use Locator.geocode anywhere in the source it throws an exception,

    Since the javadocs:

    An application must ask geocode information outside the event sending thread.

    Start a worker thread, and make the call to the thread.

  • IllegalStateException then add the previously deleted field

    Code snippet that fails:

    /** * Depending on the value of homeScreen.mNumberEditField, the * mHomeScreen.myTextField is removed or re-added after being * removed.  Does not work, when re-added an IllegalStateException * is thrown. */class MyEditFieldChangeListener implements FieldChangeListener {
    
        HomeScreen mHomeScreen;
    
     // the default state, where the mytextfield is showing    int STATE_DEFAULT = 1;
    
      // we've removed the mytextfield  int STATE_MY_TEXTFIELD_REMOVED = STATE_DEFAULT + 1;
    
     // current state  int curState = STATE_DEFAULT;
    
     public NumberEditFieldChangeListener(HomeScreen homeScreen)   {     super();      mHomeScreen = homeScreen; }
    
       public void fieldChanged(Field field, int context)    {     if (context == PROGRAMMATIC)      {         // ignore "programmatic changes", whatever that means.            return;       }
    
           if (field == homeScreen.mNumberEditField) {
    
             int len = homeScreen.mNumberEditField.getTextLength();            switch (len)          {         case 0:
    
                 if (curState == STATE_MY_TEXTFIELD_REMOVED)               {                 // throws IllegalStateException.                  mHomeScreen.add(mHomeScreen.myTextField);                 curState = STATE_DEFAULT;             }
    
                   break;            default:              // is it numeric?             if (isNumeric() == false)             {
    
                       // remove call log fields                 if (curState == STATE_DEFAULT)                    {                     mHomeScreen.delete(mHomeScreen.myTextField);
    
                            curState = STATE_MY_TEXTFIELD_REMOVED;                    }
    
                   }             break;            }     }
    
       }
    
    }
    

    I found a solution that seems to work:

    Instead of the call

    mHomeScreen.add(mHomeScreen.myTextField);
    ...
    mHomeScreen.delete(mHomeScreen.myTextField);
    

    I tried to use

    mHomeScreen.getMainManager().add(mHomeScreen.myTextField);
    ..
    mHomeScreen.getMainManager().delete(mHomeScreen.myTextField);
    

    and the error disappeared.

  • IllegalStateException when closing a screen in its constructor (single-threaded application)

    I use a screen that displays a list of items. The builder checks if there is nothing to display and if not, displays a dialog box with a message and call close(). The close() call produces IllegalStateException (on 5 BB). Why and how can I close or the screen?

    BTW, I read on do not call close() in a different thread, but in this case, I do not (at least in my code) any extra thread.

    public class MyScreen extends MainScreen implements ListFieldCallback
    {
      MyScreen()
      {
        super(Manager.NO_VERTICAL_SCROLL);
    
        int count = getItemsCount(); // A method that returns the number of items to display
    
        if (count == 0)
        {
          Dialog.inform("No item");
          close(); // throws IllegalStateException
          return;
        }
    
        // More irrelevant stuff here
    
      }
    }
    

    Thank you!

    My point was the call to close as the manufacturer, there is no possible way that the screen can be on the displaystack at the time wherever you call close...

    in another part of your code, you probably:

    uiApplication.pushScreen (new MyScreen());

    Push code will not happen before the end...

  • Error of IllegalStateException BlackBerry using TimerTask

    Hello

    I have a splash screen that implements form, and I'm trying to use the timer to wait 3 seconds to press a new screen.

    TimerTask splashTask = new TimerTask() {
            public void run() {
                UiApplication.getUiApplication().pushScreen(new HomeNavigationScreen());
            }
        };
    
        timer.schedule(splashTask, 3000);
    

    However, it throws IllegalStateException error, I'm not sure what I am doing wrong?

    Check This...

    http://supportforums.BlackBerry.com/T5/Java-development/loading-screen/TD-p/556826

    Its the same problem, I guess that

  • Push and Midlets

    I am trying to add push, via the Service of Blackberry Push notifications to my application already developed and productive with the midlets. As I can not instantiate a UIApplication on a moped, I thought to leave my "wake app" app on every push, using PushRegistry AMS software.

    Its posible to register to use the Blackberry Push Notification Service, at a very low level, using PushRegistry on a MIDlet application?

    Thank you

    Nico.

    Solved by some here at work, by adding this code. Post here if anyone can help.

    package test.javax.microedition.midlet;

    Javax.microedition.lcdui import. *;
    Javax.microedition.io import. *;
    Javax.microedition.midlet import. *;
    Import Java.util;
    import java. IO;
    Import net.rim.device.api.applicationcontrol.ApplicationPermissions;
    Import net.rim.device.api.applicationcontrol.ApplicationPermissionsManager;

    / public final class DynamicPushRegistry extends MIDlet
    {
    Data, we expect to receive.
    private static final String TEST_DATA = "this is just a test."
    private final static ApplicationPermissionsManager apm is ApplicationPermissionsManager.getInstance ();.

    public DynamicPushRegistry()
    {
    setPermission (ApplicationPermissions.PERMISSION_CROSS_APPLICATION_COMMUNICATION);
    setPermission (ApplicationPermissions.PERMISSION_BROWSER_FILTER);
    setPermission (ApplicationPermissions.PERMISSION_INTERNET);
    setPermission (ApplicationPermissions.PERMISSION_SERVER_NETWORK);
    setPermission (ApplicationPermissions.PERMISSION_APPLICATION_MANAGEMENT);
    }

    Signals of the MIDlet that he is entered in the active state.
    public void startApp()
    {
    Get the display for this MIDlet object.
    Display d = Display.getDisplay (this);

    Create and start a new WorkerThread.
    Thread t = new WorkerThread();
    t.Start ();

    Create a new alert.
    Alert alert = new alert ("start DynamicPushRegisry");

    Display the alert for 2 seconds.
    alert.setTimeout (2000);

    d.setCurrent (alert);
    }

    private class WorkerThread extends thread
    {
    public void run()
    {

    Get all the connections that have been registered with the PushRegistry
    for the current MIDlet suite.
    String [] connections = PushRegistry.listConnections (true);

    If (connections.length == 0)
    {
    Nothing is recorded, sign up for a connection.
    Try
    {
    Dynamically register a socket connection
    on port 50000.
    PushRegistry.registerConnection ("' socket: / /: 50000", ")
    "test.javax.microedition.midlet.DynamicPushRegistry,"
    "*");
    } catch (ConnectionNotFoundException e)
    {
    message (try ());
    } catch (ClassNotFoundException e)
    {
    message (try ());
    } catch (IOException e)
    {
    message (try ());
    }
    }
    on the other
    {
    A connection is already registered and data arrives.
    Extract the incoming data.
    fetchData (connections [0]);

    Stop to wait for data.
    message ("Done");
    }
    notifyDestroyed();
    }
    }

    Retrieves incoming data.
    Private Sub fetchData (connection String)
    {
    Try
    {
    Open the connection.
    Connection c = Connector.open (connection);

    If (ch. instanceof StreamConnectionNotifier)
    {
    Open an InputStream.
    StreamConnectionNotifier (StreamConnectionNotifier) SNA = c;
    StreamConnection sc = scn.acceptAndOpen ();
    InputStream input = sc.openInputStream ();

    Extract the data from the InputStream.
    StringBuffer sb = new StringBuffer();
    data from Byte [] = new ubyte [256];
    piece of int = 0;
    While (-1! = (chunk = input.read (data)))
    {
    SB. Append (new String (data, 0, chunk));
    }

    Close the InputStream and StreamConnection.
    Input.Close ();
    TCI Close();

    String s = sb.toString ();

    Test the data for validity.
    If not valid, an exception is thrown.
    Assert.assertTrue (TEST_DATA.equals (s),
    "Do not have an appropriate string:"+ s); ".

    Display the received data.
    message ("Received:" + sb.toString ());
    }
    } catch (IOException e)
    {
    message (try ());
    }

    }

    Display a message string to the user.
    Private Sub message (String msg)
    {
    Create a new alert with the message.
    Alert alert = new Alert (msg);

    Display the alert for 5 seconds.
    alert.setTimeout (5000);

    Display.getDisplay (this) .setCurrent (alert);
    }

    Reports the MIDlet to stop and go to the Pause State.
    public void pauseApp()
    {
    }

    Reports the MIDlet to terminate and move to the State of destruction.
    Unconditional, when set to true. The MIDlet must cleaning and release
    all of the resources. Otherwise, the MIDlet can raise a
    MIDletStateChangeException to indicate that he does not want to be
    destroyed at this time.
    public void destroyApp (boolean unconditional)
    {
    }

    private Boolean setPermission (int permission) {}

    Boolean updatedPermissions = false;
    ApplicationPermissions ap = apm.getApplicationPermissions ();
    If (ap.containsPermissionKey (permission)) {}
    int eventInjectorPermission = ap.getPermission (permission);

    If (eventInjectorPermission! = ApplicationPermissions.VALUE_ALLOW) {}

    ap.addPermission (permission);
    updatedPermissions = apm.invokePermissionsRequest (ap);
    }
    } else {}
    ap.addPermission (permission);
    updatedPermissions = apm.invokePermissionsRequest (ap);
    }

    Return updatedPermissions;
    }
    }

    Throws IllegalStateException with the provided error message.
    last class Assert
    {
    Assert() private
    {
    }

    public static public Sub assertTrue (Boolean exp, String failmsg)
    {
    If (! exp)
    throw new IllegalStateException (failmsg);
    }
    }

  • confusion in the background process and Globaleventlistener

    Hello

    too confused in Backendprocess.

    Please check my code and then tell me how I can do this.

    I want to add bluetooth address in my tree UIApp MyScreen articles and I bluetooth address storage file and record store.

    but confuesd how do I call the showAdress() method after complition of search BlueTooth.

    public class MyUIApp  extends UiApplication{
    
        public static void main(String[] args) {
            if (args != null && args.length > 0 && args[0].equals("gui"))
            {
                AppBackend appb = new AppBackend();
                appb.enterEventDispatcher();
    
            }
            else
            {
                ApplicationManager appMang = ApplicationManager.getApplicationManager();
                if(appMang.inStartup())
                    return;
                MyUIApp app = new MyUIApp();
                UiApplication.getUiApplication().invokeLater(new Runnable() {
    
                    public void run() {
    
                        ApplicationManager.getApplicationManager().postGlobalEvent(AppConstants.DATA_CHANGED);
                    }
                });
    
                app.enterEventDispatcher();
            }
        }
    
        public void showAdress()
        {
            getting data from record store adding Tree which si on Main Screen.
        }
    }
    
    public class AppBackend extends Application implements GlobalEventListener {
    
        public Timer timer;
        public Vector remote_device;
        public Vector device_found;
    
        BTSearch btSearch;
    
        public AppBackend() {
    
            addGlobalEventListener(this);
            timer = null;
    
        }
    
        public void firststart() {
            btSearch = new BTSearch();
            btSearch.start();
        }
    
        class BTSearch extends Thread implementsDiscoveryListener
        {
    
            boolean stopThread = false;
    
            public void run() {
                startThread();
    
            }
    
            public void startThread() {
    
                timer = new Timer();
    
                timer.schedule(new TimerTask() {
    
                    public void run() {
    
                        startScanBluetoothDevices();
    
                }, 30000, 30000);
    
            }
    
            public void startScanBluetoothDevices() {
                try {
    
                    remote_device = new Vector();
                    device_found = new Vector();
    
                    discovery_agent = LocalDevice.getLocalDevice().getDiscoveryAgent();
                    discovery_agent.startInquiry(DiscoveryAgent.GIAC, this);
    
                } catch (Exception error) {
                    Dialog.alert(error.getMessage());
                }
            }
    
            public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod)
            {
                //
            }
    
            public void inquiryCompleted(int discType)
            {
                //
            }
    
        }
    
        public void eventOccurred(long arg0, int arg1, int arg2, Object arg3,
                Object arg4) {
    
            if (arg0 == AppConstants.DATA_CHANGED) {
    
                firststart();
    
            }
    
        }
    
    }
    

    I'm confuesd how do I call the method showAdrees() If you desire to process bluetooth backend made.

    Now I'm for names of Bluetooth and the storage in the RecordStore. but now the problem is how can I display on my main screen located in UIApplication.

    I am struggling to read this code, it seems not to be complete.

    Sorry, beginning with the obvious things, I assume you have another entry.  Usually one who has the 'gui' param starts the user interface, so I guess that BlueFreeBackround is the treatment of the user interface.  Seems a strange name?  But any.  We do not have this code, so can't review it.

    The other entrance is the one who starts the initial treatment.  In case you're MyUIApp.  But you have this:

    If (appMang.inStartup ())
    return;
    Also if this is executed at boot time, the treatment does nothing.  And you start an application that seems to be the associated user interface.  I'm confused.  And we have no code to the constructor for this class, so we can not comment on that either.  All we know is that this class sends a global event.  Now, if I'm wrong, I don't think you need to start an Application to send a global event.  It is enough to have one to receive a.

    And you have given us another class, but there is no indication how it is started.  Assuming that it is started, it will receive the global event and execute the firststart() method.  Confusingly, this method will start a Thread that starts a timer.  Why can't firststart() him and save a Thread and some confusion?

    OK, now we come to the TimerTask, which is launched every 30 seconds (seems too often to me, but maybe not).  This process begins the investigation.  And we arrive at the point of this thread.  InquiryCompleted, I think you want to call showAddress().

    It's actually easy, although I really don't like this approach:

    Instead of using

    postGlobalEvent (long guid);

    use

    postGlobalEvent (long guid, int data0, data1, object0 object, Object1 int);

    and pass the MyUIApp object as a parameter object0.  Then, you can call

    . showAddress();

    I suspect that this will throw IllegalStateException, so you'll need to hire a

    this.invokeLater (...)

    to ensure that you have the thread of events when refreshing.

    But if I were you, I would consider this approach.  It seems some unnecessary steps.  For example, why doesn't MyUiApp start the discovery itself, what s at the point of the AppBackend?  A; Otherwise, you use a global event to initiate treatment, you could send the data in another GlobalEvent.

  • BlackBerry JRE 5.0.0 BrowserField has no ScriptEngine

    Hello

    Ive got a BrowserField:

    BrowserFieldConfig config = new BrowserFieldConfig();
    config.setProperty (BrowserFieldConfig.JAVASCRIPT_ENABLED, Boolean.TRUE);
    This.Browser = new BrowserField (config);

    which returns the null value on:

    this.browser.getScriptEngine ();

    Prevents me to run scripts from the code Java, because browser.executeScript ("somejavascript"); throws IllegalStateException which States that there is no such thing as the ScriptEngine. Which is kinda funny, because when I load JQuery its able to compile the script and the BrowserFieldDebugger tell me, that JSON is not defined. Which is exactly why I want to run a script inside the Java code from in the first place. Well, I need to call javascript functions later as well so I would have needed this feature in one way or another. BTW. : browser.displayContent (' javascript : somejavascript ", someurl" ") seems to generate a kind of error page.

    Test on a 9700, build against BlackBerry JRE 5.0.0

    ID like to have this app running next Thursday, a quick (and useful) answer would be appreciated (if you need more information, ask away).

    Thanks in advance.

    Sorry not an area of expertise, but I have some thoughts.

    Copy the following code

    invokeLater (new Runnable() {public void run() {}

    thing to run

    (}, 500, flag);

    you continue to repeat if the flag is true initially (it is not re-evaluated).  So I think you really want to code something like:

    Runnable testScriptEngine = new Runnable() {}

    public void run() {}

    ScriptEngine scriptEngine = mdBrowserField.getScriptEngine ();

    If (scriptEngine == null) {}

    invokeLater (this, 500, false);

    } else {}

    Dialog.Alert ("found Script engine");

    }

    };

    invokeLater (testScriptEngine, 500, false);

    If I was looking for something that could be triggered when the browserField 'worked', I would look at the method documentLoaded() of the BrowserField listener:

    http://supportforums.BlackBerry.com/T5/Java-development/BrowserField-sample-code-using-the-BrowserFi...

    I'm guessing it is significant above using a Script engine, so I can see a reason to not create a Script engine up until you need it - so it does not surprise me that one is not created in BrowserField instantiation.

  • browserField.executeScript

    Hello

    I'm stuck with a question on the addition of a browserFieldListener. I have a native application BlackBerry accessing a web application using the browser. I have a JavaScript block in a specific page. I want to use browserField.executeScript ("my javascript in a JSP page") and check the returned Boolean value when I ask for each page. So I replace the documentLoaded method and add the inside executeScript method. However, she always throws IllegalStateException when browserField.executeScript. After I go through the RIM API, I found it refers to the exception as " IllegalStateException -this exception is thrown if this method invoked before this BrowserField document has been created." This event is communicated via the BrowserFieldListener.documentCreated () method. "Someone has suggestions or comments here, please? Thank you very much.

    I finally understand this problem. He won't do the method of excuteScript in documentLoaded() of BrowserFieldListener since the scripts contained in the document cannot be invoked until the document is loaded. I think it makes sense. So if you want to do stuff like read the DOM to call javascript from your document, make sure that the action happens after all the document is loaded. The original intent of my code is kind of like: use the browser to open a web page, check some flag from this page, generate a menu browser dynamically customized for this indicator. So now, I put all this reading document action in makeMenu and this method would make sure all the action happening after the page loads.

  • Scrolling ListField

    I read many more posts scrolling ListField and they helped me to get that much, but now I'm stuck.  I have my list field in a VerticalManager with scroll work.  I set it up so that there are 5 visible rows in the ListField.  However, when I scroll down past the last visible line (there is currently a total of 9 lines of the list), paint lines is no longer the text of the line.  I developed a custom implementation ListField, who has a foreground and background color.  The idea is that each line is focused, switch foreground and background of color - the selected line a deep Navy with white text and unselected lines have a white background with marine text.  Works very well for the visible rows, but when I scroll beyond rank 5 to reveal the invisible lines, they just paint with the Navy background and white text.  Here's my class of custom list field (which was based on something that I found on a forum or in the knowledge base):

    Import net.rim.device.api.ui.Graphics;
    Import net.rim.device.api.ui.XYRect;
    Import net.rim.device.api.ui.component.ListField;

    SerializableAttribute public class ColoredListField extends ListField
    {
    Private boolean hasFocus = false;
    Private final int fixedWidth;
    private int fgcolor;
    private int bgcolor;
    Private final int fixedHeight;

    public ColoredListField (int width, int height, int fgcolor, bgcolor int)
    {
    this.fixedWidth = width;
    this.fixedHeight = height;
    This.fgColor = fgcolor;
    This.BgColor = bgcolor;
    }

    public int getPreferredWidth()
    {
    return fixedWidth;
    }

    public void layout (int width, int height)
    {
    setExtent (fixedWidth, fixedHeight);
    }

    public int moveFocus (amount int, int status, int time)
    {
    Invalidate (getSelectedIndex ());
    Return super.moveFocus (amount, status, time);
    }

    public void onFocus (int direction)
    {
    hasFocus = true;
    super.onFocus (branch);
    Invalidate();
    }

    Public Sub onUnfocus()
    {
    hasFocus = false;
    super.onUnfocus ();
    Invalidate();
    }

    public void paint (Graphics graphics)
    {
    Get current cutting zone because it will be the only party which
    need to repaint
    XYRect redrawRect = graphics.getClippingRect ();
    If (redrawRect.y<>
    throw IllegalStateException (new)
    ' The variable 'y' clipping ' +.
    "rectangle is.< 0:="" "="" +="">

    If the ListField has focus determine the selected line.
    rowHeight = getRowHeight() int;
    int currEntry = redrawRect.y / rowHeight.
    int lastVisibleEntry = (redrawRect.y + redrawRect.height - 1) / rowHeight.
    lastVisibleEntry = Math.min (lastVisibleEntry, getSize() - 1);
    int y = currEntry * rowHeight.

    int curSelected = hasFocus? getSelectedIndex():-1;
    Draw each line
    for (; currEntry<= lastvisibleentry;="">
    {
    graphics.setColor (currEntry == curSelected? bgcolor: fgcolor);
    graphics.fillRect (0, y, redrawRect.width, rowHeight);
    graphics.setColor (currEntry == curSelected? fgcolor: bgcolor);
    graphics.drawText (getCallback () .get (this, currEntry) m:System.NET.SocketAddress.ToString (), 0,)
    y);
    Assign new values for the y-axis move a row downwards.
    y += rowHeight.
    }
    }
    }

    Here's how I instantiated class:

    private int screenW = Graphics.getScreenWidth ();
    private int screenH = Graphics.getScreenHeight ();
    private int listWidth = (int) (screenW * 0.95);
    private int listHeight = (int) (screenH * 0.4).
    private ColoredListField myListField = new ColoredListField)
    listWidth, listHeight, selectedFGColor, selectedBGColor);

    Also, here is my point:

    private static class DiaryEntryListCallback implements ListFieldCallback
    {
    private DiaryEntry [diaryEntryList];

    public DiaryEntryListCallback() throws Exception
    {
    diaryEntryList new = DiaryEntry [0];
    init();
    }

    public void init() bird Exception
    {
    DiaryEntry [] tmpDiaryEntryList =
    DiaryDAO.instance () .getDiaryEntriesAsArray (true);
    If (tmpDiaryEntryList! = null & tmpDiaryEntryList.length > 0)
    diaryEntryList = tmpDiaryEntryList;
    on the other
    {
    diaryEntryList = new DiaryEntry [1];
    diaryEntryList [0] = new DiaryEntry ("No data",
    Calendar.getInstance ());
    }
    }

    public void init (DiaryEntry [diaryEntries]) throws exceptions
    {
    diaryEntryList = diaryEntries;
    }

    public int getNumberOfRows()
    {
    Return diaryEntryList.length;
    }

    ' Public Sub drawListRow (ListField l, Graphics g, int index, int y, int w)
    {
    draw text is managed by the implementation of the custom list field
    }

    public {get {Object (ListField listField, int index)
    {
    return diaryEntryList [index];
    }

    public int getPreferredWidth (ListField listField)
    {
    Return listField.getPreferredWidth ();
    }

    public int indexOfList (String prefix, ListField listField, int start)
    {
    int size = diaryEntryList.length;
    for (int i = 0; i)< size;="">
    {
    DiaryEntry currEntry = diaryEntryList (DiaryEntry) [i];
    If (currEntry.getEntryText () .toLowerCase () .startsWith)
    (prefix.toLowerCase ()))
    Return i;
    }
    Return listField.getSelectedIndex ();
    }
    }

    And here's where I build the main screen, adding the list field and other areas:

    Private Sub createMainScreen()
    {
    mainMgr = new ColoredVerticalManager (selectedBGColor,
    Manager.USE_ALL_HEIGHT);
    listMgr = new ColoredVerticalManager)
    selectedBGColor,
    Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR);
    mainMgr.add (diaryEntriesLabel = new FixedWidthLabelField)
    "' Diary entries:»(, listWidth,-1, selectedFGColor, selectedBGColor));"
    Try
    {
    listCallback = new DiaryEntryListCallback();
    diaryEntriesListField.setSize (listCallback.getNumberOfRows ());
    diaryEntriesListField.setCallback (listCallback);
    diaryEntriesListField.setFocusListener (new DiaryFocusListener());
    listMgr.add (diaryEntriesListField);
    mainMgr.add (listMgr);
    }
    catch (System.Exception e)
    {
    Dialog.Alert ("error when loading of list one diary entry:" + e.getMessage ());
    }
    mainMgr.add (selectedEntryLabel = new FixedWidthLabelField)
    ((' Selected: input: ",-1, -1, selectedFGColor, selectedBGColor));
    mainMgr.add (diaryEntry);
    Add (mainMgr);
    }

    Clues as to why when scrolling past the visible lines, he stops painting?

    Thank you

    Steve

    Hello

    You want listfield fixed size with active scroll.

    Please try the following solution:

    Removed listfield class the following function:

    public void layout (int width, int height)
    {
    setExtent (fixedWidth, fixedHeight);
    }

    That you override the trace of the listfield, the measure will be defined as a fixed height. Therefore, you have noticed that Manager of vertical field scrolls but listfield not scroll.

    Please override method 'sublayout' of vertical field Manager "listmgr":
    VerticalFieldManager oVerticalFieldManager = new VerticalFieldManager (MainScreen.VERTICAL_SCROLL |) MainScreen.VERTICAL_SCROLLBAR)
    {
    public int getPreferredHeight()
    {
    Return nFixedHeight;
    }
               
    Rewritten to define the visible height for the vertical field Manager.
    protected void sublayout (int width, int height)
    {
    height = nFixedHeight;
    Super.sublayout (width, height);
    setExtent (width, height);
    }
    };

    This code works for me fine.

    Kind regards
    Shubhangi

  • is authorized to build the screen over the events, but push over the event

    Hi all, I know it's a lame question, but I get an error message and now then guess myself

    the way I coded this app. I usually build screens in a non event, calling thread

    Add when adding fields and all the UI stuff, but once it is done, then I put the pushScreen

    in the case of threading

    is it ok?

    Well, it is certainly not a "lame".  I guess you can add fields to a form on a thread of non-event so the screen is not "displayed" (do not push in the battery of the screen still), otherwise, you will need to run that add inside invokeLater or while now the lock of the event.

    Say, if you pushScreen (MyCustomBackgroundCreatedScreen()) new, some of the screen building code can be executed before the screen is actually pushed and the rest will be executed after that.  The "suite" party (whose actual start is quite random) will throw IllegalStateException unless you put your add code (...) within invokeLater or synchronize the lock of the event.

    I did it myself - parses an XML file in a separate Thread and by creating and adding fields one by one to a display manager - and I distinctly remember having to do it the way I described.

    If it's OK or not depends on your design.  If you have only a few fields to add, that's fine, I guess.  Each addition will cause the entire screen to rearrange, which is a small performance decrease. However, unless you have a few fields of thousands (I remember this post here in the forum), you should not notice a significant slowdown.

  • MP3 not "playing on Simulator for storm 4.7. *

    Hello

    I have a problem where I like to read mp3 in the file system on Simulator.  I have traced the SD card in my pc file system. The code works for all simulators I've tested except models storm running 4.7. *.

    The SIM for 9500 5.0 running works well.  The code has also only a problem for all the ringtones I got from Crackberry ringtones, but it works on my own mp3s.

    I've narrowed the problem to player.start that throws IllegalStateException.  I checked my permissions are ok - IE.  the application has permissions to media.  I checked the files played on the BB Media Player.  the code is pretty generic - get the file connector, open the input stream and start the player.

    Someone sees this sort of thing on storm 4.7* simulators?

    More strange findings (error checking and various removed).  For specific MP3, on the storm 4.7. * simulators

    It works:

    Reader = javax.microedition.media.Manager.createPlayer (pathToFile);

    This is not:

    fconn = (FileConnection) Connector.open (pathToFile);

    ringToneInputStream = fconn.openInputStream ();

    Reader = javax.microedition.media.Manager.createPlayer (ringToneInputStream, "audio/mpeg" "");

  • Problem at the opening of the start screen

    Hello

    In my BB app, I want first of all to display a splash screen and then go to the normal screen. To do this in my main Uiapplication, I call you:

    SerializableAttribute public class MyAppStarts extends UiApplication {}

    public MyAppStarts() {}
    pushScreen (new SpalshScreen());
    }
    Public Shared Sub main (String [] args) {}
    MyAppStartsapp = new MyAppStarts();
    app.enterEventDispatcher ();
    }

    }

    It's my inspired SplashScreen (excerpt) of http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800256/...

    version 4.2 or later

    public class SplashScreen extends full screen {}
    private Minu = new Timer();
    private bitmap Bitmap;
    private UiApplication app;
           
    public SplashScreen() {}
    Super(Field.USE_ALL_HEIGHT |) Field.FIELD_HCENTER);
    System.out.println ("* in SplashScreen");
    try {}
    bitmap image = Bitmap.getBitmapResource ("flash.png");
    } catch (Exception e) {}
    System.out.println ("* Exception:" + e.getMessage ());
    e.printStackTrace ();
    }
    This.App = ui;
    This.Add (new BitmapField (bitmap));
    SplashScreenListener listener = new SplashScreenListener (this);
    this.addKeyListener (listener);
    Timer.Schedule (new CountDown(), 5000);
    System.out.println ("display of splash...");
    UiApplication.getUiApplication () .pushScreen (this);
    }
           
    public void dismiss() {}
    Timer.Cancel ();
    UiApplication.getUiApplication () .popScreen (this);
    UiApplication.getUiApplication () .pushScreen (new LoginScreen());
    }
           
    the class Countdown
    private class timer extends TimerTask {}
    public void run() {}
    Thread DismissThread = new DismissThread();
    UiApplication.getUiApplication () .invokeLater (thread);
    }
    }
           
    class DismissThread
    private class DismissThread implements Runnable {}
    public void run() {}
    dismiss();
    }
    }

    class SplashScreenListener
    NotInheritable public class SplashScreenListener implements KeyListener {
    SplashScreen screen private;
    {} public boolean keyChar (key char, int status, int time)
    intercept the key ESC and MENU - exit the splash screen
    Boolean retval = false;
    switch (key) {}
    case Characters.CONTROL_MENU:
    case Characters.ESCAPE:
    Screen.dismiss ();
    retval = true;
    break;
    }
    Return retval;
    }
    {} public boolean keyDown (keycode, int, int times)
    Returns false;
    }
    {public boolean keyRepeat (keycode int, int times)
    Returns false;
    }
    {public boolean keyStatus (keycode int, int times)
    Returns false;
    }
    {} public boolean keyUp (keycode int, int times)
    Returns false;
    }
    public SplashScreenListener (SplashScreen splash) {}
    screen = splash;
    }
    }

    protected boolean navigationClick (int status, int time) {}
    dismiss();
    Returns true;
    }
       
    protected boolean navigationUnclick (int status, int time) {}
    Returns false;
    }
       
    protected boolean navigationMovement (int dx, int dy, int, int time status) {}
    Returns false;
    }
          
    }

    She throws IllegalStateException - does not know where. I tried to add the breakpoint at the pushScreen of the main class (new SplashScreen()); but it throws the exception and could not know where the exception. If I replace the SplashScreen with LoginScreen, it works perfectly. There is something wrong with the SplashScreen.

    Can anyone help mw know where I'm going wrong or what more to do!

    Any help is very appreciated.

    Thank you

    Oh thanks for pointing this error.

    After correcting this error also, it did not work at all. Finally I erased applications for download folder (could also just delete my those cirrent requests) and tried again and it worked perfectly.

    I guess the main problem is also the same application was already in the download folder was running even JDE and proper application in the cache to perform instead of newly added or updated to date.

    Just to see the results with invoking pushScreen again n SpashScreen Builder - resutls were still only works correctly. Not a Sunrise errors/exceptions or screen showed two times or more - everything worked as expected. Hmm strange.

    Any ways thanks.

  • How to avoid the blue color of a LabelField default selection?

    Hello

    Below, I have given my code please review and let me know where I did wrong. because my requirment must show the labelfield with a specific color. not work but useless default blue color is coming with the text. I want to avoid that the color blue.

    final String dimensionally = 'Test ';
    LabelField lbl = new LabelField (slable, 0, slable.length (), LabelField.FOCUSABLE |) LabelField.HIGHLIGHT_FOCUS) {}
                            
    Do police = Font.getDefault (.derive(Font.UNDERLINED |)) Font.PLAIN, 12);
    int x = font.getAdvance (slable);
    int y = font.getHeight ();
    Boolean hasFocus;
    protected void paint (Graphics g) {}
    g.setColor (Color.BLUE);
    g.setFont (do);
    {if (HasFocus)}
    g.setColor (Utility.ACTIS_MAAROON_COLOR);
    g.fillRoundRect (0, 0, x, y, 10, 10);
    g.setColor (Color.WHITE);
    g.drawText (dimensionally, 0, 0);
    } else {}
    g.setColor (Color.BLUE);
    g.drawText (dimensionally, 0, 0);
    }
    Invalidate();
    Super.Paint (g);
    }
                           
    protected boolean trackwheelClick (int arg0, int arg1) {}
    //

    }

    protected void onFocus (int arg0) {}
    hasFocus = true;
    super.onFocus (arg0);
    }

    protected void onUnfocus() {}
    hasFocus = false;
    super.onUnfocus ();
    }

    public void select (boolean arg0) throws IllegalStateException {}
    Super.Select (false);
    }
    /*
    Protected Sub layout (int width, int height) {}
    width = x;
    height = y;
    Super.Layout (width, height);
    super.setExtent (width, height);
    }
    */
                           
    };

    and one last thing is that when I method of positioning cover font size is bigger.

    Please answer...

    drawHighlightRegion is used to paint the selection, see also drawFocus.

Maybe you are looking for

  • Can not find the driver for Qosmio F10-101 TV tuner

    Hello everyone, I bought a new Qosmio F10-101... since he has previously installed Win XP Home, I reinstalled the operating system XP Professional... this time the Device Manager is to give a warning to a PCI device that is supposed to be the TV tune

  • I like to put the pagina front in Italian

    When active the I like the lingua italiana, come posso fare scansione? provando usually col looping destro del mause succede nulla, grazie a tutti

  • My 2nd monitor does not

    My 2nd monitor is completely black except for a travel box with "not optimum Mode, recommended Mode 1280 X 1024 with a?," I restarted my computer and checked the connection without change, can anyone help please?  It was working fine until I unplugge

  • G6-2052er - SSD

    Hello I have a g6-2052er Pavilion and I thought to replace my HARD drive with an SSD, but could not know if it accepts the. Some of the discussions here say that people facing problems after buying a DDI and it turned out to not be supported by the l

  • client VPN works do not via 3G

    Hello We have a vpn client that works more than wired internet connection, but it does not work via a 3G mobile connection. Please see the enclosed routing table. Client: 10.129.42.2/24 Address public 3G: 10.138.28.162 Thanks in advance Kind regards