how can I manage a scatterChar in the javaFX from scene builder? - javafx-8

I know how to manage the scatter chart inside the start method, but I want to use a fxml file containing a scatter chart and then I want to use a controller to control that. I used Scenebuilder for this purpose, but I don't know how I can add category axis to the scatterChar, I found the numeric Axis, but I didn't see any category axis to add.There is a horizontal category axis in the scene builder that is with the scatter chart, but I don't know, how I can add some values to it. Is that possible inside the scene builder, or I must do it in the controller?

Code based solution
Select your scatter chart in SceneBuilder.
In the Code panel for the scatter chart, type the fx:id you want to assign (e.g. scatterChart).
In your controller inject the scatter chart reference:
#FXML ScatterChart scatterChart;
In the initialize() method for your controller add your categories.
CategoryAxis xAxis = (CategoryAxis) scatterChart.getXAxis();
xAxis.getCategories().setAll(
"UFO sightings",
"Paranormal Events",
"Inexplicable Tweets"
);
If you need to pass data into your controller to plot inside your chart, select a method from:
Passing Parameters JavaFX FXML
Alternate partial FXML based solution
Although you cannot add the categories to the chart via the SceneBuilder UI, you can hand edit the FXML file load the edited file up in SceneBuilder (which will parse the file fine and display the categories and will preserve your hand-edits when you save the file in SceneBuilder).
Instead of adding the categories in code in the initialize() as defined in step 4, edit your FXML file manually and add the categories. Here is a sample:
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.String?>
<?import javafx.collections.FXCollections?>
<?import javafx.scene.chart.CategoryAxis?>
<?import javafx.scene.chart.NumberAxis?>
<?import javafx.scene.chart.ScatterChart?>
<ScatterChart fx:id="scatterChart" title="Concerning Events" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1">
<xAxis>
<CategoryAxis side="BOTTOM">
<categories>
<FXCollections fx:factory="observableArrayList">
<String fx:value="UFO Sightings" />
<String fx:value="Paranormal Activity" />
<String fx:value="Inexplicable Tweets" />
</FXCollections>
</categories>
</CategoryAxis>
</xAxis>
<yAxis>
<NumberAxis side="LEFT" />
</yAxis>
</ScatterChart>
You can't repopulate the chart with actual data using FXML (but it is highly unlikely that would want to do that anyway).

Related

UI5 set a table content density/margins independent of the rest of UI style

In UI5 there are several pre-defined density / margins modes.
Can I set for a table a compact content density (sapUiSizeCompact), while the rest of UI should continue to use sapUiSizeCozy? In the list of sap.m.Table properties I can't find something like class/style.
.addStyleClass should work for every control. I've tested class in XML and it works too.
XML:
<Table class = "sapUiSizeCompact" />
JS:
this.byId("myTable").addStyleClass("sapUiSizeCompact");

Tableau not loading custom color palette

I have edited Preferences.tps file from my tableau repository to add following code -
<?xml version='1.0'?>
<workbook>
<preferences>
<color-palette name="My Custom Palette" type="regular">
<color>#75787B</color>
<color>#A7A8AA</color>
<color>#BBBCBC</color>
<color>#B7C9D3</color>
<color>#C6BCD0</color>
<color>#E4D77E</color>
<color>#D9C89E</color>
</color-palette>
</preferences>
</workbook>
Upon restarting the Tableau, I still can't see my color pallet in there. I tried searching online for possible solutions and have even replaced the code with custom codes available online. No luck though!
For continuous/ordered data, the type of the color palette would need to be "ordered-sequential" or "ordered-diverging".
See the link below for more info about creating a custom palette and with examples of various types.
https://onlinehelp.tableau.com/current/pro/desktop/en-us/formatting_create_custom_colors.html
For example:
<?xml version='1.0'?>
<workbook>
<preferences>
<color-palette name="My Custom Palette" type="ordered-diverging">
<color>#75787B</color>
<color>#A7A8AA</color>
<color>#BBBCBC</color>
<color>#B7C9D3</color>
<color>#C6BCD0</color>
<color>#E4D77E</color>
<color>#D9C89E</color>
</color-palette>
</preferences>
</workbook>
Ordered-diverging above produces:
If there are multiple versions of Tableau installed, try testing the custom colors on default one. it works.

Display name of component when editing

How do I display the name/title of the component to the editor/author, so they can see which component they're editing?
Ensure your component has a "_cq_editConfig.xml" file, which contains the following:
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
cq:actions="[text:Your Component Name,-,edit,delete,copymove,-,insert]"
cq:dialogMode="floating"
jcr:primaryType="cq:EditConfig">
</jcr:root>
Notice in the cq:actions property, you can enter a name for your component.
In _cq_editConfig.xml file, cq:actions property can be used to give component name and other buttons options.
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
cq:actions="[text:[Component Name],editannonate,-,copymove,delete,-,insert]"
cq:dialogMode="floating"
cq:disableTargeting="{Boolean}true"
cq:inherit="{Boolean}true"
cq:layout="editbar"
jcr:primaryType="cq:EditConfig"/>
Also, If you want to disable right click behavior on component and show an edit bar, use property cq:layout="editbar"
Actions sequence can be changed. Actions are separated by comma (,). For a separator between actions use "-".

Creating a working copy for Plone 4 custom content types

I have created a custom Plone content type in my package i.e. my.product.
I am in need of integrating a working copy support: so that a "published" document (in my case, a published content type) stays online while it is being edited. Basically, I want to take advantage of 'Working Copy Support (Iterate)' provided by plone.app.iterate to achieve what is explained here. This will provide me with ability to check-in/check-out my changes.
Is this possible in Plone 4 with custom content types using Archetypes? How would one go about it if yes?
I added the following two files inside my.product/my/product/profiles/default folder and it appears to work:
diff_tool.xml
<?xml version="1.0"?>
<object>
<difftypes>
<type portal_type="MyCustomType">
<field name="any" difftype="Compound Diff for AT types"/>
</type>
</difftypes>
</object>
repositorytool.xml
<?xml version="1.0"?>
<repositorytool>
<policymap>
<type name="MyCustomType">
<policy name="at_edit_autoversion"/>
<policy name="version_on_revert"/>
</type>
</policymap>
</repositorytool>
I have never used plone.app.iterate, but this is the generic approach how to solve the problem.
Actions are installed by plone.app.iterate GenericSetup profile. You can see actions here:
https://github.com/plone/plone.app.iterate/blob/master/plone/app/iterate/profiles/default/actions.xml
Pay note to the line *available_expr* which tells when to show the action or not. It points to helper view with the conditition.
The view is defined here
https://github.com/plone/plone.app.iterate/blob/master/plone/app/iterate/browser/configure.zcml#L7
The checks that are performed for the content item if it's archiveable
https://github.com/plone/plone.app.iterate/blob/master/plone/app/iterate/browser/control.py#L47
Most likely the failure comes from if not interfaces.IIterateAware.providedBy condition. Your custom contennt must declare this interface. However, you can confirm this putting a pdb breakpoint in checkin_allowed(self) and step it though line-by-line and see what happens with your content type.

How to invoke a "loose Xaml"-defined activity from another "loose Xaml"-defined activity?

I have two "loose" XAML files, each declarativly defining composite activity which is composed of some custom (compiled) code-activities.
Now, I would like the activity defined in the 1st "loose" Xaml to 'contain' the activity defined in the 2nd "loose" Xaml as of its steps.
However, I have no clue how to 'glue' both activities together such that 1st activity will know to correctly load the activity from the 2nd Xaml.
So when calling:
XamlXmlReader xr = new XamlXmlReader(#"FirstLooseActivity.xaml");
ActivityBuilder ab = (ActivityBuilder)XamlServices.Load(ActivityXamlServices.CreateBuilderReader(xr));
I end up with a XamlObjectWriterException (after I loaded all relevant assemblies to my hosting app):
Cannot create unknown type '{clr-namespace:SecondLooseActivity}MyActivity
Since there is no Xlink support in MS, is there a way to do this at all?
If not, what are my alternatives?
I had the exact same issue and found a solution.
Here's what my XAML looked like this:
<Activity ... xmlns:mylib="clr-namespace:MyProject.ActivityLibrary">
<mylib:MyCustomActivity ... />
</Activity>
The trick that worked for me was to specify the assembly containing my custom activity in the namespace.
Changing the namespace to this made it work:
xmlns:mylib="clr-namespace:MyProject.ActivityLibrary;assembly=MyProject.ActivityLibrary"