Keep node selection from spreading to PropertySheet - netbeans

I'm developing an application based on the netbeans platform.
The problem I'm having is this; I have a TopComponent that contains two panels, A and B, each with a ExplorerManager. I have two BeanTreeViews in each panel with different sets of nodes. When I change selection in the A panel, the nodes in the B panel will be created. Now, I'd like to be able to select a node in the B panel and see it's properties in the default property view. But I still have a selected node in the A panel, and therefore the property view only says 'Multiple objects.' Is there any way to keep the selection in the A panel from spreading to the PropertyView?
I'd like to be able to use NodeActions on both sets of nodes, and therefore I've added
associateLookup(new ProxyLookup(
ExplorerUtils.createLookup(PanelA.getExlporerManager(), map),
ExplorerUtils.createLookup(PanelB.getExplorerManager(), map)
));
to the TopComponent if i only associate PanelA's ExplorerManager then this isn't a problem.

Ok some after testing around I found a solution that works for me. Perhaps I was a bit quick to post this question. Anyway;
In the TopComponent I did
associateLookup(new ProxyLookup(
ExplorerUtils.createLookup(PanelA.getExlporerManager(), map)
));
Then only the Nodes in PanelA will be spread to the PropertyView. And then to get the NodeActions to work in PanelB, I made it implement Lookup.Provider, and created it's Lookup with
lookup = ExplorerUtils.createLookup(explorerManager, map);

Related

Bar Chart and Stacked Bar Chart using similar data on one page

