JIDE 3.5.15

com.jidesoft.editor
Class CodeEditorDocumentComponent

java.lang.Object
  extended by com.jidesoft.document.DocumentComponent
      extended by com.jidesoft.editor.CodeEditorDocumentComponent
All Implemented Interfaces:
CloneableDocumentComponent, Cloneable

public class CodeEditorDocumentComponent
extends DocumentComponent
implements CloneableDocumentComponent

CodeEditorDocumentComponent is a DocumentComponent for CodeEditor. There is setLanguageName method that you can use to set the language of the CodeEditor as long as the language name is registered in LanguageSpecManager.


Field Summary
 
Fields inherited from class com.jidesoft.document.DocumentComponent
PROPERTY_BACKGROUND, PROPERTY_CLOSABLE, PROPERTY_COMPONENT, PROPERTY_ENABLED, PROPERTY_FOREGROUND, PROPERTY_ICON, PROPERTY_TITLE, PROPERTY_TOOLTIP
 
Constructor Summary
CodeEditorDocumentComponent(JComponent component, String name, String title, Icon icon)
           
CodeEditorDocumentComponent(String name)
           
CodeEditorDocumentComponent(String name, String title)
           
CodeEditorDocumentComponent(String name, String title, Icon icon)
           
 
Method Summary
 Object clone()
           
protected  CodeEditorDocumentComponent cloneDocumentComponent()
          Clones the DocumentComponent.
protected  CodeEditor createCodeEditor()
          Creates the code editor.
protected  MarkerArea createMarkerArea(CodeEditor editor)
          Creates the marker area.
protected  StatusBar createStatusBar(CodeEditor editor)
          Creates status bar for this CodeEditorDocumentComponent.
 CodeEditor getCodeEditor()
           
 String getLanguageName()
           
protected  void initComponents()
           
 void open(ClassLoader classLoader, String resourceName)
           
 void open(InputStream in)
          Opens an input stream.
 void open(InputStream in, String charsetName)
          Opens an input stream using the specified charset.
 void open(String fileName)
          Opens a file in the code editor.
 void open(String fileName, String charsetName)
          Opens a file in the code editor using the specified charset.
 void open(SyntaxDocument document)
          Opens a SyntaxDocument and sets it to the code editor.
 void save(OutputStream out)
          Saves the content of an output stream.
 void save(OutputStream out, String charsetName)
          Saves the content of an output stream.
 void save(String fileName)
          Saves the content of the code editor to a file.
 void save(String fileName, String charsetName)
          Saves the content of the code editor to a file.
 void setCodeEditor(CodeEditor codeEditor)
           
 void setLanguageName(String languageName)
           
 
Methods inherited from class com.jidesoft.document.DocumentComponent
addDocumentComponentListener, addPropertyChangeListener, addPropertyChangeListener, allowClosing, allowMoving, cleanup, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getComponent, getDefaultFocusComponent, getDisplayTitle, getDockPreviousState, getDocumentComponentListeners, getDocumentPane, getFloatPreviousState, getForeground, getIcon, getLastFocusedComponent, getName, getPropertyChangeListeners, getPropertyChangeListeners, getTitle, getTooltip, isClosable, refocusLastFocusedComponent, removeDocumentComponentListener, removePropertyChangeListener, removePropertyChangeListener, renamePreviousState, setAllowClosing, setAllowMoving, setBackground, setClosable, setComponent, setDefaultFocusComponent, setDockPreviousState, setDocumentPane, setFloatPreviousState, setForeground, setIcon, setLastFocusedComponent, setName, setTitle, setTooltip
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CodeEditorDocumentComponent

public CodeEditorDocumentComponent(String name)

CodeEditorDocumentComponent

public CodeEditorDocumentComponent(String name,
                                   String title)

CodeEditorDocumentComponent

public CodeEditorDocumentComponent(String name,
                                   String title,
                                   Icon icon)

CodeEditorDocumentComponent

public CodeEditorDocumentComponent(JComponent component,
                                   String name,
                                   String title,
                                   Icon icon)
Method Detail

initComponents

protected void initComponents()

createStatusBar

protected StatusBar createStatusBar(CodeEditor editor)
Creates status bar for this CodeEditorDocumentComponent. Subclass can override this method to create their own status bar or even null if they prefer to put the status bar somewhere else.

Parameters:
editor - the code editor.
Returns:
the status bar.

createMarkerArea

protected MarkerArea createMarkerArea(CodeEditor editor)
Creates the marker area.

Parameters:
editor - the code editor.
Returns:
the marker area.

getLanguageName

public String getLanguageName()

setLanguageName

public void setLanguageName(String languageName)

createCodeEditor

protected CodeEditor createCodeEditor()
Creates the code editor.

Returns:
the code editor.

setCodeEditor

public void setCodeEditor(CodeEditor codeEditor)

getCodeEditor

public CodeEditor getCodeEditor()

open

public void open(String fileName)
          throws IOException
Opens a file in the code editor.

Parameters:
fileName -
Throws:
IOException

open

public void open(String fileName,
                 String charsetName)
          throws IOException
Opens a file in the code editor using the specified charset.

Parameters:
fileName -
Throws:
IOException

open

public void open(ClassLoader classLoader,
                 String resourceName)
          throws IOException
Throws:
IOException

open

public void open(SyntaxDocument document)
Opens a SyntaxDocument and sets it to the code editor.

Parameters:
document -

open

public void open(InputStream in)
          throws IOException
Opens an input stream.

Parameters:
in -
Throws:
IOException

open

public void open(InputStream in,
                 String charsetName)
          throws IOException
Opens an input stream using the specified charset.

Parameters:
in -
charsetName -
Throws:
IOException

save

public void save(String fileName)
          throws IOException
Saves the content of the code editor to a file.

Parameters:
fileName -
Throws:
IOException

save

public void save(String fileName,
                 String charsetName)
          throws IOException
Saves the content of the code editor to a file.

Parameters:
fileName -
charsetName -
Throws:
IOException

save

public void save(OutputStream out)
          throws IOException
Saves the content of an output stream.

Parameters:
out -
Throws:
IOException

save

public void save(OutputStream out,
                 String charsetName)
          throws IOException
Saves the content of an output stream.

Parameters:
out -
Throws:
IOException

clone

public Object clone()
             throws CloneNotSupportedException
Specified by:
clone in interface CloneableDocumentComponent
Overrides:
clone in class Object
Throws:
CloneNotSupportedException

cloneDocumentComponent

protected CodeEditorDocumentComponent cloneDocumentComponent()
Clones the DocumentComponent. It will simply do
 return new CodeEditorDocumentComponent(getName(), getTitle(), getIcon());
 
This method is called by clone().

Returns:
a new DocumentComponent with the same name, title and icon of this one.

JIDE 3.5.15