Patch #861 » globalResources_reflection.patch
src/com/servoy/plugins/BehaviorProvider.java (working copy) | ||
---|---|---|
9 | 9 |
|
10 | 10 |
package com.servoy.plugins; |
11 | 11 |
|
12 |
import java.lang.reflect.Method; |
|
12 | 13 |
import java.util.ArrayList; |
13 | 14 |
import java.util.List; |
14 | 15 |
import java.util.Map; |
... | ... | |
28 | 29 |
import com.servoy.j2db.scripting.FunctionDefinition; |
29 | 30 |
import com.servoy.j2db.server.headlessclient.IWebClientPluginAccess; |
30 | 31 |
import com.servoy.j2db.server.headlessclient.dataui.WebEventExecutor; |
32 |
import com.servoy.j2db.util.Debug; |
|
31 | 33 |
import com.servoy.j2db.util.Utils; |
32 | 34 |
|
33 | 35 |
/** |
... | ... | |
48 | 50 |
|
49 | 51 |
private final List<Object> jsReferences = new ArrayList<Object>(2); |
50 | 52 |
private final List<Object> cssReferences = new ArrayList<Object>(2); |
51 |
|
|
53 |
|
|
52 | 54 |
public BehaviorProvider(IWebClientPluginAccess app) { |
53 | 55 |
this.app = app; |
54 | 56 |
} |
... | ... | |
217 | 219 |
public void removeJsReference(String url) { |
218 | 220 |
jsReferences.remove(url); |
219 | 221 |
} |
222 |
|
|
223 |
public void addGlobalCssReference(Object url) |
|
224 |
{ |
|
225 |
try |
|
226 |
{ |
|
227 |
Method method = app.getPageContributor().getClass().getMethod("addGlobalCSSResourceReference", url.getClass()); |
|
228 |
method.invoke(app.getPageContributor(), url); |
|
229 |
} |
|
230 |
catch (NoSuchMethodException ex) |
|
231 |
{ |
|
232 |
throw new UnsupportedOperationException("Cannot add global css reference. This operation is not supported for Servoy versions lower than 7.3"); |
|
233 |
} |
|
234 |
catch (Exception e) |
|
235 |
{ |
|
236 |
Debug.error(e); |
|
237 |
} |
|
238 |
} |
|
239 |
|
|
240 |
public void removeGlobalCssReference(Object url) |
|
241 |
{ |
|
242 |
try |
|
243 |
{ |
|
244 |
Method method = app.getPageContributor().getClass().getMethod("removeGlobalResourceReference", url.getClass()); |
|
245 |
method.invoke(app.getPageContributor(), url); |
|
246 |
} |
|
247 |
catch (NoSuchMethodException ex) |
|
248 |
{ |
|
249 |
throw new UnsupportedOperationException("Cannot remove global css reference. This operation is not supported for Servoy versions lower than 7.3"); |
|
250 |
} |
|
251 |
catch (Exception e) |
|
252 |
{ |
|
253 |
Debug.error(e); |
|
254 |
} |
|
255 |
} |
|
220 | 256 |
|
221 | 257 |
/* |
222 | 258 |
public interface ILatestPageBehaviorListener extends IBehaviorListener |
src/com/servoy/plugins/WebClientProvider.java (working copy) | ||
---|---|---|
480 | 480 |
public void js_removeCssReference(ResourceReference url) { |
481 | 481 |
removeCssReference(url); |
482 | 482 |
} |
483 |
|
|
484 |
public void js_addGlobalCssReference(String url) { |
|
485 |
addGlobalCssReference(url); |
|
486 |
} |
|
483 | 487 |
|
488 |
public void js_addGlobalCssReference(ResourceReference url) { |
|
489 |
addGlobalCssReference(url); |
|
490 |
} |
|
491 |
|
|
492 |
public void js_removeGlobalCssReference(String url) { |
|
493 |
removeGlobalCssReference(url); |
|
494 |
} |
|
495 |
|
|
496 |
public void js_removeGlobalCssReference(ResourceReference url) { |
|
497 |
removeGlobalCssReference(url); |
|
498 |
} |
|
499 |
|
|
500 |
public void removeGlobalCssReference(ResourceReference url) { |
|
501 |
BehaviorProvider bp = getBehavior(); |
|
502 |
if (bp != null) bp.removeGlobalCssReference(url); |
|
503 |
} |
|
504 |
|
|
505 |
public void removeGlobalCssReference(String url) { |
|
506 |
BehaviorProvider bp = getBehavior(); |
|
507 |
if (bp != null) bp.removeGlobalCssReference(url); |
|
508 |
} |
|
509 |
|
|
510 |
private void addGlobalCssReference(String url) { |
|
511 |
BehaviorProvider bp = getBehavior(); |
|
512 |
if (bp != null) bp.addGlobalCssReference(url); |
|
513 |
} |
|
514 |
|
|
515 |
private void addGlobalCssReference(ResourceReference url) { |
|
516 |
BehaviorProvider bp = getBehavior(); |
|
517 |
if (bp != null) bp.addGlobalCssReference(url); |
|
518 |
} |
|
519 |
|
|
484 | 520 |
public void js_addJsReference(String url) { |
485 | 521 |
addJsReference(url); |
486 | 522 |
} |
- « Previous
- 1
- 2
- Next »