I am trying to show some data in a bar chart and stacked bar chart using JavaFx. I am using 4 series into which I populate the data, using eclipse oxygen.
I use series1 and series2 in the Bar Chart.
I use series1, series2, series3, and series4 in the Stacked Bar Chart.
I have created my screen using the JavaFx Scene Builder. Populate the scenes and displaying the data. My problem is that I am not able to show both the graphs at the same time. Only the latter gets populated, depending on the order of the population. The extra bit I have added is that the graphs expand on a mouse enter event and then reduces to the orginal size on the mouse exit event.
Can anyone help me by pointing out what I am doing wrong?
My code is as follows
#FXML
private void bcsbg_mouseentered() {
if (!clickEntered) {
clickEntered = true;
prefWidth = bcByGroup.getPrefWidth();
prefHeight = bcByGroup.getPrefHeight();
bcByGroup.setPrefSize(1500, 900);
gXAxis.setPrefHeight(Region.USE_COMPUTED_SIZE);
gXAxis.setPrefWidth(Region.USE_COMPUTED_SIZE);
gYAxis.setPrefHeight(Region.USE_COMPUTED_SIZE);
gYAxis.setPrefWidth(Region.USE_COMPUTED_SIZE);
gXAxis.setVisible(true);
gYAxis.setVisible(true);
gXAxis.setLabel("Value");
gYAxis.setLabel("Question");
gXAxis.setTickLabelsVisible(true);
gYAxis.setTickLabelsVisible(true);
gXAxis.setTickMarkVisible(true);
gYAxis.setTickMarkVisible(true);
sbcByAll.setVisible(false);
} else {
clickEntered = false;
bcByGroup.setPrefSize(prefWidth, prefHeight);
gXAxis.setPrefHeight(0);
gXAxis.setPrefWidth(0);
gYAxis.setPrefHeight(0);
gYAxis.setPrefWidth(0);
gXAxis.setVisible(false);
gYAxis.setVisible(false);
gXAxis.setLabel("");
gYAxis.setLabel("");
gXAxis.setTickLabelsVisible(false);
gYAxis.setTickLabelsVisible(false);
gXAxis.setTickMarkVisible(false);
gYAxis.setTickMarkVisible(false);
sbcByAll.setVisible(true);
sbcByAll.getData().clear();
sbcByAll.getData().addAll(series1, series2, series3, series4);
}
bcByGroup.getData().clear();
bcByGroup.getData().addAll(series1, series2);
}
The problem here is not in your code, but in the way the chart API is written. (I'm not normally a fan of criticizing languages or standard libraries, but parts of this API appear to have been written by an unsupervised intern with a particularly bad hangover.)
The XYChart.Data class keeps a reference to the node that displays the data. (This fairly obviously violates the most basic tenets of MVC, and makes separating the data into a different class completely redundant.)
Consequently, if you try to use the same data in two charts, the same node tries to appear in two parents, which is not allowed, and you only see the visualization of the data in one place. Unfortunately, you need to replicate the data for each chart.
Thank you, Dave. You are right. I did not go through the standard documentation on the XYData.Chart to notice that this object would be attached to the node in which the data was going to be displayed.
I was really hoping to avoid replication but the code does work as soon as the data series is replicated and attached to the different charts.
As mentioned by Dave,
The XYChart.Data class keeps a reference to the node that displays the data. (This fairly obviously violates the most basic tenets of MVC, and makes separating the data into a different class completely redundant.)
Please go through the standard documentation provided in Dave's link.

javafx8 scenebuilder menu shows controls labeled for container object

When I place JavaFX object inside a container, for example some checkboxes inside an hbox:
The scenebuilder controls for each checkbox show the container object in the menu (and different settings are shown here depending on the actual container):
But changing the "margin" value here, for example, clearly affects the individual checkbox and not the HBox. For example, setting only the middle checkbox to have a left margin of 20 yields a change to only the middle checkbox:
So why is that menu area labeled with the container name? I fear I am missing some fundamental design aspect by not understanding this.
They are properties of the control that are specifically available when its parent is an HBox. They correspond to the static methods HBox.setXXX(node, value), e.g. HBox.setHgrow(...).
If you put the check box in an AnchorPane instead, for example, you would see "Anchor Pane Constraints" instead of "HBox Constraints" and you would have options including "TopAnchor", "LeftAnchor" etc., corresponding to the static AnchorPane.setXXX(node, value) methods.

Bokeh - How to use box tool without default selections?

I have built a bokeh app that allows users to select windows in data and run python code to find and label (with markers) extreme values within these limits. For ease of interaction, I use the box select tool for the range selection. My problem arises when repeating this process for subsequent cases. After markers are placed for the results, they are rendered invisible by setting alpha to zero and another case needs to be chosen. When the new select box includes previous markers, they become visible based on the selection. How do I override this default behavior? Can markers be made unselectable? or can I add code to the customJS to hide them after they are selected?
Thanks in advance for any help!
There are a few possible approaches. If you just want non-selected glyphs to "disappear" visually, you can set a policy to do that as described here:
http://docs.bokeh.org/en/latest/docs/user_guide/styling.html#selected-and-unselected-glyphs
Basically, for bokeh.plotting, pass
nonselection_fill_alpha=0.0,
nonselection_line_alpha=0.0,
as arguments to your plot.circle call or whatever. Or if you are using the low level bokeh.models interface, something like:
renderer.nonselection_glyph = Circle(fill_alpha=0.0, line_alpha=0.0)
But be aware (I think you already are) that the invisible markers are still there, and still selectable if the user happens to draw a box over them with the selection tool.
If you truly want only a subset of the data to be visible and selectable after a selection, I'd say you want to replace the data in the column data source wholesale with the subset in your selection callback.

SAPUI5 VizFrame: How to get the selected data points

I used a VizFrame to display data in my project.
The normal behaviour of the VizFrame when you select data in the graph you see a popover with the data of the selected point. When you select more than one point the content of the popover is something like in the screenshot: popover content.
I tried using attaching myself to the SelectedData Event. The oControlEvent.mParameters contain the data nodes being currently selected for THAT event.
For example: I click node A => the node A is in the oControlEvent.mParameters. => OK
Then I click additionally on node B (so node A and B are selected) => only the node B is contained in the oControlEvent.mParameters. => not OK.
What I need is the set of all nodes that are currently selected in the graph, not just the one that triggered the event.
This information must be contained somewhere, as the Tooltip correctly shows "2 data nodes selected" after the user clicked B.
Thanks for your help.
the oControlEvent.mParameters.data, or oControlEvent.getParameter('data') will (correctly) only contain the elements that actually triggered the event. (may be more than one data point if you select several data points in one go by dragging a rectangular area over the data points)
if you need all currently selected data points, use oControlEvent.getSource().vizSelection() (here, getSource() will return the vizFrame)
Cheers, iPirat

How to set a selection in the GWT CellBrowser

somehow I have the feeling that I miss the forest for the trees. I have a CellBrowser filled with categorys and I have a search dialog to find the categorys by name. If I now select a category in the search dialog I also want it to be selected in the CellBrowser.
What I can already do is, find the node in the category tree. I also have the path from the root node to the leaf. I can open the nodes until the selected leaf (getCellBrowser().getRootTreeNode().setChildOpen(i, true). But how do I select the leaf itself?
And frankly speaking, is that the right way to do it? (I doubt it somehow)
Greetings Ole
Selecting an Object in the CellWidgets can be done by via the SelectionModel.
Assuming that you have defined a SelectionModel (i.e. SingleSelectionModel) for your CellBrowser/TreeViewModel you can just select a node in a CellBrowser by calling:
selectionModel.setSelected(MyObject, true);
MyObject is the object/type which is displayed as a node in your CellBrowser.
Note you can have different types/objects for each CellBrowser level.
SelectionModel will use either a KeyProvider or the equals function to select the object.