如何在现有网页编辑器调色板中提供自定义组件

编程入门 行业动态 更新时间:2024-10-22 08:17:27
本文介绍了如何在现有网页编辑器调色板中提供自定义组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想在网页编辑器Palete中添加一个新的自定义组件,名为myHTMLComponent。 所以,一旦用户用WPE打开任何html页面,我的HTMLComponentM应该出现在那里。 我如何做到有需要,而且这个组件还需要相应地生成代码的更改。如何实现所需的结果。

有没有可以获得的输入。 我已经创建了标准的元数据标签,但是下一步呢!

解决方案

最后,我发现问题的解决方案。 / p>

要在调色板中添加新类别,我们需要在plugin.xml中使用pagedesignerextension,如下所示 -

< extension point =org.eclipse.jst.pagedesigner.pageDesignerExtension> < paletteFactory class =comp.myeditor.palette.CustomEditorPaletteFactory> < / paletteFactory> < / extension>

CustomEditorPaletteFactory将如何扩展AbstractPaletteFactory。在createPaletteRoot()中,我们可以添加我们的类别。

public PaletteRoot createPaletteRoot(IEditorInput editorInput){ PaletteRoot paletteRoot = new PaletteRoot(); paletteRoot.add(createStandardComponents()); return paletteRoot; //返回null; } private static PaletteContainer createStandardComponents(){ PaletteDrawer componentsDrawer = new PaletteDrawer(CustomHTMLComponent); TagToolPaletteEntry paletteEntry = new TagToolPaletteEntry( new FormPaletteComponent(.....); componentsDrawer.add(paletteEntry); return componentsDrawer ; }

这将在调色板中创建组件类别,我们可以添加多个使用组件导航器需要使用组件。

在现有的添加新类别 - 在构造函数中添加这个 -

super(); this._paletteContext = PaletteItemManager.createPaletteContext(file); this._manager = PaletteItemManager.getInstance(_paletteContext);

然后使用Palette Grouping这样 -

PaletteGroup controls = new PaletteGroup(CUST HTML); super.add(controls); ToolEntry tool = new SelectionToolEntry(CUST Cursor ,Cursor DESCRIPTION); controls.add(tool); setDefaultEntry(tool); //自定义选框 controls.add(new MarqueeToolEntry(Marquee,Marquee Desc)); controls.add(new PaletteSeparator()); //此类维护或加载所有类别功能 controls.add(new CustomComponentToolEntry(Custom Component,Custom Component Descrition,

I want to add a new custom component in the Web page Editor Palete named "myHTMLComponent". So, as soon as user opens any html page with WPE, myHTMLComponentM should be present there. How can I do the needful, moreover this component will as well need to generate the code changes accordingly. How to achieve the desired result.

Is there any input I can get for this. I already created standardmetadata tag, but what next!

解决方案

Finally, I found the solution of the problem.

For adding new categories in the palette, we need to use pagedesignerextension in plugin.xml as following -

<extension point="org.eclipse.jst.pagedesigner.pageDesignerExtension"> <paletteFactory class="comp.myeditor.palette.CustomEditorPaletteFactory"> </paletteFactory> </extension>

Where CustomEditorPaletteFactory will be extending AbstractPaletteFactory. Here in createPaletteRoot(), we can add our category.

public PaletteRoot createPaletteRoot(IEditorInput editorInput){ PaletteRoot paletteRoot = new PaletteRoot(); paletteRoot.add(createStandardComponents()); return paletteRoot; //return null; } private static PaletteContainer createStandardComponents() { PaletteDrawer componentsDrawer = new PaletteDrawer("CustomHTMLComponent"); TagToolPaletteEntry paletteEntry = new TagToolPaletteEntry( new FormPaletteComponent(".....); componentsDrawer.add(paletteEntry); return componentsDrawer; }

This will create the component category in the palette and we can add as many components as needed using the componentsdrawer.

For adding a new category in the existing one - Add this in the constructor -

super(); this._paletteContext = PaletteItemManager.createPaletteContext(file); this._manager = PaletteItemManager.getInstance(_paletteContext);

Then use Palette Grouping like this -

PaletteGroup controls = new PaletteGroup("CUST HTML"); super.add(controls); ToolEntry tool = new SelectionToolEntry("CUST Cursor", "Cursor DESCRIPTION"); controls.add(tool); setDefaultEntry(tool); //Custom Marquee controls.add(new MarqueeToolEntry("Marquee", "Marquee Desc")); controls.add(new PaletteSeparator()); //This class maintins or load all categories features controls.add(new CustomComponentToolEntry("Custom Component", "Custom Component Descrition",

更多推荐

如何在现有网页编辑器调色板中提供自定义组件

本文发布于:2023-11-08 20:38:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1570393.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:调色板   自定义   编辑器   组件   网页

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!