Is there a way to create a BarChart (in the background) without adding it to the current view? I basically have a chart that I need to convert to an image and add it to a PDF report (using AlivePDF).
No, you must add the the chart to the display list.
A DisplayObject must be added to the display list in order to be able to render out as a Bitmap (i.e. to print it or to send it to a PDF).
Internally AlivePDF uses the BitmapData.draw(...); method which requires the object to be on the display list and have visible=true in order to be rendered out.
If you don't want the chart to appear on the stage whilst you are generating your PDF (or printing) then you can add the chart to a parent container and hide the parent instead.
Here is an example of how you can do that:
var box:VBox = new VBox();
// Hide the parent, not the chart.
// If you set chart.visible = false then it won't show up in the PDF.
box.visible = false;
box.addChild(chart);
addChild(box);
// You might need to force validation here so the chart has the correct size.
box.validateNow();
// Add chart to PDF.
pdf.addImage(chart);
// TODO: Clean up your display items here.
box.removeChild(chart);
removeChild(box);
box = null;
Related
ControlsFX has an awesome control called NotificationPane, which can easily be use like so
NotificationPane np = new NotificationPane();
np.setText("What to be displayed here");
What I am wondering, is it possible to extends it in such a way that, instead of it displaying text to display a Node.
You don't need to extends it. Just use the constructor that accepts a node.
http://controlsfx.bitbucket.org/org/controlsfx/control/NotificationPane.html#NotificationPane-javafx.scene.Node-
The Node that NotificationPane accepts in the constructor is actually the content pane OVER which the notification appears, not the content of the notification itself.
There is however a way to achieve what you asked. From the JavaDocs:
The graphic property represents the Node to show within the popup
notification bar that appears on top of the content that is within the
NotificationPane. Despite the term 'graphic', this can be an
arbitrarily complex scenegraph in its own right.
This means that you can indeed put complex Nodes (even whole trees) inside the notification. As long as the Text/Action properties are null, it will occupy all available space (or up to the preferred/max sizes of the node itself), leaving space for the closing button.
I am doing a project in javafx in which we create forms ( forms like admission form etc)
Form contains many labels,textfields (filled with data from database) and some images.
I want to print these labels, data from textfields and the images in the same layout in which they were created ( I mean, after printing textfield1 should not be in front of label2 etc).
Is is possible? or is it possible to convert this form to pdf file so that it could be printed later?
Thanks.
It is possible to take a snapshot of the Scene:
Scene scene;
WritableImage image = scene.snapshot(null);
And then you can save this image in an image format:
http://java-buddy.blogspot.com/2012/12/save-writableimage-to-file.html
I am using RowEditor plugin for my grid. Grid record has three buttons: choose,update,cancel. When I click on choose it will display another grid and user has to click on one record, then some values of that record have to display on the previous grid. How to do this ?
I am using extjs 3.0
Thanks in advance!
When you click on choose - show a modal window popup with grid. When you open that popup pass a callback into constructor of the popup. Then force user to select only one record in grid (using rowselectmodel). On itemclick even of the child grid - call your callback and pass selected data in the parent grid. Update parent's grid record with this data.
Hope I was clear.
To figure out which row the user selected, use the Ext.grid.GridPanel's SelectionModel. The default model is Ext.grid.RowSelectionModel (use selModel config setting to change the default). To grab the selected row, call myGridPanel.getSelectionModel().getSelected(). That will return an Ext.data.Record. Dig into that data to populate the original grid/store.
Thanks for your reply. I have done the required things.
How I have done is, just passed the editor to my function and using selection model, I got the values and have placed them into the editor.
val1 = selectedArray[0].get('val1');
var cm = grid.colModel, fields = editor.items.items, f, val;
f = fields[1];
f.setValue(val1);
editor.values[f.id] = val;
This makes my life easier.
But, I have another problem, after placing into the editor. I have to do validation in the afteredit event, if user clicks the update button. In the afteredit event,
afteredit: function(object, changes, record, rowIndex)
{
// I have to do validation on the changes; but its an object. How will I do it
???
}
I have created one button component using one Bitmap and one Label in it.
Thing is that when user Clicks on on the button I want to changes button's Icon/Image and Label Text.
I want to do this using FlashCS5 and ActionScript-3.
I have tried following but it gives me runtime Error
[Bindable]
[Embed(source="/Images/test.png")]
var testIcon:Class;
testButton.setStyle("icon", testIcon);
Is there any other way of doing this.
Thanks.
You need to instantiate testIcon first. Try doing this:
[Embed(source="/Images/test.png")]
var testIcon:Class;
var btnGraphics:Bitmap = new testIcon();
testButton.setStyle("icon", btnGraphics);
Looking at what you want to archive i think you should follow following steps
1. Create one movie clip using new symbol
2. Create Two new Button Symbol using 2 different images and label
3. insert these button into the key frames for the created movie clip
you can use this movieClip to create new buttons that can have 2 states
just use gotoAndStop to display the proper button.
This is an answer for a followup that ppp asked:
There is a property labelPlacement="right|left|bottom|top" property. Default is right if you set it to bottom, the icon will show above the text.
You can create a button skin in flash and import them into flex. My experience with flex 3 skins imported from Flash is that it takes a bit of work and back and forth to get it working perfectly. Flash Catalyst for Flex 4 has greatly improved that workflow.
I have an AdvancedDataGrid. One of the columns in the grid displayed with help of custom render. During the application run, I set another custom render to the same column. When I scroll data in the grid (change values for the custom renders) they display new view correctly.
I want that they dispaly new view automatically (when I set them): so I think I have to call them and tell tham to refresh rgeir views. Any idea how to do this?
Use invalidateList()