API request: WebEngine settings

Peter Zhelezniakov Peter.Zhelezniakov at oracle.com
Thu May 10 12:07:45 PDT 2012


Hi Richard,

Ok, so how does that look:

class javafx.scene.web.WebEngine {
   /**
     * Specifies whether JavaScript execution is enabled.
     * 
     * @defaultValue true
     */
    private BooleanProperty javaScriptEnabled;
    public final void setJavaScriptEnabled(boolean value);
    public final boolean isJavaScriptEnabled();
    public final BooleanProperty javaScriptEnabledProperty();
    
    /**
     * Specifies whether context menu is enabled.
     * 
     * @defaultValue true
     */
    private BooleanProperty contextMenuEnabled;
    public final void setContextMenuEnabled(boolean value);
    public final boolean isContextMenuEnabled();
    public final BooleanProperty contextMenuEnabledProperty();

    /**
     * Location of the user stylesheet as a string URL.
     * 
     * <p>This should be a local URL, i.e. either {@code 'file:'} or
     * {@code 'jar:'}. Remote URLs are not allowed for security reasons.
     * 
     * @defaultValue null
     */
    private StringProperty userStyleSheetLocation;
    public final void setUserStyleSheetLocation(String value);
    public final String getUserStyleSheetLocation();
    public final StringProperty userStyleSheetLocationProperty();
}


On May 10, 2012, at 5:07 AM, Richard Bair wrote:
> Hi Peter,
> 
> I gave it a few days to see if I'd change my mind but really I like adding the settings directly on WebEngine. I'm not bothered if a bunch of settings get put there. I am bothered by the fact that in FXML it is not a 1-1 mapping (ie, we alias from <WebView>).
> 
> I'm wondering how this plays in SceneBuilder as well. Right now I don't think SB has any special support so you cannot set any web engine specific settings.
> 
> As m inch as possible we want to keep the FXML / CSS / API in sync such that you can look at the API and know how to express something in FXML or CSS. That is, the process would be mechanical. So I would have thought:
> 
> <WebView>
>    <WebEngine location="http://oracle.com" />
> </WebView>
> 
> And likewise, if settings were a separate class, I would then have a WebSettings tag within the WebEngine tag. And in SB we would have to show that hierarchy as well. Does that make sense? By synthesizing a property on WebView, we now have to face resolving:
> 
> <WebView location="http://apple.com">
>    <WebEngine location="http://oracle.com" />
> </WebView>
> 
> What do we do? I think this illustrates one of the problems with not having a 1-1 mapping. So if we have WebSettings, then we have an extra level of nesting -- in code, in SB, and in FXML. This is why I have wondered about whether we ought not just roll these settings into WebEngine.
> 
> Richard


Thanks!
-- 
Peter              |  x33066  |  St Petersburg, Russia  |  timezone: GMT+04




More information about the openjfx-dev mailing list