@ -32,23 +32,14 @@ public class UpmShowPane extends BasicPane {
UpmShowPane ( ) {
UpmShowPane ( ) {
setLayout ( new BorderLayout ( ) ) ;
setLayout ( new BorderLayout ( ) ) ;
modernUIPane = ModernUIPaneFactory . modernUIPane Builder( )
modernUIPane = new ModernUIPane . Builder < > ( )
. prepareForV6 ( new ScriptContextAdapter ( ) {
. prepare ( new ScriptContextAdapter ( ) {
@Override
@Override
public void onScriptContextCreated ( ScriptContextEvent event ) {
public void onScriptContextCreated ( ScriptContextEvent event ) {
// 6.x
JSValue window = event . getBrowser ( ) . executeJavaScriptAndReturnValue ( "window" ) ;
JSValue window = event . getBrowser ( ) . executeJavaScriptAndReturnValue ( "window" ) ;
window . asObject ( ) . setProperty ( "PluginHelper" , UpmBridge . getBridge ( event . getBrowser ( ) ) ) ;
window . asObject ( ) . setProperty ( "PluginHelper" , UpmBridge . getBridge ( event . getBrowser ( ) ) ) ;
}
}
} )
} )
. prepareForV7 ( params - > {
// 7.x
JsObject window = params . frame ( ) . executeJavaScript ( "window" ) ;
if ( window ! = null ) {
window . putProperty ( "PluginHelper" , NewUpmBridge . getBridge ( window ) ) ;
}
return InjectJsCallback . Response . proceed ( ) ;
} )
. withURL ( UpmFinder . getMainResourcePath ( ) , UpmUtils . renderMap ( ) )
. withURL ( UpmFinder . getMainResourcePath ( ) , UpmUtils . renderMap ( ) )
. build ( ) ;
. build ( ) ;
EventDispatcher . listen ( DownloadEvent . UPDATE , new Listener < String > ( ) {
EventDispatcher . listen ( DownloadEvent . UPDATE , new Listener < String > ( ) {
@ -57,6 +48,12 @@ public class UpmShowPane extends BasicPane {
modernUIPane . redirect ( UpmFinder . getMainResourcePath ( ) , UpmUtils . renderMap ( ) ) ;
modernUIPane . redirect ( UpmFinder . getMainResourcePath ( ) , UpmUtils . renderMap ( ) ) ;
}
}
} ) ;
} ) ;
EventDispatcher . listen ( DownloadEvent . UPDATE , new Listener < String > ( ) {
@Override
public void on ( Event event , String param ) {
modernUIPane . redirect ( UpmFinder . getMainResourcePath ( ) , UpmUtils . renderMap ( ) ) ;
}
} ) ;
add ( modernUIPane , BorderLayout . CENTER ) ;
add ( modernUIPane , BorderLayout . CENTER ) ;
}
}
}
}