PlugableSVGSnippets

Plugable SVG Snippets for SVG Composer

This document may change during the implementation of this feature.

Contents


Motivation

Motivation is to extend functionality of the SVG Composer and make it possible to introduce custom SVG Snippets to the SVG Composer.

Abstract

This functionality should allow user to plug in custom SVG Rich Components Snippets to the SVG Composer. Only one type of snippets should be available in SVG Composer. All snippets should be registered using SVG Core API. Switching between snippets should be achieved through Netbeans Preference panel in "SVG" tab.

Functionality

New Gradient snippets

New gradient snippets should be available since version 7.0 M2

Image:gradient_PlugableSVGSnippets.png

"Gradient" Custom Snippets


SVG Core Snippets public API

Registration of new new set of snippets should be done through Netbeans Lookup and API Support Project. Snippets registration interface:

package org.netbeans.modules.mobility.svgcore.api.snippets;

public interface SVGSnippetsProvider {

    /**
     * Name of SVG Snippet provider, has to be unique. NOI18N!
     * @return Unique name
     */
    String getName();

     /**
     * Display name of SVG Snippet.
     * @return Unique name
     */
    String getDisplayName();
   
}

Example implementation of this interface:

@org.openide.util.lookup.ServiceProvider(service=org.netbeans.modules.mobility.svgcore.api.snippets.SVGSnippetsProvider.class)
public class SVGSnipetsProviderGradient implements SVGSnippetsProvider{

   private static final String name = "Gradient_snippet0";

    public String getName() {
        return name;
    }

    public String getDisplayName() {
        return "Gradient";
    }

}

Also it is MANDATORY to store all snippets in the same package with implementation of SVGSnippetsProvider. Example of custom snippets can be found in Netbeans sources in vmd.svgcore, package org.netbeans.modules.mobility.svgcore.snippets.gradientlook.

SVG Snippets Preference panel

Switching between snippets should be done through Netbeans Options/Preferences. Combo box with list of all registered custom snippets should be available in (Options/Preferences)/Miscellaneous/SVG. Like shown below:


Image:panel_PlugableSVGSnippets.png

Snippets available Netbeans Mobility 7.0 M2

Image:gradient_PlugableSVGSnippets.png

"Classic" and "Gradient" snippets



contact: Karol Harezlak

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo