simultaneity and javafx.beans.property

I am building a MVC architecture and I would like to model runs independently of the view/controller, for the model works with the controller/view.

the following example is a very simplified version on how I got it:

controller:
public class controller extends AnchorPane implements Initializable{
     private ObjectProperty<Model> m;
     @FXML Label aLabel;
     
     public controller() throws Exception{
          this.m = new SimpleObjectProperty<Model>(this, "Model", null);
          FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("../view/View.fxml"));
          fxmlLoader.setController(this);
          fxmlLoader.setRoot(this);
          fxmlLoader.load();
     }
     @Override public void initialize(URL arg0, ResourceBundle arg1){}
     public void setGame(Model m) throws Exception{
          this.m.set(m);
          aLabel.textProperty().bind(this.m.get().getIntProperty().asString());
     }
     public void start(){
          //Method1:
          m.get().start();
          //Method2:
          Task<Void> task = new Task<Void>() {
               @Override public Void call() {
                    m.get().start();
                    return null;
               }
          };
          new Thread(task).start();
          //Method3:
          m.get().start();     //Model extends Thread and public void start() to protected void run()
          //Method4:
          m.get().start();     //Model extends Task<Void> and
                         //public void start() to protected Void call() throws Exception
          //Method5:          //calling any of the before ones on the controller that calls this one
     }
}
model:
public class Model extends Thread{
     IntegerProperty intProperty;
     
     public Model(){
          this.intProperty = new SimpleIntegerProperty(0);
     }
     public IntegerProperty getIntProperty(){
          return intProperty;
     }
     public void start(){
          while (true){
               this.intProperty.set(this.intProperty.get()+1);
          }
     }
}
I tried one of those and the results are:
-Method1: the display is blocked and cannot be seen anything (model seems to work since ongoing in the loop)
-Method2: when arrives the first this.intProperty.set (this.intProperty.get () + 1); the task is frozen and stops
-Method3: error running on this.intProperty.set (this.intProperty.get () + 1);
-Remplacement4: same as Method3
-Method5: as before those

How can I make the computer works?

There are a few things wrong here.

