org.xwiki.gwt.wysiwyg.client.plugin.table.feature
Class InsertTable

java.lang.Object
  extended by org.xwiki.gwt.user.client.ui.rta.cmd.internal.AbstractRichTextAreaExecutable
      extended by org.xwiki.gwt.user.client.ui.rta.cmd.internal.AbstractSelectionExecutable
          extended by org.xwiki.gwt.wysiwyg.client.plugin.table.feature.AbstractTableFeature
              extended by org.xwiki.gwt.wysiwyg.client.plugin.table.feature.InsertTable
All Implemented Interfaces:
Executable, WizardListener, TableFeature

public class InsertTable
extends AbstractTableFeature
implements WizardListener

Feature allowing to insert a table in the editor. It is disabled when the caret is positioned in a table.

Version:
$Id: InsertTable.java 27163 2010-02-19 12:07:33Z mflorea $

Field Summary
static java.lang.String NAME
          Feature name.
 
Fields inherited from class org.xwiki.gwt.user.client.ui.rta.cmd.internal.AbstractSelectionExecutable
cache, domUtils
 
Fields inherited from class org.xwiki.gwt.user.client.ui.rta.cmd.internal.AbstractRichTextAreaExecutable
rta
 
Constructor Summary
InsertTable(TablePlugin plugin)
          Initialize the feature.
 
Method Summary
 Element createTable(Document doc, TableConfig config)
          Create a table from TableConfig configuration.
 boolean execute(java.lang.String parameter)
          
 Wizard getWizard()
          Get table wizard pop-up.
 void insertTable(TableConfig config)
          Insert a HTML table in the editor.
 boolean isEnabled()
          
 void onCancel(Wizard sender)
          
 void onFinish(Wizard sender, java.lang.Object result)
          
 
Methods inherited from class org.xwiki.gwt.wysiwyg.client.plugin.table.feature.AbstractTableFeature
destroy, getCommand, getName, getPlugin
 
Methods inherited from class org.xwiki.gwt.user.client.ui.rta.cmd.internal.AbstractSelectionExecutable
getParameter, hasValidSelection, isExecuted
 
Methods inherited from class org.xwiki.gwt.user.client.ui.rta.cmd.internal.AbstractRichTextAreaExecutable
isSupported
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xwiki.gwt.user.client.ui.rta.cmd.Executable
getParameter, isExecuted, isSupported
 

Field Detail

NAME

public static final java.lang.String NAME
Feature name.

See Also:
Constant Field Values
Constructor Detail

InsertTable

public InsertTable(TablePlugin plugin)
Initialize the feature. Table features needs to be aware of the plug-in (here the ClickListener) since they hold their own PushButton.

Parameters:
plugin - table plug-in.
Method Detail

getWizard

public Wizard getWizard()
Get table wizard pop-up.

Returns:
the table wizard pop-up instance.

createTable

public Element createTable(Document doc,
                           TableConfig config)
Create a table from TableConfig configuration.

We create the table using innerHTML instead of creating each DOM node in order to improve the speed. In most of the browsers setting the innerHTML is faster than creating the DOM nodes and appending them.

Parameters:
doc - currently edited document.
config - table configuration (row number, etc).
Returns:
the newly created table.

insertTable

public void insertTable(TableConfig config)
Insert a HTML table in the editor.

Parameters:
config - creation parameters.

execute

public boolean execute(java.lang.String parameter)

Specified by:
execute in interface Executable
See Also:
Executable.execute(String)

isEnabled

public boolean isEnabled()

Specified by:
isEnabled in interface Executable
Overrides:
isEnabled in class org.xwiki.gwt.user.client.ui.rta.cmd.internal.AbstractSelectionExecutable
See Also:
AbstractSelectionExecutable.isEnabled()

onCancel

public void onCancel(Wizard sender)

Specified by:
onCancel in interface WizardListener
See Also:
WizardListener.onCancel(Wizard)

onFinish

public void onFinish(Wizard sender,
                     java.lang.Object result)

Specified by:
onFinish in interface WizardListener
See Also:
WizardListener.onFinish(Wizard, Object)


Copyright © 2004-2010 XWiki. All Rights Reserved.