Behavior of the node #visible

I'm not sure that the behavior of the Node #visible (). According to the API doc's 'Accurate' If this node and subnodes must be made within the framework of the graphic scene.

The result I get, at least when it is applied to a button and TextField inside a bar of tools, is it is when they are not visible, it is the empty space where they should have been.

The behavior I want, is that they should not take place at all. Is there a way to do this without removing them from the graphic scene?

Hello. Mix setVisible and setManaged

        button.setVisible(false);
        button.setManaged(false);
  

Tags: Java

Similar Questions

  • Threading and reuse of the node to call using reference of buffers (of the required adhesive tape)

    I tried to get the following information in the public domain for years and now that I have the answers, I'll share with those who might be interested.

    Caveat!

    Wrap your head in tape before reading just for the sake of security.

    My two questions were;

    (1) may LV re - use tampons of VI calling when you use VI serve call by reference?

    (2) is used when the use of call by reference UI thread?

    1 when you call a VI using the call through the reference node, the data in the pane of the copied or is node connector - this online as it would be with a Subvi properly implemented?

    Short answer: it's somewhere between the two.

    Long answer:

    The compiler does not know what will be called VI, but there a hint:

    the reference connected to the node of the call by reference. He uses to get the 'Prototype' for the call. Therefore, for optimal performance, use a prototype that has the same 'characteristics placeness' as it is called VI. That said, users don't know what are the "characteristics of the placeness.

    Before getting into the details, I will say that the overhead of these copies should not matter much unless it's a large data structure (a table with lots of items.) or a cluster/class with many fields or containing large networks etc..

    Example 1:

    If the prototype does not change the data, then the compiler assumes that the crux of the call by reference will not alter the data. However, at runtime, a check is made to see if the real called VI will modify the data. If Yes, then a copy is made and past so that the original data can be modified.

    Example 2:

    If the prototype contains an entry that is wired through an exit so that both input and output terminals can use the same buffer memory, but running an audit determines that the real called entry and exit VI do not share a buffer, then a copy will be made from output of the actual call to the original screws (combined input and output) buffer.

    I should also mention that, even with this behavior "are trying to get along with the prototype", it is not always possible to obtain good performance as a Subvi ordinary call. For example, if you have a situation where the prototype does not change the data and passes it through to an exit and then the compiler must assume that the data is changed (because, as in example 2, there are screws that may change even if the called real VI is not).

    And there are a few caveats:

    (1) this behavior "using a prototype" was new for 2009. Before that, we used a method more naïve data of passage that took all the entries will be changed and no outputs don't share a buffer with an entry.

    (2) this behavior can be changed in future versions, if we find additional optimizations.

    (3) this behavior is the same that we use for the dynamic distribution live (when you use the classes in LV)

    (4) If you want to create a VI can be used as a prototype, you can use the features of the Structure in Place to control the "characteristics of the placeness', namely the element nodes in and out of the border, the function"Mark as modifier"border nodes (note the pencil icon on the item), and the node always one copy.

    (5) the prototype is only the first reference ever connected to the node of the call by reference. So if you make a new prototype VI, you can just make a reference out of it plug into the crux of the call by reference. I suggest to remove the node from the call by reference and file a new.

    (6) for remote calls, we still "making copies" by transmitting data over a network.

    I hope that this helps, if you want information/clarification, so feel free to ask.

    2 - is the call made by the reference to run in the user interface thread node? If the call is made by a remote machine via ethernet, thread that host (the computer that makes the call by reference) runs on and thread that executes the target (the machine that contains the file VI) on?

    In the case of premises, the appeal made by the reference node does not require the user interface thread and may work in some thread the VI wants to run in.

    When you call a remote VI, the appeal made by the reference node uses the UI thread (detailed below) on both the client and the server.

    The client uses the UI thread to send the request to the server and there still when the response comes back. The user interface thread is not blocked during the time between the two.

    The server receives the TCP message in the UI thread, and then starts the call to the UI thread. The server also uses the user interface thread to send the response to the client. The user interface thread is not blocked on the server during execution of the VI.

    I hope that people find it when they need it!

    Ben


  • Strange behavior of the browser blocks SQLDEV DM

    Hello

    I feel some strange behaviors in the browser of Datamodeler.

    After the opening of my model

    I have doubleclick in the window of the browser to fetch a few properties of the index:

    Drawings and models > MyModel > relational models > my RelModel > models > Oracle Database 10g > Tables

    So far, everything that happens.

    -I can select the tables and

    -doubleclicking shows the properties of the table.

    -I can scroll vertically

    -Select other tables

    -open and close the subtree of this physical tables

    Now, as soon as I click on any 'more' in the physical tables (for example, the index node or node of the plate) the browser "tri-de gel".

    The tree is distorted, scrolling seems erratic and it is impossible to select. Most of the time the main menu is also distorted.

    If I make the browser window, most of the time I'm able to hit the "file > save" from the menu. The model seems to be registered properly.

    No damage seems to have been done to the template on the reopening

    I'm on Windows 8 pro with the 64-bit version of datamodeler version 4.1.2.895 (from datamodeler - x 64 - 4.1.2 - 895.zip)

    Any ideas anyone?

    any response greatly appreciated.

    concerning

    Wouter

    Hi Wouter,

    I'm sorry, this is a bug and we are preparing a new version with this bug fixed.

    If I make the browser window, most of the time I'm able to hit the "file > save.

    Close the Data Modeler (X - close button in the upper right corner) and it will ask to save the drawing it is changed.

    Philippe

  • Strange behavior on the web page of preloading in WebView

    I have the following problem: in my Swing application, I want to display a web page. To do this, I use a JFXPanel that contains a WebView. The web page must be loaded in the background, and only if the loading process is totally finished I want to make the JFXPanel visible. I use thegetLoadWorker().workDoneProperty() method of the corresponding WebEngine to determine if the page is totally loaded.

    The problem is, now that the JFXPanel gets visible, I see initially a totally empty Board, and after a short period, the web page in Web view is visible. I made a simple Application demo that reproduces this behavior. If the page is loaded, a button is enabled and clicking on this button adds the WebView Panel below. In addition the link following points to an animated gif that shows the behavior: http://tinypic.com/view.php?pic=oh66bl & s = 5 #. Ujv2IhddWKl

    Here is the code of the demo application:

    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javafx.application.Platform;
    import javafx.beans.value.ChangeListener;
    import javafx.beans.value.ObservableValue;
    import javafx.embed.swing.JFXPanel;
    import javafx.scene.Scene;
    import javafx.scene.web.WebEngine;
    import javafx.scene.web.WebView;
    import javax.swing.JFrame;
    import javax.swing.SwingUtilities;
    public class WebViewTest extends javax.swing.JPanel {
    
       private static JFXPanel browserFxPanel;
       private WebView webView;
       private WebEngine eng;
    
       /**
      * Creates new form WebViewTest
      */
       public WebViewTest() {
      initComponents();
       Platform.setImplicitExit(false);
      browserFxPanel = new JFXPanel();
       Platform.runLater(new Runnable() {
       public void run() {
      webView = createBrowser();
       Scene scene = new Scene(webView);
      scene.setFill(null);
      browserFxPanel.setScene(
      scene);
       }
       });
       }
    
       /**
      * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The
      * content of this method is always regenerated by the Form Editor.
      */
       @SuppressWarnings("unchecked")
       // <editor-fold defaultstate="collapsed" desc="Generated Code">  
       private void initComponents() {
      java.awt.GridBagConstraints gridBagConstraints;
    
      pnlMain = new javax.swing.JPanel();
      showWebpageButton = new javax.swing.JButton();
    
      setLayout(new java.awt.GridBagLayout());
    
      pnlMain.setLayout(new java.awt.BorderLayout());
      gridBagConstraints = new java.awt.GridBagConstraints();
      gridBagConstraints.gridx = 0;
      gridBagConstraints.gridy = 1;
      gridBagConstraints.gridwidth = 3;
      gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
      gridBagConstraints.weightx = 1.0;
      gridBagConstraints.weighty = 1.0;
      add(pnlMain, gridBagConstraints);
    
      showWebpageButton.setText("show web page");
      showWebpageButton.setEnabled(false);
      showWebpageButton.addActionListener(new java.awt.event.ActionListener() {
       public void actionPerformed(java.awt.event.ActionEvent evt) {
      showWebpageButtonActionPerformed(evt);
       }
       });
      gridBagConstraints = new java.awt.GridBagConstraints();
      gridBagConstraints.gridx = 1;
      gridBagConstraints.gridy = 0;
      gridBagConstraints.insets = new java.awt.Insets(10, 10, 10, 10);
      add(showWebpageButton, gridBagConstraints);
       }// </editor-fold>  
    
       private void showWebpageButtonActionPerformed(java.awt.event.ActionEvent evt) {   
      pnlMain.removeAll();
      pnlMain.add(browserFxPanel, BorderLayout.CENTER);
       WebViewTest.this.invalidate();
       WebViewTest.this.revalidate();
       }   
       // Variables declaration - do not modify  
       private javax.swing.JPanel pnlMain;
       private javax.swing.JButton showWebpageButton;
       // End of variables declaration  
    
       private WebView createBrowser() {
       Double widthDouble = pnlMain.getSize().getWidth();
       Double heightDouble = pnlMain.getSize().getHeight();
       final WebView view = new WebView();
      view.setMinSize(widthDouble, heightDouble);
      view.setPrefSize(widthDouble, heightDouble);
      eng = view.getEngine();
      eng.load("http://todomvc.com/architecture-examples/angularjs/#/");
      eng.getLoadWorker().workDoneProperty().addListener(new ChangeListener<Number>() {
       public void changed(ObservableValue<? extends Number> ov, Number t, Number t1) {
       final double workDone = eng.getLoadWorker().getWorkDone();
       final double totalWork = eng.getLoadWorker().getTotalWork();
       if (workDone == totalWork) {
      showWebpageButton.setEnabled(true);
       }
       }
       });
       return view;
       }
    
       public static void main(String[] args) {
       SwingUtilities.invokeLater(new Runnable() {
       public void run() {
       final JFrame f = new JFrame("Navigator Dummy");
      f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
      f.setSize(new Dimension(1024, 800));
       final WebViewTest navDummy = new WebViewTest();
      f.getContentPane().add(navDummy);
      f.setVisible(true);
       }
       });
       }
    }
    
    
    

    I don "t understand this behavior, in fact the page has already been loaded. To me, it seems that the WebView starts to render the site just to the point where it becomes visible. What can I do to get the WebView already shows the web page is loaded right now that it becomes Visible (to avoid this effect of flickr)?

    I already posted this question on StackOverflow (see http://stackoverflow.com/questions/18873315/javafx-webview-loading-page-in-background ) but didn't get an answer and found this forum today.

    Thanks in advance!

    Try the updated version in this post.

    It requires a snapshot offscreen before displaying the Web mode to make sure all is rendered before the Web is displayed.

    The code is kind of ugly and the 'solution' is a bit of a hack, you would probably want to clean it up a bit before using it anywhere (for example, there is no need to create a new WebView and snapshot, web page on each load - I did it just to get a feel for the worst-case scenario and try to pinpoint where are produce slowdowns).

    A small rectangle moves back on the top of the screen so that the fluidity of the animation can be monitored.

    On the first charge, there will be a slight stutter in the animation, but the rendered web page instantly appears when click the show page"" button.

    As you say, the stuttering occurs only the first time the page is loaded, then everything is smooth.  If you use a progress bar regular instead of an animation, the initial stuttering is probably fine, because people expect to see breaks in the progress bars from time to time (more progress reported by progress bars is not a smooth linear progression).  My guess is that if you use a regular progress bar, the behavior seen with this example is probably acceptable for almost all users.

    As for the differences between the rendering between 2.2 JavaFX and JavaFX 8, there was a lot of changes to the internal architecture of JavaFX for JavaFX 8 that have improved rendering performance, as well as probably represents the delta.

    import javafx.animation.*;
    import javafx.application.Application;
    import javafx.concurrent.Worker;
    import javafx.geometry.*;
    import javafx.scene.Scene;
    import javafx.scene.control.*;
    import javafx.scene.layout.*;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Rectangle;
    import javafx.scene.web.WebView;
    import javafx.stage.Stage;
    import javafx.util.Duration;
    
    public class WebViewJavaFXTest extends Application {
        public static final String PAGE_URL = "http://todomvc.com/architecture-examples/angularjs/#/";
        private Rectangle distractor;
    
        @Override
        public void start(Stage stage) throws Exception {
            distractor = new Rectangle(20, 20, Color.CORAL);
            TranslateTransition r = new TranslateTransition(Duration.seconds(10), distractor);
            r.setFromX(0);
            r.setToX(800);
            r.setInterpolator(Interpolator.LINEAR);
            r.setCycleCount(RotateTransition.INDEFINITE);
            r.setAutoReverse(true);
            r.play();
    
            VBox layout = initView();
            stage.setScene(new Scene(layout));
            stage.show();
        }
    
        private VBox initView() {
            final ProgressBar progress = new ProgressBar();
            final Button showWebView = new Button("Show Page");
            showWebView.setDisable(true);
            HBox controls = new HBox(
                    10,
                    progress,
                    showWebView
            );
            controls.setAlignment(Pos.CENTER_LEFT);
            Button tryAgain = new Button("Try Again");
            tryAgain.setOnAction(actionEvent ->
                    tryAgain.getScene().setRoot(
                            initView()
                    )
            );
    
            StackPane webViewHolder = new StackPane();
            webViewHolder.setPrefSize(1024, 700);
    
            final WebView webView = new WebView();
            progress.progressProperty().bind(
                    webView.getEngine().getLoadWorker().progressProperty()
            );
            webView.setPrefSize(1024, 700);
            webView.getEngine().load(PAGE_URL);
            webView.getEngine().getLoadWorker().stateProperty().addListener(
                    (o, old, state) -> {
                        if (state == Worker.State.SUCCEEDED) {
                            webView.snapshot(
                                    snapshotResult -> {
                                        showWebView.setDisable(false);
                                        return null;
                                    },
                                    null,
                                    null
                            );
                        } else {
                            showWebView.setDisable(true);
                        }
                    }
            );
    
            showWebView.setOnAction(actionEvent -> {
                controls.getChildren().setAll(
                        tryAgain
                );
                webViewHolder.getChildren().setAll(webView);
            });
            VBox layout = new VBox(
                    10,
                    distractor,
                    controls,
                    webViewHolder
            );
            layout.setPadding(new Insets(10));
    
            return layout;
        }
    
        public static void main(String[] args) {
            launch();
        }
    
    }
    
  • Make the tab visible benefits on the people screen

    Hello

    A responsibility custom, people enter and maintain the screen, I need to make the tab visible benefits.

    I checked if the customization is hide and is NOT.

    I checked Taskflow but this is not controlled by the workflow either (as far as I can see) correct me if I'm wrong.


    Is there something obvious I'm missing here?

    Please suggest!

    Thank you

    What function is needed to make the tab visible benefits?

    EXPECTED BEHAVIOR
    Wait tab benefits on the personalized handset by and Asg form (PERWSHRG) to be visible.

    MEASURES
    1 custom liability
    2. people > enter & maintain
    Cause
    The cause of the problem is the function that view HR benefits has not been attached to the menu

    New BUG: 3514601: TAB BENEFITS IS NOT INCLUDED ON THE FORM of PERSON INFORMATION
    He states:
    The display of the tab benefits is controlled by the function 'HR_VIEW_BENEFITS '.
    Solution
    To implement the solution, please perform the following steps:

    1. go in the liability: System Administrator

    2 navigate to SEE > Application > Menu

    3 queries in your menu and add the feature (with no prompts) "HR_VIEW_BENEFITS" and save it.

    4. Please test the issue again.

    5. If the problem is solved, please migrate the solution as the case in other environments.

    Published by: 955690 on May 8, 2013 08:36

  • Hierarchy Viewer - card only on the nodes

    I use the 11.1.2.3.0 version.

    Is there a way to show a map on end-nodes of the hierarchy Viewer?

    I have information that applies only to nodes on the bottom of the tree.

    Thanks in advance.

    This should be possible.
    I have not tested this, but you can use the property made the panelCard element and set to an EL that has the false value is the node has children (node.hasChildren? or other data that allows you to know if you want to display the map).
    If it does not sheet you made of the property and use the property visible or melting of the component that holds the information you want to only display in the terminal nodes.

    Timo

  • Remove the node text spaces

    Hello

    We are in the process to migrate our 10.2.0.4 db to 11.2.0.3 and discovered a problem with one of our requests - basically, extract us from the text of a node as a number and if this node consists of a space only, he is now back a 0 in 11.2.0.3 rather than the NULL value, it allows to return to 10.2.0.4 (and earlier versions).

    Here are examples I've worked with:
    select extract(xmltype('<root><test> </test></root>'), '/root/test/text()').getnumberval() from dual;
    select extract(xmltype('<root><test>
    </test></root>'), '/root/test/text()').getnumberval() from dual;
    I raised a SR with Oracle, due to the difference in the behavior of our 10 g database, but in the meantime, I need to work around this problem. If there's an orderly way to remove the whitespace node text? I would rather have to convert the xmltype to a clob to do a replacement, or the extraction of the node as text and then cut and replace and converted to a number, if possible.

    Hello

    I can reproduce the 'new' behavior on 10.2.0.5 too:

    SQL> select * from v$version;
    
    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    PL/SQL Release 10.2.0.5.0 - Production
    CORE    10.2.0.5.0      Production
    TNS for 64-bit Windows: Version 10.2.0.5.0 - Production
    NLSRTL Version 10.2.0.5.0 - Production
    
    SQL> select extract(xmltype('
      2  '), '/root/test/text()').getnumberval() as result
      3  from dual;
    
        RESULT
    ----------
             0
    

    On 11.2.0.3, if you can invest time in refactoring, I would say that rather use you no deprecated features:

    SQL> select * from v$version;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for Linux: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    
    SQL> select xmlcast(
      2           xmlquery('normalize-space(/root/test)'
      3             passing xmltype('
      4   ')
      5             returning content
      6           )
      7           as number
      8         ) as result
      9  from dual ;
    
        RESULT
    ----------
    
    SQL> select xmlcast(
      2           xmlquery('normalize-space(/root/test)'
      3             passing xmltype('123')
      4             returning content
      5           )
      6           as number
      7         ) as result
      8  from dual ;
    
        RESULT
    ----------
           123
    
  • Prevent the default behavior of the events

    How can I prevent the default behavior of the events?

    I know that this concept of JavaScript or ActionScript where you can prevent the default behavior of an event by calling e.preventDefault ().

    How can I achieve this in JavaFX?

    For example, I have a KeyEvent on a TextArea and want to intercept the Enter key and stop him to position the cursor in the new line.

    I tried consume(), but apparently, it's the equivalent of e.stopPropagation ().

    TextArea has a bug on the management of mouse events: http://javafx-jira.kenai.com/browse/RT-17902, whereby scrollpane transmitting text editable eating events and if the events are not exposed to users of the API, do not know if this will have an effect as the key to transformation of the text box you want to perform. If the question in 17902 is at the origin of the text box does not correctly answer the treatment of key events defined by the user, you can add an additional comment to this Jira to see.

    Information on the management of events can be found here: Re: event bubbling smile of understanding

    If the TextArea event management worked properly, you should probably be able to do what you want by adding an EventFilter on the text box and consuming of the event you want to capture. Do this in an EventFilter so you can intercept the event in the capture phase is best to try to do it in an EventHandler for the propagation phase. If try to consume the event in an EventHandler, it may not work because the event may already have been handled by the target node or the children of the node target.

  • Mobile: How to keep the splashscreen visible until the application is fully loaded

    Hello!

    I ve had trouble with this for a few days and I can't find any way to do... Maybe someone knows how to do!

    In a mobile application, you can specify a splashscreen. Mine is a SWF file instead of multiple images of resolution static, just to add some 'life '. West also this property that we keep the splashscreen visible through a number given in seconds.

    < components: TabbedViewNavigatorApplication

    splashScreenImage= ' (@Embed('assets/images/splash.swf').

    splashScreenScaleMode = "stretch".

    splashScreenMinimumDisplayTime= "5000" >

    Well, that's pretty interesting and works ok, but I m looking for a specific feature, because the "splashScreenMinimumDisplayTime" a few times is too long and sometimes not enough... What I would like is to maintain the visible splashscreen, that some initialization actions are totally completed (in this case, this means downloading a remote XML file and convert it to XMLLists). Then, hide the splashscreen programmatically. I think it would be great to be able to handle this behavior.

    We need a way to override certain methods of the splashscreen to do, but I couldn t find too much info on this... Please, someone give me just an idea to search on!

    Thanks in advance

    I got this work around to show the splashscreen indefinitely until hide us it at run time:

    1- A custom SplashScreen class is required. We cannot create one that extends from the original (located in the "frameworks/projects/mobilecomponentes/src/spark/preloaders/SplashScreen.as"), because some changes need to be made in a pair of private methods. So, copy the file in a "CustomSplashScreen.as" (change the path and the name of the class in his statement and its constructor method).

    2- Define the new class CustomSplashScreen as the default preloader in main MXML:

    <>

    Preloader = "CustomSplashScreen."

    (splashScreenImage="@Embed('assets/images/splash.swf')".

    splashScreenScaleMode = "stretch".

    splashScreenMinimumDisplayTime = "5000" >

    3- Back in our CustomSplashScreen class, we declare a static variable.

    public static var DISPLAY_TIME:Number = 1000;       in MS

    4- This variable will initially have the same value as the minimumDisplayTime property. To do this, we modify the 'prepareSplashScreen()' method, by adding the "BOLD" part:

    private function prepareSplashScreen (): void

    {

    ...

    ...

    If ("splashScreenMinimumDisplayTime" in info)

    {

    DISPLAY_TIME = this.minimumDisplayTime = info ["splashScreenMinimumDisplayTime"];

    }

    ...

    ...

    }

    5- Then change the 'initCompleteEnterFrameHandler()' method to check whether both times have been achieved (still once add the line in bold):

    private void initCompleteEnterFrameHandler(event:Event):void

    {

    If (currentDisplayTime<=>

    & DISPLAY_TIME > 0)

    {

    return;

    }

    dispatchComplete();

    }

    6- Finally, we need to restore this new variable somewhere to hide the splashscreen. For example, after the creation_completeHandler actions are made:

    CustomSplashScreen.DISPLAY_TIME = 0;

    P.D. The code above works, but I would really like to do this without creating a new class with the same content, but which stretches from the original SplashScreen class. Maybe someone could correct my solution with a better approach.

  • JTree disappears all by developing the node. Maybe a problem from hashCode().

    Hi, I have a JTree with custom template. I test with the following structure:

    + root
    - + category
    - + file

    When the application starts, root and the category are visible, the file is hidden. When I try to expand the class node, the JTree set disappears. A click away in the place previously occupied by the JTree result in a java.lang.NullPointerException at javax.swing.plaf.basic.BasicTreeUI$ Handler.handleSelection ().

    The nodes that I use represent a simple tree, where each node has its value and a LinkedList of his children. The model simply translated this to the 'language' of TreeModel.

    It is essential for me to properly define equals() and hashCode() for nodes. I discovered that if hashCode() of the nodes does not rely on a list of the children, everything works fine. But I want to rely on the children!

    I use 1.6.0_22 JRE on Win7.

    Where should I do something wrong, please?

    Thanks a lot for any help ;)

    PS: I managed to get around that - in a TreeSelectionListener I call tree.setModel (tree.getModel ()) and then I restore the nodes selected and expanded. It works, but of course I'd rather have a cleaner solution. In addition, this seems like a bug in JRE for me.

    Included NBS:
    import java.awt.Dimension;
    import java.util.LinkedList;
    import java.util.List;
    
    import javax.swing.JFrame;
    import javax.swing.JTree;
    import javax.swing.SwingUtilities;
    import javax.swing.WindowConstants;
    import javax.swing.event.TreeModelEvent;
    import javax.swing.event.TreeModelListener;
    import javax.swing.tree.TreeModel;
    import javax.swing.tree.TreePath;
    
    public class JTreeTest
    {
        public static void main(String[] args)
        {
            // setup the tree
            final File list = new File();
            list.setValue("root");
    
            File category = new File();
            list.getFiles().add(category);
            category.setValue("category");
    
            File file = new File();
            category.getFiles().add(file);
            file.setValue("file");
    
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run()
                {
                    JFrame frame = new JFrame();
    
                    // setup the JTree
                    JTree tree = new JTree(new MyModel(list));
                    frame.add(tree);
    
                    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
                    frame.setSize(new Dimension(200, 100));
                    frame.setVisible(true);
                }
            });
        }
    
        // this model is very very basic and I don't see much space here for errors...
        static class MyModel implements TreeModel
        {
            protected File                    root;
    
            protected List<TreeModelListener> treeModelListeners = new LinkedList<TreeModelListener>();
    
            public MyModel(File root)
            {
                this.root = root;
            }
    
            @Override
            public File getRoot()
            {
                return root;
            }
    
            @Override
            public Object getChild(Object parent, int index)
            {
                if (index < 0)
                    return null;
    
                if (!(parent instanceof File))
                    return null;
    
                File fParent = (File) parent;
    
                try {
                    return fParent.getFiles().get(index);
                } catch (ArrayIndexOutOfBoundsException e) {
                    return null;
                }
            }
    
            @Override
            public int getChildCount(Object parent)
            {
                if (!(parent instanceof File))
                    return 0;
    
                File fParent = (File) parent;
    
                return fParent.getFiles().size();
            }
    
            @Override
            public boolean isLeaf(Object node)
            {
                return getChildCount(node) == 0;
            }
    
            @Override
            public void valueForPathChanged(TreePath path, Object newValue)
            {
                if (!(newValue instanceof File))
                    return;
    
                if (path.getParentPath() == null) {
                    fireTreeNodesChanged(new TreeModelEvent(this, path, null, null));
                } else {
                    fireTreeNodesChanged(new TreeModelEvent(this, path.getParentPath(), new int[] { getIndexOfChild(path
                            .getParentPath().getLastPathComponent(), newValue) }, new Object[] { newValue }));
                }
            }
    
            @Override
            public int getIndexOfChild(Object parent, Object child)
            {
                if (parent == null || child == null)
                    return -1;
    
                if (!(parent instanceof File) || !(child instanceof File))
                    return -1;
    
                File fParent = (File) parent;
    
                return fParent.getFiles().indexOf(child);
            }
    
            @Override
            public void addTreeModelListener(TreeModelListener l)
            {
                treeModelListeners.add(l);
            }
    
            @Override
            public void removeTreeModelListener(TreeModelListener l)
            {
                treeModelListeners.remove(l);
            }
    
            public void fireTreeNodesChanged(TreeModelEvent e)
            {
                for (TreeModelListener listener : treeModelListeners) {
                    listener.treeNodesChanged(e);
                }
            }
        }
    
        static class File
        {
            static int fileId = 0;
            int        id;
            List<File> files  = null;
            String     value  = null;
    
            public File()
            {
                // ensure each item will have a really unique identifier, so no equals() collisions should occur
                id = fileId++;
            }
    
            public List<File> getFiles()
            {
                if (files == null)
                    files = new LinkedList<File>();
                return files;
            }
    
            public String getValue()
            {
                return value;
            }
    
            public void setValue(String value)
            {
                this.value = value;
            }
    
            // generated by Eclipse code helpers
            @Override
            public int hashCode()
            {
                final int prime = 31;
                int result = 1;
                result = prime * result + ((value == null) ? 0 : value.hashCode());
                // ///////HERE IT IS////////
                // if you uncomment the following line, the list will get empty when you expand the second category and
                // any following clicks in any place that should be occupied by an item will result in a
                // NullPointerException
                //
                result = prime * result + ((files == null) ? 0 : files.hashCode());
                //
                result = prime * result + id;
                return result;
            }
    
            @Override
            public boolean equals(Object obj)
            {
                if (this == obj)
                    return true;
                if (obj == null)
                    return false;
                if (getClass() != obj.getClass())
                    return false;
                File other = (File) obj;
                if (value == null) {
                    if (other.value != null)
                        return false;
                } else if (!value.equals(other.value))
                    return false;
                if (files == null) {
                    if (other.files != null)
                        return false;
                } else if (!files.equals(other.files))
                    return false;
                if (id != other.id)
                    return false;
                return true;
            }
    
            @Override
            public String toString()
            {
                return "File [value=" + value + "]";
            }
        }
    
    }

    peci1 wrote:
    If you think that it is not possible to have directly implemented in nodes to the evolution of codes in a JTree.

    If not know because the javadoc, said he. Once again:

    In the same way JTree and its associated classes place TreePaths in maps. Thus, if a node is requested twice, return values must be equal (using the equals method) and have the same hash code.

    I hope that the treeStructureChanged event would help here...

    It might work if you launch a node struct event has changed because you have changed the hash code of the real parent when you changed the children of it. But catch all these traps (restore expand status, etc.) seems too much work just to avoid a node wrapper class.

  • Go back to the previous behavior in the address bar

    Just upgraded to Firefox 31.2 and I find that the new behavior of the address bar is in conflict with how I work. I often copy / paste URL, I type directly into the address bar, I use a current to go to about.config tab and none of these work. I found a reference to the evolution of the gfx.xrender.enabled false, but this did not help. Clues on how to revert to the old behavior?

    It's about: config with a colon...

  • Behavior of the filter action "stop filter execution.

    What is the intended behavior of the filter action "stop filter execution"? I can't find any recent documentation on this issue. When part of the filters manually execution, "Stop filter execution" is intended to stop all other filters for all messages if the filter that contains both matches? This seems to be the behavior for me. When included in the first several filters filter, only the first filter matches and the log only shows instances of correspondence of the first filter, although several other subsequent filters must correspond to several messages that don't match not the first filter.

    I appreciate the functionality of Thunderbird filters, but I try to find a solution to implement more complex logical Boolean to move messages from my Inbox with the help of manually run filters. I have several filters put in place to classify the messages, but I want to implement filters such that they are not applied to tracked messages. Currently I have the logic in most filters do not match a favorite message using the option 'Match all the following', however this prevents the use of the logic of the GOLD in the filter and led to an increase in the number of filters. I want to set up the filters as a first filter messages from games played and prevents other filters running only for messages that match the filter first.

    Maybe the behavior I see is a bug specific to my system, but I would like to get a confirmation on the expected behavior and see if others have encountered this problem. I work under the assumption that the behavior of "Stop filter execution" must stop subsequent treatment only for messages on which a filter containing is as indicated in the old post to https://groups.google.com/forum/#! topic/mozilla.feedback.thunderbird.prerelease/rUXaQ0NdZvM, but this assumption may be wrong.

    Any help or suggestions are appreciated.

    OK, it seems that this is a bug documented, for example to https://bugzilla.mozilla.org/show_bug.cgi?id=552936. I should have searched for bug reports before posting here. I follow things with bug reports. Thank you.

  • Why the nodes are placed on web sites that I discovered with fire fox but not other browsers

    When you view the web page with fire fox is someone changing words and inserting nodes on the site. This does not happen with chrome or explorer. When I inspect the element it is HTML not allowed more written on the site. I have remove the node (a commercial that redirects the browser), but they pop up.

    You can check the suspicious extensions or recently installed unknowns.

    Make a check of malware with several malware scanning of programs on the Windows computer.
    Please scan with all programs, because each program detects a different malicious program.
    All of these programs have free versions.

    Make sure that you update each program to get the latest version of their databases before scanning.

    Alternatively, you can write a check for an infection rootkit TDSSKiller.

    See also:

  • I get a strange behavior of the bar tabs and the address bar in Firefox 29,0 for Mac.

    I just installed Firefox 29,0 for Mac.
    I have a strange behavior of the bar tabs and the address bar with this new version.
    Instead of the address bar, I get two rows of symbols. And it is impossible to write anything in the address bar.
    (I add a screenshot, but I can't find a way to do it).

    Firefox has an RSS icon in the palette of the toolbar that you can drag a toolbar (but not on the location bar container).

    • Firefox menu button > Options/Preferences > toolbars
    • View > toolbars > customize
  • FF13 different behavior on the two machines home page

    FF gives different results than "Home Page" on both machines.

    On the desktop, I get my set (the former google/firefox one) homepage.

    On laptop, I have two tabs, the first of about: at home, the second is my fixed home page (the same old google/firefox one).

    On the desktop when I press home, page becomes whole-home page.

    On laptop when I press home, new tab is launched to give me my whole-home page.

    The behavior on the desktop is what I expect and what I want. Which continues with Notepad and how do I do the same thing as the Office?

    Check your settings on the laptop home page, you have inadvertently defined two pages as your home page...

    See - How to set the home page

Maybe you are looking for