First of all, if you want the model to use a wire, make sure that you know how to use the Thread class. There is a decent section on concurrency in the Java tutorial [url http://docs.oracle.com/javase/tutorial/essential/concurrency/index.html]. What you need here, it's that your model class to override the run(), not the start() method method. Call then the start() method, which will cause the run() method run on a separate execution thread. (You can do this in method 3, I didn't understand your comment)

It's probably just an artifact of your simplified version, but your run() method should block at some point. Multiple threads can be run on the same processor, if your current implementation can hog this CPU, it is impossible for the FX Application thread to do its stuff. For the test, throw in a call to Thread.sleep (...), wrapped in a try/catch block for the InterruptedException. I guess the real application expects something from the server, so there would be some "natural" the thread to block in this case.

Important rule for the user interface is that changes made to the interface should be made only on the FX Application thread. Assuming you have the implementation of your model correctly running on a background thread, you violate it with your binding. (The model defines its intProperty on the background thread, the link causes the text of the label to change on the same thread). So to solve this problem your controller should listen to property int of the model changes and schedule a call to aLabel.setText (...) on the FX using Platform.runLater (...) application thread. You want to make sure that you do not flood the Application FX thread with too many such calls. Depending on how often the int in the model property is get updated, you discussed techniques in {: identifier of the thread = 2507241}.

The tasks of JavaFX API provides friendly mechanisms to remind the JavaFX Application thread; However it is not really applicable in this case. The task class encapsulates a one-time job and (optionally) return a value and then ends, which is not what you're doing here.

Here is a complete example; He is not broke in separate FXML for display and a controller, etc., but you can see the structure and break it down according to your needs.

import javafx.application.Application;
import javafx.application.Platform;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;

public class ConcurrentModel extends Application {

  @Override
  public void start(Stage primaryStage) {
    final AnchorPane root = new AnchorPane();
    final Label label = new Label();
    final Model model = new Model();
    model.intProperty.addListener(new ChangeListener() {
      @Override
      public void changed(final ObservableValue observable,
          final Number oldValue, final Number newValue) {
        Platform.runLater(new Runnable() {
          @Override
          public void run() {
            label.setText(newValue.toString());
          }
        });
      }
    });
    final Button startButton = new Button("Start");
    startButton.setOnAction(new EventHandler() {
      @Override
      public void handle(ActionEvent event) {
        model.start();
      }
    });

    AnchorPane.setTopAnchor(label, 10.0);
    AnchorPane.setLeftAnchor(label, 10.0);
    AnchorPane.setBottomAnchor(startButton, 10.0);
    AnchorPane.setLeftAnchor(startButton, 10.0);
    root.getChildren().addAll(label, startButton);

    Scene scene = new Scene(root, 100, 100);
    primaryStage.setScene(scene);
    primaryStage.show();
  }

  public static void main(String[] args) {
    launch(args);
  }

  public class Model extends Thread {
    private IntegerProperty intProperty;

    public Model() {
      intProperty = new SimpleIntegerProperty(this, "int", 0);
      setDaemon(true);
    }

    public int getInt() {
      return intProperty.get();
    }

    public IntegerProperty intProperty() {
      return intProperty;
    }

    @Override
    public void run() {
      while (true) {
        intProperty.set(intProperty.get() + 1);
        try {
          Thread.sleep(50);
        } catch (InterruptedException exc) {
          exc.printStackTrace();
          break;
        }
      }
    }
  }
}

Tags: Java

Similar Questions

  • JDK 8 and JavaFX TabPane throwing NullPointerException

    Hi all. I hope this is the right forum for this. I want to preface this question by declaring that the following code works perfectly fine in JDK 1.7. The goal here is to create a component with a tab at the end tab (with the value text '+') so that whenever this tab is selected, the program creates a new tab in the tab pane. This feature works fine. The problem is that when you close the new tab via the X, it goes to the tab 'add,' creates a new tab, then survey the following NullPointerException in some code JDK (and the app shows now TWO new tabs that correspond to the exact same object):

    Execution using the C:\Program Files\Java\jdk1.8.0\jre/bin/java java.lang.NullPointerException at com.sun.javafx.scene.control.skin.TabPaneSkin platform $TabHeaderSkin.access$ 302 (TabPaneSkin.java:1040) of C:\Users\XXXXXX\Documents\NetBeansProjects\TestJavaFx\dist\run2082574567\TestJavaFx.jar...

    I cut down the trouble code bare minimum to view the issue, and it's as follows:

    (Incase it do not paste correctly, see here: [Java] package testjavafx; import javafx.application.Application; import javafx.bea - Pastebin.com)

    package testjavafx;
    
    
    import javafx.application.Application;
    import javafx.beans.value.ChangeListener;
    import javafx.beans.value.ObservableValue;
    import javafx.scene.Scene;
    import javafx.scene.control.Tab;
    import javafx.scene.control.TabPane;
    import javafx.scene.control.TabPane.TabClosingPolicy;
    import javafx.scene.layout.StackPane;
    import javafx.stage.Stage;
    
    
    public class TestJavaFx extends Application {
    
    
        private TabPane tabPane;
        private Tab addTab;
        private Tab currentTab;
    
    
        @Override
        public void start(Stage primaryStage) {
    
    
            //Create the tab pane and the 'addTab' for adding new tabs.
            tabPane = new TabPane();
            tabPane.setTabClosingPolicy(TabClosingPolicy.SELECTED_TAB);
    
    
            addTab = new Tab("+");
            addTab.setClosable(false);
            tabPane.getTabs().add(addTab);
    
    
            //Add a listener to listen for changes to tab selection.
            tabPane.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Tab>() {
                @Override
                public void changed(ObservableValue<? extends Tab> observable, Tab oldSelectedTab, Tab newSelectedTab) {
    
    
                    //If we change to the addTab create a 
                    //new tab and change selection.
                    if (newSelectedTab == addTab) {
                        //Create the new tab.
                        createNewTab();
                    } else {
                        currentTab = newSelectedTab;
                    }
                }
            });
            //Create a new tab for initial load of the app
            createNewTab();
    
    
            StackPane root = new StackPane();
            root.getChildren().add(tabPane);
    
    
            Scene scene = new Scene(root, 500, 500);
    
    
            primaryStage.setTitle("Tab Test");
            primaryStage.setScene(scene);
            primaryStage.show();
        }
    
    
        /**
         * @param args the command line arguments
         */
        public static void main(String[] args) {
            launch(args);
        }
    
    
        private Tab createNewTab() {
            Tab newTab = new Tab("New Tab");
            newTab.setClosable(true);
            tabPane.getTabs().add(tabPane.getTabs().size() - 1, newTab);
            tabPane.getSelectionModel().select(newTab);
            return newTab;
        }
    
    
    }
    

    Does anyone have ideas on this? Why it would break in 1.8? Is there a bug in the JDK?

    It's clearly a bug in the code of TabPaneSkin. What seems to be the case, it's that the tab is removed before the end of the deletion tab animation. The problem may be exacerbated by the code by automatically adding a tab if the last tab is deleted, but the code base should not fall like that.

    To work around the issue, disable the close animation of the tab with the following CSS bit.

        tabPane.setStyle ("- fx - close-tab-animation: none ;"); ")

    I created https://javafx-jira.kenai.com/browse/RT-36443 to follow up the matter.

  • Need help with jsp and java bean

    A Department has built its own site using jsp. I need to get this up and running through cf7.1

    I created a server instance, so it is separated from the rest of the intranet.
    Basically, I think I need to 'install' the javabean. But don't know how.

    Code added to the web.xml file
    < servlet-mapping >
    controller < servlet name > - < / servlet-name >
    *.do < url-pattern > < / url-pattern >
    < / servlet-mapping >

    The login page is called a link
    127.0.0.1/servlet/controller?page=login

    The jsp code is as Attaché (initial login page)

    There is a file 'LoginBean.java '.

    Now for the error

    jrun.jsp.tags.GetProperty$ NoSuchPropertyException: (/ loginPage.jsp:13) the loginBean bean has no property enteredcustomerid
    at jrun.jsp.tags.GetProperty.init(GetProperty.java:78)
    at jrun.jsp.tags.GetProperty.doStartTag(GetProperty.java:39)
    at jrun__loginPage2ejspe._jspService(jrun__loginPage2ejspe.java:75)
    at jrun.jsp.runtime.HttpJSPServlet.service(HttpJSPServlet.java:43)
    at jrun.jsp.JSPServlet.service(JSPServlet.java:119)
    at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
    at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
    at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:257)
    at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:541)
    at jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
    to jrunx.scheduler.ThreadPool$ ThreadThrottle.invokeRunnable (ThreadPool.java:426)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

    jrun.jsp.runtime.UncaughtPageException: unmanaged by the exception that is thrown from /loginPage.jsp:13
    at jrun.jsp.runtime.Utils.handleException(Utils.java:57)
    at jrun.jsp.runtime.JRunPageContext.handlePageException(JRunPageContext.java:384)
    at jrun__loginPage2ejspe._jspService(jrun__loginPage2ejspe.java:119)
    at jrun.jsp.runtime.HttpJSPServlet.service(HttpJSPServlet.java:43)
    at jrun.jsp.JSPServlet.service(JSPServlet.java:119)
    at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
    at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
    at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:257)
    at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:541)
    at jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
    to jrunx.scheduler.ThreadPool$ ThreadThrottle.invokeRunnable (ThreadPool.java:426)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)


    Any help please...

    Ken

    Tim,

    I want to thank you for your help on this. If I you never have an event, drinks are on me.

    I created a new server through the cf admin instance, this created all required files files.
    Although the jrun - Web.xml wasn't in the web - inf folder. So I copied to this location and inserted your piece of code.
    I then copied the code from the web.xml file and the web_frim_beans.xml that we have with the application and paste it into the Web.XML of the server instance.
    Then I copied all the files of the classes in the application folder in the folder for the server instance class.
    I copied then only the application files in the cfusion.war file that was created.

    Then, I stopped and restarted the server instance, but because of the case in the login page, it did not work.
    So, I then made changes as you suggest to the loginPage.jsp and the LoginBean.java file.

    Then, I stopped and restarted the instance server again.

    Everything worked as it should.

    Again, thank you.

    Ken

  • 8451 I2C simultaneous and IO USB

    Hello

    I use the USB8451 OR communicate with a BQ77910A of TI by I2C. I2C communication works read at the moment but to write the EEPROM registers that I provide 3.3 v using the IO signals.

    I tested the IO and generated a signal successfully. My question is: is it possible to simultaneously run I2C and e/s on the USB8451. They need to be on the same VI in order to exploit?

    Thank you

    Vid

    Hey Vid,

    seems reasonable to use two digital lines (what do you mean by "IO"?) and the I2C at the same time. Did you habe problems using both resources at the same time?

    In general it makes no difference if you use two resources in a VI or two screws separate

    Best regards

    Christoph

  • refnum and the Boolean property nodes

    Hi guys,.

    I have a weird problem where if I create a property node and connect it to the refnum of a Boolean value, I use in my Subvi what happens with the variant data type.

    Now, I know normally it means that the Boolean control is set to a lock rather than a State of the switch. However, even when I configure the refnum of the switch on the Subvi "switch when press ' it still maintains a variant data type.

    Bascially, so what I'm asking, it is, is it possible to get the mode of Boolean data back using these property nodes?

    The main objective of this code must be able to have a "Stop executing" button on the front panel and who put an end to the Subvi, which will run at the time and return to the main program any when that button is pressed.

    The joint screws are written in Labview 2012.

    Bravo guys.

    Hello

    Home screen to the type of data in the control of reference of the Subvi.

    You may have noticed a red dot on the Sub - VI control reference entry in the main VI Boolean node.

    Also attached are the VI.

    I hope this helps.

  • distinguish between the indicator and controls using property nodes

    How can I distinguish between controls and indicators property nodes?

    I find that the controls and lights on the Panel before all come from the same class... a digital control and a digital indicator share the same properties... I am trying to find a way to distinguish between the two.  I would like to be able to analyse a reference VI pull only the references to the "controls" or "indicators" on the front panel... but when I try this, I shoot all...

    Although I found this case a knot of property ' control value: get all ' referral of VI, I can choose between only indicator or only the values of the controls... it's close to what I want, but instead, I like to shoot only the references to the Group of the "indicators" or only the references to the groups 'controls '.

    does anyone know if there is a simple way to do this?

    Thank you very much!

    Suprisigly to search for flags search controls

  • Two screens running simultaneously and in the background.

    I try to have two screens simultaneously running in the background. All have two timers for different events and I would like the user to switch between them in the menu to check their progress. I also want to the app with both screens to be able to run in the background when closed.

    I have them both running in the background by substituting onClose displayed on the screen with:

    public boolean onClose() {
        UiApplication theApp = UiApplication.getUiApplication();
        theApp.requestBackground();
        return true;
    }
    

    Which works very well. But how do I do the same reverse backwards between screens in the application?

    The feature I'm looking for is similar to the stopwatch of the RIM. You can simultaneously run the stopwatch and timer. You go back between them in the menu...

    Thank you

    When you are referring to the screen, I guess average u of the GUI. You can create the interface at the beginning that is, launch the application, then you should use the instances of the screen to bring them toward the front of the stack (visible to the user).

    I think some pseudocode would be useful as im not 100% of the structure of your code and what exactly you doing.

    The snapshot from the above code, you create an instance of the screen every time so I understand you want to rather just put the screen at the front of the stack.

    You must also run the timers in a different thread, not in the user interface thread. Maybe think of it this way, you have a class that manages the two screens and holds the instance of the timer, so you can access and create the user interface for him.

    Hope this makes it a little more clear.

  • How to run both simultaneously and declaratively in the TF?

    Hello

    I use JDev 11.1.2.1.0

    I have a JSF page that has a separator. A split should have CreateInsert method to execute when the page is loaded. The second division consists of an opinion that has a query to run. Again, it is a method of the AM. I tried to give both methods, but running alone. Can I do this declaratively?

    Thank you

    There is no simultaneous execution of methods in the ADF. However, you can drag each of the methods on the workflow and call each after the other, implement your use case. Start the workflow with the query (make drag method am or executeWithParam on the workflow and mark the default activity. Then drag the insert method to create the same workflow and add a navigation of the first method of the second scenario. In the second method you can access the page. This should be it.

    Timo

  • I have an access of undefined property _root. and access to property may be undefined

    I have 2 errors with my script (below) it is assumed to be Actionscript 3.0.

    I'm getting a

    1120: access of undefined property _root.

    and has...

    1119: access of property may be undefined onRelease through a reference with static type flash.display:SimpleButton.

    Here is my code...

    var frameNum:Number

    function photoChange() {}

    _root.photos.gotoAndStop ("img" + frameNum);

    }

    {btn1.onRelease = Function ()}

    frameNum = 1

    photoChange();

    }

    {btn2.onRelease = Function ()}

    frameNum = 2

    photoChange();

    }

    {btn3.onRelease = Function ()}

    frameNum = 3

    photoChange();

    }

    {btn4.onRelease = Function ()}

    frameNum = 4

    photoChange();

    }

    {btn5.onRelease = Function ()}

    frameNum = 5

    photoChange();

    }

    {btn6.onRelease = Function ()}

    frameNum = 6

    photoChange();

    }

    {btn7.onRelease = Function ()}

    frameNum = 7

    photoChange();

    }

    {btn8.onRelease = Function ()}

    frameNum = 8

    photoChange();

    }

    {btn9.onRelease = Function ()}

    frameNum = 9

    photoChange();

    }

    {btn10.onRelease = Function ()}

    frameNum = 10

    photoChange();

    }

    {btn11.onRelease = Function ()}

    frameNum = 11

    photoChange();

    }

    {btn12.onRelease = Function ()}

    frameNum = 12

    photoChange();

    }

    Could someone help me please!

    _root and onRelease are not AS3, AS2 code to which they belong.  Basically, all of the code that you show treat like AS2, but will have made a mistake if you have your publication set for AS3 settings.  To implement it in AS3 code, you must follow the changes indicated below for all of the code...

    var frameNum:Number;

    function photoChange(evt:MouseEvent) {}

    frameNum = Number (String (evt.currentTarget.name) .substr (3))
    photos.gotoAndStop ("img" + String (frameNum));

    }

    Btn1.addEventListener (MouseEvent.CLICK, photoChange);

    .

    etc.

    .
    btn12.addEventListener (MouseEvent.CLICK, photoChange);

    Assuming you are using the button symbols, the function by using string manipulations to get the chassis number of the button name.  If you use MovieClips as buttons you can assign each number as a property and get this quite the contrary.  Buttons do not support the dynamic properties as do MovieClips.

    The reference to _root in AS3 is simply 'root' but which has usually need a qualifier, as in MovieClip (root).  In many cases using a root reference is not necessary.  If your code is on the main timeline, then there is no need to use references from the root because it is essentially where you are already.  If this code is inside another object on the timeline, then using... MovieClip (root). photos.gotoAndStop... etc would be a solution.

  • Difference between standard java bean and dynamic bean?

    Hi all
    Can does anyone of you tell me the difference between the dynamic standard java bean and bean?

    Thanks in advance...
    Sudhakar.

    DynamicBean

  • With the help of vector graphics with fxml and JavaFX

    HY

    I wonder about the use of vector graphics scalable, svg, files in my project JFX.
    I know how to display the png with an imageview images and who can handle via CSS style (like fx-background-image)
    But for now, I want to add a vector graphic to my scene.
    I'm not shure if I use .ai, .svg or other file formats and how to load that.

    I read on SVGGraph but failed to get the idea behind it
    (and think that's not for files)

    So please can someone tell me how single charge and show a graphic vector and formaterait which should take?

    Ah: A way to make this replaceable graph via CSS style would be nice too ;)

    Thank you

    BR

    This .fx file is probably the old 1.x JavaFX, which is no longer supported for JavaFX 2.x and to my knowledge there is also no converter for this.

  • VAADIN and JavaFX

    I have already developed an application written in VAADIN (a library of java to create web user interfaces) to have a web interface for maintenance of an application. Everything works fine and development was very fast, but now I'm browsing the web interface by using the JavaFX WebView component and I suffer from a few problems. If I start to reload the URL after several tests the background of buttons does not load. I tried to change the cache from the Pier (used for browser VAADIN pages) to 0 without results.

    Once it fails the following are charged do not solve the problem. I can't reproduce this problem using firefox or chrome (which has the same engine as WebView I think). I also tried to reproduce the same situation using the demo "http://demo.vaadin.com/sampler#ButtonPush" but in this case, the problem is not in the same way, even if the background of the button may took several seconds in certain situations.

    Any idea? Any relevant configuration in the webEngine?

    I can't reproduce your problem (JavaFX 2.2b6 WinXPSp3).
    If you are not already the case, make sure you use JavaFX 2.1 + on a taken platform support (Windows or Mac).

    Here is an example of application.

    import javafx.application.Application;
    import javafx.scene.Scene;
    import javafx.scene.web.WebView;
    import javafx.stage.Stage;
    public class VaadinWebView extends Application {
      public static void main(String[] args) { launch(args); }
      @Override public void start(Stage primaryStage) {
        final WebView webView = new WebView();
        webView.getEngine().load("http://demo.vaadin.com/sampler#ButtonPush");
        primaryStage.setScene(new Scene(webView));
        primaryStage.show();
      }
    }
    

    Right-click on the Web view and choose reload to reload the page - I did it a lot, but he always worked (possibly) for me - it sometimes takes a while to load the graphics up, probably due to slow network connectivity to the site vaadin or inefficient javascript code in vaadin. I tried firefox, it was also slow to load images button too, but (maybe) a little faster than webview. I guess this all matches your description for http://demo.vaadin.com/sampler#ButtonPush

  • Simultaneous and Conc application managers

    Hello

    It is possible to find the name of the manager who currently TREATS a concurrent request of front-end and back-end.

    I found some scripts to get the name of handler for already PROCESSED request but I have found no handler to which a particular request is assigned.


    pl help

    -Thank you

    In the database, see the fnd_concurrent_worker_requests.
    It lists the pending requests / running by concurrent_queue_name and watch the stage and status.

    Front-end, go to Sysadmin > simultaneous > Manager > manage
    Go to the Manager, and then click queries
    Which displays applications handled by the Manager.

    Sandeep Gandhi

  • Problem with validation popup function and af bean.

    I have the following code from the model:

    View1.JSPX contains a popup with 2 text entry. the text of entry has a custom validator (is not allowing the user to enter text containing 'A'):
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
      <jsp:directive.page contentType="text/html;charset=UTF-8"/>
      <f:view>
        <af:document id="d1">
          <af:form id="f1">
          <af:commandButton text="Show Popup" id="cb1">
            <af:showPopupBehavior popupId="p1Adauga2"/>
          </af:commandButton>
          <af:popup id="p1Adauga2">
            <af:panelWindow id="pw2" title="Adauga entitate la lista">
              <af:panelGroupLayout id="pgl7" layout="horizontal" halign="center"
                                   valign="top">
                <af:panelFormLayout id="pfl1">
                  <af:inputText label="text1:"
                                maximumLength="10"
                                id="it11" 
                                rendered="true"
                                validator="#{TestBean.validateText1}"
                                autoSubmit="true">
                  </af:inputText>
                  <af:inputText label="text2:"
                                maximumLength="10"
                                id="it9"
                                rendered="true">
                  </af:inputText>
                </af:panelFormLayout>
                <af:spacer width="10" height="30" id="s7"/>
              </af:panelGroupLayout>
              <af:panelGroupLayout id="pgl8" layout="horizontal" valign="bottom"
                                   halign="center">
                <af:commandButton text="Add" id="cb11Adauga"/>
                <af:spacer width="10" height="30" id="s9"/>
              </af:panelGroupLayout>
            </af:panelWindow>
          </af:popup>
          </af:form>
        </af:document>
      </f:view>
    </jsp:root>
    The validation function is contained in a bean managed with a scope of application:
    import javax.faces.application.FacesMessage;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    
    import oracle.adf.view.rich.component.rich.input.RichInputText;
    
    public class TestBean {
        public TestBean() {
        }
    
        public void validateText1(FacesContext facesContext,
                                  UIComponent uIComponent, Object object) {
            String val = (String) object;
            if (val.contains("A")) {
              FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, 
                                                      "Eroare", "Cannot contain A");
              facesContext.addMessage(uIComponent.getClientId(facesContext), 
                                      message);
              ((RichInputText)uIComponent).setValid(false);
            }
        }
    }
    My problem:

    1. I enter invalid text
    2. an error message is displayed, saying that that text I put in place is not valid.
    3. I press the Add - button the popup is closed. Why? The component is not valid. Shouldn't the blocked popup until all text entry are valid?

    How to achieve this.

    Please see the screenshot below, it better describes my problem:


    Published by: Andrei Ciobanu on 12 Aug 2011 06:16

    Published by: Andrei Ciobanu on 12 Aug 2011 06:19

    You should read the documentation of af: popup [http://download.oracle.com/docs/cd/E16162_01/apirefs.1112/e17491/tagdoc/af_popup.html url] and understand everything about auto-licenciement

  • NetBeans plugin 7 and JavaFX

    I'm the only person who can not get the JavaFX plugin to work with Netbeans 7?

    Downloaded 7 NB
    Installing Javafx 2.0 runtime
    Downloaded and installed the plugins nb javafx 2.0 according to the installation instructions.

    Then by restarting gives errors on the NB plugins - that must be disabled before you continue.

    Tried on both PC and had the same problem. Nb plugins seems to destroy the basic features in Netbeans (cannot create new projects)

    It worked for me:
    1 uninstall Netbeans 7.
    2 install Netbeans 7.
    3. start Netbeans and go to tools-> Plugins
    4. the new updates should appear. Install them. See patch info here http://wiki.netbeans.org/NetBeans7.0PatchesInfo
    5 install the JavaFx plugins

Maybe you are looking for

  • HP Envy 4523: Printing without margins

    Hello The HP Envy 4523 print width without borders of paper A4 size and means of length?

  • DVD/CD drive does not at all on Satellite A100/A105 Series

    Hello My CD-ROM/DVD-Rom went completely unoperative. The LED does not blink and it is not ejected, with the key or with a software command.The drivers are listed as being activated, they are: LP3307P RPB109J SCSI CDROM DEVICEYN2495K TDG329D SCSI CDRO

  • installation of boot camp with windows 10 boot camp does not

    Hi, I tried to load bootcamp on my macbook pro with windows 10 but when bootcamp reopens windows and begins to install bootcamp it stop responding to halfway through can anyone help is there any solution yet

  • With the help of MS PRO Duo into the slot of the Satellite A200 MDMC

    I have a problem when inserting a Memory Stick PRO Duo SanDisk (512 MB) card with the help of Memory Stick Duo adapter in the card of my Satellite A200 - 1 M 8 (PSAE6) on Windows Vista Edition Home Premium.The device includes the insertion of the car

  • DIAdem reserved symbols

    I am currently a few problems about the symbols reserved inside the report menu 11 Diadem. I know that maybe this is a silly question, how can I force symbols like @ # is displayed correctly on the screen instead of bind external variables? Thanks in