|
JAC project AOPSYS CEDRIC & LIP6 labs |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JPanel | +--org.objectweb.jac.aspects.gui.swing.SHEditor
Field Summary | |
protected SHEditorConfig |
conf
|
protected boolean |
isSelectionCompletion
Whether the selection is some text added by the completion engine |
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
SHEditor()
Constructs a empty SHEditor. |
|
SHEditor(File file)
Constructs a SHEditor and reads the content of a file into it. |
|
SHEditor(String txt)
Constructs a SHEditor where the content is set by a string. |
Method Summary | |
void |
addCaretListener(CaretListener listener)
Adds a caret listener for notification of any changes to the caret. |
void |
addKeywords(Set addedKeywords)
Define some new keywords |
void |
addKeywords(String[] addedKeywords)
Define some new keywords |
void |
addModifiers(String[] addedModifiers)
Define some new keywords |
void |
addTextListener(TextListener listener)
Adds a text listener for notification of any changes to the text. |
void |
addTypes(String[] addedTypes)
|
void |
backwardChar(int n,
boolean select)
Moves backward n characters |
void |
backwardWord(int n,
boolean select)
Moves backward n words |
void |
beginningOfLine(boolean select)
Moves the caret to the beginning of the current line. |
void |
beginningOfText(boolean select)
Moves the caret to the beginning of the text. |
void |
clearKeywords()
|
void |
copy()
Preformes a copy action on the JJAvaPane. |
int |
countChar(char c,
int offs,
int length)
Returns the number of a char in a the text between to positions. |
void |
cut()
Preformes a cut action on the SHEditor. |
void |
endOfLine(boolean select)
Moves the caret to the end of the current line. |
void |
endOfText(boolean select)
Moves the caret to the end of the text. |
protected void |
fireCaretUpdate()
|
protected void |
fireTextUpdate()
|
void |
focusGained(FocusEvent e)
The SHEditor has gained focus. |
void |
focusLost(FocusEvent e)
The SHEditor has lost focus. |
void |
forwardChar(int n,
boolean select)
Moves forward n characters |
void |
forwardWord(int n,
boolean select)
Moves forward n words |
Rectangle |
getCaretPos(int position)
Returns a rectangle representation of the caret at a given position. |
int |
getCaretPosition()
Returns the caretPosition. |
int |
getCharPos(int mousePosX,
int mousePosY)
Returns position in the text based on coordinates x and y. |
CompletionEngine |
getCompletionEngine()
|
SHEditorConfig |
getConfig()
|
protected int |
getMarginLeft()
|
protected int |
getPixelTextWidth(String text)
Returns the pixel width of a string |
Dimension |
getPreferredScrollableViewportSize()
Copied from JTextComponent. |
int |
getScrollableBlockIncrement(Rectangle visibleRect,
int orientation,
int direction)
|
boolean |
getScrollableTracksViewportHeight()
|
boolean |
getScrollableTracksViewportWidth()
|
int |
getScrollableUnitIncrement(Rectangle visibleRect,
int orientation,
int direction)
|
int |
getSelectionEnd()
Returns selection end position. |
int |
getSelectionStart()
Returns selection start position |
String |
getText()
Returns the a String containing the java file. |
void |
gotoLine(int lineNumber)
Sets the caret at the beginning of a line |
void |
insertCloseCBracket()
Inserts a closing curly bracket and takes indentation into account. |
void |
insertReturn()
Inserts a closing curly bracket and takes indentation into account. |
void |
insertString(int pos,
String str)
Inserts a String s into the text at pos. |
boolean |
isDivider(char c)
Tests if a character is a divider. |
protected boolean |
isKeyword(String word)
Tells wether a word is keyword or not |
boolean |
isModifier(String word)
Tells wether a word is a modifier or not |
boolean |
isType(String word)
Tells wether a word is a type or not |
void |
keyPressed(KeyEvent e)
Key Pressed |
void |
keyReleased(KeyEvent e)
Key Released |
void |
keyTyped(KeyEvent e)
Key Typed |
void |
lostOwnership(Clipboard cb,
Transferable tr)
Fiered if the SHEditor loses ownership of a Clipboard |
void |
mouseClicked(MouseEvent e)
MouseClicked. |
void |
mouseDragged(MouseEvent e)
MouseDragged. |
void |
mouseEntered(MouseEvent e)
MouseEntered. |
void |
mouseExited(MouseEvent e)
MouseExited. |
void |
mouseMoved(MouseEvent e)
MouseMoved. |
void |
mousePressed(MouseEvent e)
Mouse has been pressed. |
void |
mouseReleased(MouseEvent e)
MouseReleased. |
void |
nextLine(int n,
boolean select)
Move to the next line |
void |
paintComponent(Graphics g)
Paints the SHEditor. |
void |
paste()
Preformes a paste action on the SHEditor. |
void |
positionVisible()
Makes sure the caret is visible on screen. |
void |
positionVisible(int position)
Makes sure a position is visible |
void |
previousLine(int n,
boolean select)
Move to the previous line |
void |
readFromFile(File f)
Reads a file into SHEditor. |
void |
redo()
Tels the SHEditor to redo the last undone action. |
void |
remove(int offs,
int length)
Removes the content of the text from offs to offs + length. |
void |
removeCaretListener(CaretListener listener)
Removes a caret listener. |
void |
removeTextListener(TextListener listener)
Removes a text listener. |
void |
repaint()
|
void |
saveToFile(File f)
Saves the file in SHEditor to a file. |
void |
scrollToLine(int line)
Sets a line as marked, and scrols to that line if needed. |
void |
selectionVisible()
Makes sure the selection is visible on screen. |
void |
setCaretPosition(int caretPosition)
|
void |
setCompletionEngine(CompletionEngine ce)
|
void |
setConfig(SHEditorConfig conf)
|
void |
setFont(Font font)
Sets the font of the SHEditor and repaqints it. |
void |
setSelection(int start,
int end)
Sets the selection |
void |
setSelectionEnd(int position)
Sets the end of the selection. |
void |
setSelectionStart(int position)
Sets the start of the selection. |
void |
setText(String t)
|
void |
setWordSeparators(char[] separators)
Sets the characters considered as word separators |
void |
testClosing(char opening,
char closing)
|
void |
testOpening(char opening,
char closing)
|
void |
testOposing()
Tests oposing (), [] and {}, and makes sure they are marked if the caret is behind one of them. |
void |
toolDone()
|
void |
undo()
Tels the SHEditor to undo the last action. |
void |
unmarkOposing()
Unmarks oposing (), {} or [] given by pos1 and pos2. |
void |
update(Graphics g)
Updates the JJAvaPane (cals paint(Graphics g)); |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected boolean isSelectionCompletion
protected SHEditorConfig conf
Constructor Detail |
public SHEditor()
public SHEditor(String txt)
txt
- A String representing initial java file.public SHEditor(File file)
file
- The initial java file.Method Detail |
public SHEditorConfig getConfig()
public void setConfig(SHEditorConfig conf)
public void setWordSeparators(char[] separators)
public void addCaretListener(CaretListener listener)
listener
- the listener to be addedCaretEvent
public void removeCaretListener(CaretListener listener)
listener
- the listener to be removedCaretEvent
public void addTextListener(TextListener listener)
listener
- the listener to be addedCaretEvent
public void removeTextListener(TextListener listener)
listener
- the listener to be removedCaretEvent
protected void fireTextUpdate()
public String getText()
public void setText(String t)
public void setSelectionStart(int position)
position
- new start of selectionpublic void setSelectionEnd(int position)
position
- new end of selectionpublic void setSelection(int start, int end)
start
- position where selection startsend
- position where selection endspublic void forwardChar(int n, boolean select)
n
- number of characters to move forwardselect
- wether to add the text moved over by the caret to
the selectionpublic void backwardChar(int n, boolean select)
n
- number of characters to move backwardselect
- wether to add the text moved over by the caret to
the selectionpublic void forwardWord(int n, boolean select)
n
- number of words to move forwardselect
- wether to add the text moved over by the caret to
the selectionpublic void backwardWord(int n, boolean select)
n
- number of words to move backwardselect
- wether to add the text moved over by the caret to
the selectionpublic void nextLine(int n, boolean select)
n
- move to previous line n timesselect
- wether to add the text moved over by the caret to
the selectionpublic void previousLine(int n, boolean select)
n
- move to previous line n timesselect
- wether to add the text moved over by the caret to
the selectionpublic void beginningOfText(boolean select)
select
- wether to add the text moved over by the caret to
the selectionpublic void endOfText(boolean select)
select
- wether to add the text moved over by the caret to
the selectionpublic void beginningOfLine(boolean select)
select
- wether to add the text moved over by the caret to
the selectionpublic void endOfLine(boolean select)
select
- wether to add the text moved over by the caret to
the selectionpublic void gotoLine(int lineNumber)
lineNumber
- number of the line (starts with 1)public void setCompletionEngine(CompletionEngine ce)
public CompletionEngine getCompletionEngine()
public void toolDone()
public void keyPressed(KeyEvent e)
keyPressed
in interface KeyListener
public void keyTyped(KeyEvent e)
keyTyped
in interface KeyListener
public void insertCloseCBracket()
public void insertReturn()
public void keyReleased(KeyEvent e)
keyReleased
in interface KeyListener
public void insertString(int pos, String str)
pos
- The position where you whant to insert a String.str
- The String you whant to insert into the text.public void remove(int offs, int length)
offs
- Where to start removing text.public void undo()
public void redo()
public void cut()
public void copy()
public void paste()
public int countChar(char c, int offs, int length)
c
- the char to count.public void repaint()
repaint
in class Component
public void paintComponent(Graphics g)
paintComponent
in class JComponent
g
- the graphics to draw the SHEditor on.protected int getPixelTextWidth(String text)
text
- the string to get the width of
public void update(Graphics g)
update
in class JComponent
public void scrollToLine(int line)
public void testOposing()
public void testClosing(char opening, char closing)
public void testOpening(char opening, char closing)
public void unmarkOposing()
public void positionVisible()
public void selectionVisible()
public void positionVisible(int position)
position
- the position that must be visiblepublic Rectangle getCaretPos(int position)
position
- position of the caret
public void setFont(Font font)
setFont
in class JComponent
font
- the new font.protected int getMarginLeft()
public int getCharPos(int mousePosX, int mousePosY)
mousePosX
- the x coordinate of the position in the text.mousePosY
- the y coordinate of the position in the text.
public boolean isDivider(char c)
c
- the char to test.
public void addKeywords(String[] addedKeywords)
addedKeywords
- the new keywordspublic void addKeywords(Set addedKeywords)
addedKeywords
- the new keywordspublic void clearKeywords()
protected boolean isKeyword(String word)
public void addModifiers(String[] addedModifiers)
public boolean isModifier(String word)
public void addTypes(String[] addedTypes)
public boolean isType(String word)
protected void fireCaretUpdate()
public void setCaretPosition(int caretPosition)
public int getCaretPosition()
public int getSelectionStart()
public int getSelectionEnd()
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
public void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize
in interface Scrollable
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
getScrollableUnitIncrement
in interface Scrollable
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
getScrollableBlockIncrement
in interface Scrollable
public boolean getScrollableTracksViewportWidth()
getScrollableTracksViewportWidth
in interface Scrollable
public boolean getScrollableTracksViewportHeight()
getScrollableTracksViewportHeight
in interface Scrollable
public void lostOwnership(Clipboard cb, Transferable tr)
lostOwnership
in interface ClipboardOwner
public void focusLost(FocusEvent e)
focusLost
in interface FocusListener
public void focusGained(FocusEvent e)
focusGained
in interface FocusListener
public void readFromFile(File f)
f
- the file to read into the SHEditor.public void saveToFile(File f)
f
- the file where the content of the SHEditor should be saved.
|
Contact JAC development team: Renaud Pawlak Lionel Seinturier Laurent Martelli |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |