JavaFX Notification with ControlsFX - notifications

I am doing Stocks market app, I need to display Order status changes to user. I came across ControlsFX Notification. From doc example, it looks like we can only specify simple text for it's content.
Notifications.create()
.title("Title")
.text("Hello Notification")
.darkStyle()
.show();
Is there a way to specify content Node, eg: TableView? As I would like to group a bunch of messages together, present in TableView / ListView, then show in single notification.
If not achievable with ControlsFX, any other recommendation? Thanks!

You can set a Node to display unsing graphic.
Notifications.create()
.darkStyle()
.title("Title")
.graphic(new Rectangle(600, 400, Color.RED)) // sets node to display
.hideAfter(Duration.seconds(10))
.show();

Related

Left align some rows, right align others in WKInterfaceTable?

I'm trying to display a user's messages in a watchOS app and I'm using a WKInterfaceTable instance to do so.
I would like outgoing messages to be right-aligned and incoming messages to be left-aligned but I can't get it to work. Here is the code I'm using:
let row = mainTable.rowController(at: index) as! MessagesViewTableRowController
row.rowLabel.setText(messageText!)
row.rowLabel.setSemanticContentAttribute(.forceLeftToRight)
if outgoing == 1 {
row.rowLabel.setSemanticContentAttribute(.forceRightToLeft)
}
The line that sets the semantic to right is being executed but it's having no effect on the alignment of the row. Everything is remaining left-aligned.
I figured it out.
The label needed its width to be set to "Relative to Container" with a value of 1. After setting that in the storyboard, my code is working.

videojs: How to get actual text of subtitle on 'cuechange'

I'm using videojs with some of the following code:
player.addRemoteTextTrack({ src: 'http://[somepath/to/vtt]' })
(I've verified that the Network tab in chrome shows a request to the VTT file and it's sound.)
And then:
const textTrack = player.textTracks()[0]
textTrack.addEventListener('cuechange', () => {
const activeCue = textTrack.activeCues[0]
console.log(activeCue.text, activeCue.startTime, activeCue.endTime)
})
The cuechange fires during playback, but the text attribute doesn't contain the actual subtitle text, but instead looks like the source of the .m3u8 file. The startTime and endTime of the cue seem to be correct though.
I think I'm missing something, but I'm trying to get the actual text of the triggered subtitle cue, but instead looks like this:
{"bandwidth":296728,"resolution":{"width":640,"height":268},"codecs":"avc1.42c015,mp4a.40.2","byteLength":319224,"uri":"https://...... (and so on)
Ok. Hopefully this will help someone else. It's a little confusing, but seems to be what's happening.
After I addRemoteTextTrack(), player.textTracks().length becomes 2.
One of those is of kind=metadata
The other is of kind=subtitles (the one I explicitly added)
I was listening on the kind=metadata cuechange assuming the remotely added track was the only one in the tracklist, and it fires off at the correct time in the video, even without me loading the remote text track. I think this means the stream I'm loading has some kind of metadata track for cue points embedded.
When I do add the remote track, trying to listen on the kind=subtitle track doesn't seem to fire off the cuechange event however, but I think this is because of videojs track precedence. Neither of the tracks had mode=showing, so cuechange events only fired on the one with precedence (first item in the tracklist array... the metadata one).
The solution is to simply add mode=showing to the track that I explicitly add to give it precedence:
player.addRemoteTextTrack({
src: 'http://[somepath/to/vtt]',
mode: 'showing'
})
This now allows me to listen on the tracklist item where kind=subtitle and get the actual text

Drupal 7 - Print PDF and Panelizer

Hi guys ,
I'm currently working on a Drupal project which use the Panelizer module by overriding the default node display. The panel for this content type is made width a lot of rules and specifications in order to display some specific content (like views) according some fields.
Now I need to print in PDF the same content that is displayed by the panelizer module but in another display (in one column ), so I cloned the display I use and rearranged it to display what I want.Then I want to use this display width the print module but I didn't managed to do that.
Any idea how can I do that ?
I just can't use the default node render, because I would miss some informations dues to the specifications used in the panel, and I can't print the panelized content because it's not the same display.
I read this thread but how can I say to the print module to use the "print" display I cloned instead of the default one ?
Any suggestions or ideas will be appreciated or if you have another idea for doing that you're welcome :)
Thank you !
In your print pdf template you can load the node then create a view with the display and finally render it : drupal_render(node_view(node_load($node->nid), "name of your display")) ;
Another way is to alter node entity info, telling that 'print' view can be panelized, i.e.
/**
* Implements hook_entity_info_alter().
*/
function mymodule_entity_info_alter(&$entity_info) {
$entity_info['node']['view modes']['print']['custom settings'] = TRUE;
...
}
After that, you go to panelizer settings of your content type(s), and set whatever you want for the print view mode

Multiple message in load mask in sencha touch

I just want to show different messages.
Ext.Viewport.setMasked({
xtype: 'loadmask',
message: 'Downloading data. Please wait...'
});
When I download data from server I gave call to different functions.
Depending on function I want to change the message.
Please provide guide line or working code.
I have used
Ext.Viewport.unmask();
in every function and reset the message in that function.. but showing same message.
Very simple. Just get the Viewport loading mask, and update the message. Here is an example, once you set the loading mask and now want to change the text (or even other properties):
Ext.Viewport.getMasked().setMessage('This is a new message.');
var loadMask = Ext.getCmp('your view id which you want to use');
loadMask.setMessage(Get the message Dynamically or static);

Titanium get current view on scrollableView and add an item

I have a scrollableView with several views inside and I'd like to add item to some of these view if they meet a certain criteria, like if they have data attached or not. Also I'm using Alloy, here's my markup
<ScrollableView id="scrollableView">
<View id="view" class='coolView'></View>
...
</ScrollableView>
To know if there are data attached I check the currentPage attribute like so:
function updateCurrentView(e) {
currentView = e.currentPage;
}
But I have no idea how to add an item to the current View.
Edit: To add some clarification, I have a label which when clicked allow me to choose two currencies, when chosen these currency pairs are saved in the database and should be displayed instead of the label. So my guess was to check whether the current view has currency pair saved.
There are 2 things to take care of here:
1.Whenever a currency is selected,immediately label on that particular view will change.
2.Whenever the scrollableView is loaded,it must always refer to the database if a currency is selected.
First one can be done as:
1.Get the instance of scrollableView using the getView method of alloy controller.Pass the id of the scrollableView to it.Lets call it myScrollableView.Refer this for more info.
http://docs.appcelerator.com/titanium/latest/#!/api/Alloy.Controller
2.Use var currentView=myScrollableView.getCurrentPage() to the get the current page which will be a number.
3.Now use the scrollableView instance to get all the views.
var viewArray=myScrollableView.getViews();
4.viewArray[currentView] will give you the view of current page.After you have got the view you can change the desired label using:
viewArray[currentView].children[positionOfTheView]
The "positionOfTheView" can be obtained by printing the viewArray[i].children array using Ti.API.info.
Second thing can be accomplished as follows:
1.Get the instance of scrollableView using the getView method of alloy controller.Pass the id of the scrollableView to it.Lets call it myScrollableView.Refer this for more info.
http://docs.appcelerator.com/titanium/latest/#!/api/Alloy.Controller
2.Now use the scrollableView instance to get all the views.
var viewArray=myScrollableView.getViews();
3.This is a JavaScript array of all the views in the scrollableView. Now iterate through this array and according to the data in the database,change the concerned view using:
viewArray[i].children[positionOfTheView]
The "positionOfTheView" can be obtained by printing the viewArray[i].children array using Ti.API.info.