How can I get g-leaflet map to show immediately and without having to resize the window? - gwt

I have a problem with g-leaflet - it shows as a grey rectangle only (with a bit of the map at top left) until I resize the window (manually). Then it shows up. Sometimes parts of maps show when I hover over an area but this too is incomplete and problematic. Here:
The code that I use to add the G-Leaflet map to my GXT VerticalContainer (com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer) is as follows, taken from G-Leaflet example:
LeafletDrawResourceInjector.ensureInjected();
final MapWidget mapWidget = new MapWidget();
mapWidget.setSize("1000px", "750px"); // I added this myself to try to fix the issue
myVerticalLayout.add(mapWidget);
(I also set the size of the "myVerticalLayout" container).
Please help!

Leaflet is really finicky. Scheduling a defferred call to invalidateSize() was not enough. Had to make my own JavaScript call to its invalidateSize using setTimeout, also making sure that all the containers are attached before this happens. Only hen it would show.

Related

open image instead of popup : leaflet

I am working with leaflet api.I can draw rectangles and polygons.I have bound the popup with every rectangle and polygon.When i click on drawn shape, popup opens(leaflet functionality).Popup contains some html(image).
As i am working on a demo application, i am wiling to try the fancebox plugin.
Means, when i click on drawn shape, instead of popup, i want to open up that image using fancybox.
Can i do that using simple method like using another function instead of .bindpopup.
Working Script (image loaded using fance box when we click on popup)
e.layer.bindPopup("<a class='fancybox' rel='group' href=''><img /></a>");
I can understand there must be some other javascript function to do it.
If there is some way to do it please let me know, as i am new to leaflet didn't have enough mental power to understand it yet but i hope i will....
Thanks for your time :)
I would just do e.layer.on('click', function() { //do fancybox init, perhaps like $(body).append("<a class='fancybox' rel='group' href=''><img /></a>")})
Although it makes a lot more performance sense to bind that event on the L.FeatureGroup holding all the shapes instead of one by one.

resize jPanel on VLCJ fullscreen for controlsPanel

I am using netbeans to create a media player using vlcj-3.8.0.jar.Here is the source code for netbeans users,vlcj gui netbeans based just unzip and open project in netbeans(contains playlist, volume, plays in canvas)I know placing the whole code violates the SSCCE standards but it might be informative for others. Another reason is that if you are a netbeans user then running the code and finding the problem is very easy for you, u wont need to search the entire code. So my problem, all works fine but i am having problem when i toggle the fullscreen. The controlsPanel as you can see in the picture below wont resize and i dont how how to do it. I tried to put the panel in border layout but it messes everything inside it(i have jslider and jlabels inside it).
http://postimg.org/image/kcxuwgjgx/
Here is a code to toggle on and off for fullscreen, where
jPanel2: is in border layout that has canvas inside it,
controlsPanel: panel in absolute layout that has jslider and jlabels has properties i set through netbeans as horizonal size and vertical size as default, horizontal resizable as ticked
private void toggle_fullscreenMouseClicked(java.awt.event.MouseEvent evt) {
if(fullscreen_check==1){
controlPanel.setVisible(true);
titlePanel.setVisible(false);
mediaPlayer.setFullScreen(true);
//at fullscreen the controlPanel should be resized horizontally to the end of the screen
controlPanel.setPreferredSize((new Dimension(1200,100)));
controlPanel.setSize((new Dimension(1200,100)));
controlPanel.revalidate();
//here is the problem:controlPanel stays the same...why??
fullscreen_check=0;
}
else{
mediaPlayer.setFullScreen(false);
Dimension ss = new Dimension (10,10);
jPanel2.setPreferredSize(ss);
jPanel2.setSize(ss);
jPanel2.revalidate();
fullscreen_check=1;
}
} `
I tried to use the code:
controlPanel.setPrefferedSize((new Dimension(1200,900);
controlPanel.revalidate();
//OR:
controlPanel.setSize((new Dimension(1200,900);
controlPanel.revalidate();
but it wont work...any help or idea will be greatly appreciated!! If any of you guys tried my code and make the controlsPanel to be resized to full screen, i will be very grateful!!

RGraph: What is causing my pie chart to disappear on-click? (#rgraph)

I'm using the new RGraph beta release, and I can't figure out why this pie chart disappears when you click elsewhere on the page. Here is a screen cast of it happening: http://screencast.com/t/zPRhMqnCKk8.
self.pieChart = new RGraph.Pie('pie_'+self.id,progress)
.Set('shadow', true)
.Set('shadow.color', '#aaa')
.Set('labels',[]) // No labels
.Set('centerx', 50)
.Set('center50', Math.round(h/2))
.Set('radius',Math.round(h/2)-5)
.Set('key',labels)
.Set('key.position.gutter.boxed',false)
.Set('key.position.graph.boxed',false)
.Set('key.position.x',w-140)
.Set('key.position.y',5)
.Set('key.color.shape','circle')
.Set('text.size',8)
.Set('text.color','#555')
.Draw();
I have other charts on the page, and none of them do this. Maybe there is a way to disable click event listeners via Set()?
UPDATE
Richard, the author of RGraph, explained the issue perfectly in his comment. After removing RGraph.common.dynamic.js, my issue was resolved. However, if you need to use dynamic features, this solution may not work for you.
Looks like the Pie chart is being removed from the RGraph ObjectRegistry - which is where objects are held so that they can be redrawn when necessary.
If you don't use dynamic feature you could try excluding RGraph.common.dynamic.js and redraws won't happen when the page is clicked.

Google Maps APi for iOS: UIActivityView on custom info window

I'm trying to put a spinner inside a custom info window that appears when the user presses a marker. I have a custom view for the window that has lots of subviews that show up fine. But when I try to add a UIActivityView or an animated PNG sequence, that doesn't show. Has anyone else experienced this?
The documentation on the mapView:markerInfoWindow: method says:
If you change this view after this method is called, those changes
will not necessarily be reflected in the rendered version.
It seems likely that the Google map is not showing the actual UIView you return, but a screenshot of it taken when the info window is returned by the delegate.
As mentioned in this answer, this is made explicit in the Android documentation - it seems likely that the Android and iOS SDKs work similarly.
If you've changed the view I'm not sure if there is a way to force the SDK to take a new screenshot of it. Possibly you could try setting the map's selected marker to nil and then back to your marker, to see if it then calls mapView:markerInfoWindow: again - although it might also re-centre the marker on the map when you do that. It also likely wouldn't be very efficient.
You can call mapView:markerInfoWindow: then inside the method you can create a UIView which you can add different controls on that UIView including the spinner. You can also specify on which location you would like to put the defined control.

C, GTK: window stops updating

I'm developing an application that periodically draws images on a GTK Drawing Area inside a window.
The rendering first works well and the window content gets repainted if I drag another window over the drawing one, but after some random amount of time (some seconds), the window stops updating itself.
New images dont get displayed, and if I then drag another window over the rendering one I get this:
When I click one of the checkboxes below my drawing area, the window gets refreshed and the problem is gone for another few seconds.
Any idea what could make the GTK threads stop updating the window content?
I dont know which part of my code is of interest to answer that question, so I pasted the mostly full version here.
My GTK-main() is called like this:
void window_main()
{
pthread_create(&drawing_thread, NULL, img_draw, NULL);
gtk_main();
gdk_threads_leave();
}
Thanks for any hints! :)
Found the solution: in the original example code I used (here) they use a g_timeout_add() to register their periodic drawing function.
The g_timeout_add()-registered function is run by gtk_main(), which means it is protected internally by gdk_threads_enter() and gdk_threads_leave(). That's the point I was not aware of.
Surrounded my call to gtk_widget_queue_draw_area() with these two functions and the bug is gone 8)