本文整理汇总了Java中org.fife.ui.rtextarea.Gutter类的典型用法代码示例。如果您正苦于以下问题:Java Gutter类的具体用法?Java Gutter怎么用?Java Gutter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Gutter类属于org.fife.ui.rtextarea包,在下文中一共展示了Gutter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleDocumentEvent
import org.fife.ui.rtextarea.Gutter; //导入依赖的package包/类
private void handleDocumentEvent(DocumentEvent e, Shape a,
ViewFactory f) {
int n = calculateLineCount();
if (this.nlines != n) {
this.nlines = n;
WrappedSyntaxView.this.preferenceChanged(this, false, true);
// have to repaint any views after the receiver.
RSyntaxTextArea textArea = (RSyntaxTextArea)getContainer();
textArea.repaint();
// Must also revalidate container so gutter components, such
// as line numbers, get updated for this line's new height
Gutter gutter = RSyntaxUtilities.getGutter(textArea);
if (gutter!=null) {
gutter.revalidate();
gutter.repaint();
}
}
else if (a != null) {
Component c = getContainer();
Rectangle alloc = (Rectangle) a;
c.repaint(alloc.x, alloc.y, alloc.width, alloc.height);
}
}
示例2: testApply
import org.fife.ui.rtextarea.Gutter; //导入依赖的package包/类
@Test
public void testApply() {
RSyntaxTextArea textArea1 = new RSyntaxTextArea(
SyntaxConstants.SYNTAX_STYLE_PHP);
RTextScrollPane sp1 = new RTextScrollPane(textArea1);
Gutter gutter1 = sp1.getGutter();
initWithOddProperties(textArea1, gutter1);
RSyntaxTextArea textArea2 = new RSyntaxTextArea(
SyntaxConstants.SYNTAX_STYLE_PHP);
RTextScrollPane sp2 = new RTextScrollPane(textArea2);
Gutter gutter2 = sp2.getGutter();
assertAllThemePropertiesDifferent(textArea1, gutter1, textArea2, gutter2);
Theme theme = new Theme(textArea1);
theme.apply(textArea2);
assertEqualThemeProperties(textArea1, gutter1, textArea2, gutter2);
}
示例3: testLoad_FromStream_NoDefaultFont
import org.fife.ui.rtextarea.Gutter; //导入依赖的package包/类
@Test
public void testLoad_FromStream_NoDefaultFont() throws Exception {
InputStream in = getClass().getResourceAsStream("ThemeTest_theme1.xml");
Theme theme = Theme.load(in);
in.close();
RSyntaxTextArea textArea1 = new RSyntaxTextArea(
SyntaxConstants.SYNTAX_STYLE_PHP);
RTextScrollPane sp1 = new RTextScrollPane(textArea1);
Gutter gutter1 = sp1.getGutter();
initWithOddProperties(textArea1, gutter1);
theme.apply(textArea1);
assertColorsMatchTheme1(textArea1, gutter1);
}
示例4: refreshErrorTable
import org.fife.ui.rtextarea.Gutter; //导入依赖的package包/类
private void refreshErrorTable(List<ParserNotice> notices) {
Gutter gutter = scrollPane.getGutter();
gutter.removeAllTrackingIcons();
errorTableModel.setRowCount(0);
LanguageSupport ls = LanguageSupportFactory.get().getSupportFor("text/zscript");
ZScriptLanguageSupport zsls = (ZScriptLanguageSupport)ls;
ZScriptParser parser = zsls.getParser(textArea);
for (ParserNotice notice : notices) {
if (notice.getParser()==parser) {
boolean error = notice.getLevel()==ParserNotice.Level.ERROR;
String iconName = error ? IconFactory.ERROR_ICON : IconFactory.WARNING_ICON;
Icon icon = IconFactory.get().getIcon(iconName);
int line = notice.getLine();
Object[] data = { icon, new Integer(line+1), notice };
errorTableModel.addRow(data);
try {
gutter.addLineTrackingIcon(line, icon, notice.getToolTipText());
} catch (BadLocationException ble) {
ble.printStackTrace();
}
}
}
}
示例5: getFoldedLineBottomColor
import org.fife.ui.rtextarea.Gutter; //导入依赖的package包/类
/**
* Returns the color to use for the line underneath a folded region line.
*
* @param textArea The text area.
* @return The color to use.
*/
public static Color getFoldedLineBottomColor(RSyntaxTextArea textArea) {
Color color = Color.gray;
Gutter gutter = RSyntaxUtilities.getGutter(textArea);
if (gutter!=null) {
color = gutter.getFoldIndicatorForeground();
}
return color;
}
示例6: getGutter
import org.fife.ui.rtextarea.Gutter; //导入依赖的package包/类
/**
* Returns the gutter component of the scroll pane containing a text
* area, if any.
*
* @param textArea The text area.
* @return The gutter, or <code>null</code> if the text area is not in
* an {@link RTextScrollPane}.
* @see RTextScrollPane#getGutter()
*/
public static Gutter getGutter(RTextArea textArea) {
Gutter gutter = null;
Container parent = textArea.getParent();
if (parent instanceof JViewport) {
parent = parent.getParent();
if (parent instanceof RTextScrollPane) {
RTextScrollPane sp = (RTextScrollPane)parent;
gutter = sp.getGutter(); // Should always be non-null
}
}
return gutter;
}
示例7: possiblyRepaintGutter
import org.fife.ui.rtextarea.Gutter; //导入依赖的package包/类
/**
* Repaints the gutter in a text area's scroll pane, if necessary.
*
* @param textArea The text area.
*/
protected void possiblyRepaintGutter(RTextArea textArea) {
Gutter gutter = RSyntaxUtilities.getGutter(textArea);
if (gutter!=null) {
gutter.repaint();
}
}
示例8: assertAllThemePropertiesDifferent
import org.fife.ui.rtextarea.Gutter; //导入依赖的package包/类
/**
* Asserts that all properties set by a {@link Theme} are different
* between one text area/gutter pair and another.
*/
private void assertAllThemePropertiesDifferent(RSyntaxTextArea textArea1,
Gutter gutter1, RSyntaxTextArea textArea2, Gutter gutter2) {
Assert.assertNotEquals(textArea1.getFont(), textArea2.getFont());
Assert.assertNotEquals(textArea1.getSyntaxScheme(), textArea2.getSyntaxScheme());
Assert.assertNotEquals(textArea1.getBackground(), textArea2.getBackground());
Assert.assertNotEquals(textArea1.getCaretColor(), textArea2.getCaretColor());
Assert.assertNotEquals(textArea1.getUseSelectedTextColor(), textArea2.getUseSelectedTextColor());
Assert.assertNotEquals(textArea1.getSelectedTextColor(), textArea2.getSelectedTextColor());
Assert.assertNotEquals(textArea1.getSelectionColor(), textArea2.getSelectionColor());
Assert.assertNotEquals(textArea1.getRoundedSelectionEdges(), textArea2.getRoundedSelectionEdges());
Assert.assertNotEquals(textArea1.getCurrentLineHighlightColor(), textArea2.getCurrentLineHighlightColor());
Assert.assertNotEquals(textArea1.getFadeCurrentLineHighlight(), textArea2.getFadeCurrentLineHighlight());
Assert.assertNotEquals(textArea1.getMarginLineColor(), textArea2.getMarginLineColor());
Assert.assertNotEquals(textArea1.getMarkAllHighlightColor(), textArea2.getMarkAllHighlightColor());
Assert.assertNotEquals(textArea1.getMarkOccurrencesColor(), textArea2.getMarkOccurrencesColor());
Assert.assertNotEquals(textArea1.getPaintMarkOccurrencesBorder(), textArea2.getPaintMarkOccurrencesBorder());
Assert.assertNotEquals(textArea1.getMatchedBracketBGColor(), textArea2.getMatchedBracketBGColor());
Assert.assertNotEquals(textArea1.getMatchedBracketBorderColor(), textArea2.getMatchedBracketBorderColor());
Assert.assertNotEquals(textArea1.getPaintMatchedBracketPair(), textArea2.getPaintMatchedBracketPair());
Assert.assertNotEquals(textArea1.getAnimateBracketMatching(), textArea2.getAnimateBracketMatching());
Assert.assertNotEquals(textArea1.getHyperlinkForeground(), textArea2.getHyperlinkForeground());
for (int i=0; i<textArea1.getSecondaryLanguageCount(); i++) {
Assert.assertNotEquals(textArea1.getSecondaryLanguageBackground(i+1),
textArea2.getSecondaryLanguageBackground(i+1));
}
Assert.assertNotEquals(gutter1.getBackground(), gutter2.getBackground());
Assert.assertNotEquals(gutter1.getBorderColor(), gutter2.getBorderColor());
Assert.assertNotEquals(gutter1.getActiveLineRangeColor(), gutter2.getActiveLineRangeColor());
Assert.assertNotEquals(gutter1.getIconRowHeaderInheritsGutterBackground(), gutter2.getIconRowHeaderInheritsGutterBackground());
Assert.assertNotEquals(gutter1.getLineNumberColor(), gutter2.getLineNumberColor());
Assert.assertNotEquals(gutter1.getLineNumberFont(), gutter2.getLineNumberFont());
Assert.assertNotEquals(gutter1.getFoldIndicatorForeground(), gutter2.getFoldIndicatorForeground());
Assert.assertNotEquals(gutter1.getFoldBackground(), gutter2.getFoldBackground());
}
示例9: assertColorsMatchTheme1
import org.fife.ui.rtextarea.Gutter; //导入依赖的package包/类
/**
* Asserts whether a text area and gutter match the styles defined in
* <code>ThemeTest_theme1.xml</code>.
*/
private void assertColorsMatchTheme1(RSyntaxTextArea textArea,
Gutter gutter) {
Assert.assertEquals(Color.orange, textArea.getBackground());
Assert.assertEquals(Color.orange, textArea.getCaretColor());
Assert.assertEquals(false, textArea.getUseSelectedTextColor());
Assert.assertEquals(Color.orange, textArea.getSelectedTextColor());
Assert.assertEquals(Color.orange, textArea.getSelectionColor());
Assert.assertEquals(true, textArea.getRoundedSelectionEdges());
Assert.assertEquals(Color.orange, textArea.getCurrentLineHighlightColor());
Assert.assertEquals(true, textArea.getFadeCurrentLineHighlight());
Assert.assertEquals(Color.orange, textArea.getMarginLineColor());
Assert.assertEquals(Color.orange, textArea.getMarkAllHighlightColor());
Assert.assertEquals(Color.orange, textArea.getMarkOccurrencesColor());
Assert.assertEquals(true, textArea.getPaintMarkOccurrencesBorder());
Assert.assertEquals(Color.orange, textArea.getMatchedBracketBGColor());
Assert.assertEquals(Color.orange, textArea.getMatchedBracketBorderColor());
Assert.assertEquals(true, textArea.getPaintMatchedBracketPair());
Assert.assertEquals(true, textArea.getAnimateBracketMatching());
Assert.assertEquals(Color.orange, textArea.getHyperlinkForeground());
for (int i=0; i<textArea.getSecondaryLanguageCount(); i++) {
Color expected = i==TokenTypes.IDENTIFIER ? Color.blue : Color.orange;
Assert.assertEquals(expected, textArea.getSecondaryLanguageBackground(i+1));
}
Assert.assertEquals(Color.orange, gutter.getBackground());
Assert.assertEquals(Color.orange, gutter.getBorderColor());
Assert.assertEquals(Color.orange, gutter.getActiveLineRangeColor());
Assert.assertEquals(true, gutter.getIconRowHeaderInheritsGutterBackground());
Assert.assertEquals(Color.orange, gutter.getLineNumberColor());
//Assert.assertEquals("Arial", gutter.getLineNumberFont().getFamily()); // Arial not on travis-ci build servers
Assert.assertEquals(22, gutter.getLineNumberFont().getSize());
Assert.assertEquals(Color.orange, gutter.getFoldIndicatorForeground());
Assert.assertEquals(Color.orange, gutter.getFoldBackground());
}
示例10: assertEqualThemeProperties
import org.fife.ui.rtextarea.Gutter; //导入依赖的package包/类
/**
* Asserts that all properties set by a {@link Theme} are equal
* between one text area/gutter pair and another.
*/
private void assertEqualThemeProperties(RSyntaxTextArea textArea1,
Gutter gutter1, RSyntaxTextArea textArea2, Gutter gutter2) {
Assert.assertEquals(textArea1.getFont(), textArea2.getFont());
Assert.assertEquals(textArea1.getSyntaxScheme(), textArea1.getSyntaxScheme());
Assert.assertEquals(textArea1.getBackground(), textArea2.getBackground());
Assert.assertEquals(textArea1.getCaretColor(), textArea2.getCaretColor());
Assert.assertEquals(textArea1.getUseSelectedTextColor(), textArea2.getUseSelectedTextColor());
Assert.assertEquals(textArea1.getSelectedTextColor(), textArea2.getSelectedTextColor());
Assert.assertEquals(textArea1.getSelectionColor(), textArea2.getSelectionColor());
Assert.assertEquals(textArea1.getRoundedSelectionEdges(), textArea2.getRoundedSelectionEdges());
Assert.assertEquals(textArea1.getCurrentLineHighlightColor(), textArea2.getCurrentLineHighlightColor());
Assert.assertEquals(textArea1.getFadeCurrentLineHighlight(), textArea2.getFadeCurrentLineHighlight());
Assert.assertEquals(textArea1.getMarginLineColor(), textArea2.getMarginLineColor());
Assert.assertEquals(textArea1.getMarkAllHighlightColor(), textArea2.getMarkAllHighlightColor());
Assert.assertEquals(textArea1.getMarkOccurrencesColor(), textArea2.getMarkOccurrencesColor());
Assert.assertEquals(textArea1.getPaintMarkOccurrencesBorder(), textArea2.getPaintMarkOccurrencesBorder());
Assert.assertEquals(textArea1.getMatchedBracketBGColor(), textArea2.getMatchedBracketBGColor());
Assert.assertEquals(textArea1.getMatchedBracketBorderColor(), textArea2.getMatchedBracketBorderColor());
Assert.assertEquals(textArea1.getPaintMatchedBracketPair(), textArea2.getPaintMatchedBracketPair());
Assert.assertEquals(textArea1.getAnimateBracketMatching(), textArea2.getAnimateBracketMatching());
Assert.assertEquals(textArea1.getHyperlinkForeground(), textArea2.getHyperlinkForeground());
Assert.assertEquals(gutter1.getBackground(), gutter2.getBackground());
Assert.assertEquals(gutter1.getBorderColor(), gutter2.getBorderColor());
Assert.assertEquals(gutter1.getActiveLineRangeColor(), gutter2.getActiveLineRangeColor());
Assert.assertEquals(gutter1.getIconRowHeaderInheritsGutterBackground(), gutter2.getIconRowHeaderInheritsGutterBackground());
Assert.assertEquals(gutter1.getLineNumberColor(), gutter2.getLineNumberColor());
Assert.assertEquals(gutter1.getLineNumberFont(), gutter2.getLineNumberFont());
Assert.assertEquals(gutter1.getFoldIndicatorForeground(), gutter2.getFoldIndicatorForeground());
Assert.assertEquals(gutter1.getFoldBackground(), gutter2.getFoldBackground());
}
示例11: initWithOddProperties
import org.fife.ui.rtextarea.Gutter; //导入依赖的package包/类
/**
* Initializes a text area and gutter pair with non-standard values for
* all properties loaded and saved by a <code>Theme</code>.
*
* @param textArea The text area to manipulate.
* @param gutter The gutter to manipulate.
*/
private void initWithOddProperties(RSyntaxTextArea textArea,
Gutter gutter) {
Font font = new Font("Dialog", Font.PLAIN, 13);
textArea.setFont(font);
textArea.setSyntaxScheme(createSyntaxScheme(font, Color.orange));
textArea.setBackground(Color.orange);
textArea.setCaretColor(Color.orange);
textArea.setUseSelectedTextColor(true);
textArea.setSelectedTextColor(Color.orange);
textArea.setSelectionColor(Color.orange);
textArea.setRoundedSelectionEdges(true);
textArea.setCurrentLineHighlightColor(Color.orange);
textArea.setFadeCurrentLineHighlight(true);
textArea.setMarginLineColor(Color.orange);
textArea.setMarkAllHighlightColor(Color.pink); // orange is the default (!)
textArea.setMarkOccurrencesColor(Color.orange);
textArea.setPaintMarkOccurrencesBorder(!textArea.getPaintMarkOccurrencesBorder());
textArea.setMatchedBracketBGColor(Color.orange);
textArea.setMatchedBracketBorderColor(Color.orange);
textArea.setPaintMatchedBracketPair(!textArea.getPaintMatchedBracketPair());
textArea.setAnimateBracketMatching(!textArea.getAnimateBracketMatching());
textArea.setHyperlinkForeground(Color.orange);
for (int i=0; i<textArea.getSecondaryLanguageCount(); i++) {
textArea.setSecondaryLanguageBackground(i+1, Color.orange);
}
gutter.setBackground(Color.orange);
gutter.setBorderColor(Color.orange);
gutter.setActiveLineRangeColor(Color.orange);
gutter.setIconRowHeaderInheritsGutterBackground(!gutter.getIconRowHeaderInheritsGutterBackground());
gutter.setLineNumberColor(Color.orange);
gutter.setLineNumberFont(font);
gutter.setFoldIndicatorForeground(Color.orange);
gutter.setFoldBackground(Color.orange);
}
示例12: testSave
import org.fife.ui.rtextarea.Gutter; //导入依赖的package包/类
@Test
public void testSave() throws Exception {
RSyntaxTextArea textArea1 = new RSyntaxTextArea(
SyntaxConstants.SYNTAX_STYLE_PHP);
RTextScrollPane sp1 = new RTextScrollPane(textArea1);
Gutter gutter1 = sp1.getGutter();
initWithOddProperties(textArea1, gutter1);
RSyntaxTextArea textArea2 = new RSyntaxTextArea(
SyntaxConstants.SYNTAX_STYLE_PHP);
RTextScrollPane sp2 = new RTextScrollPane(textArea2);
Gutter gutter2 = sp2.getGutter();
assertAllThemePropertiesDifferent(textArea1, gutter1, textArea2, gutter2);
Theme theme = new Theme(textArea1);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
theme.save(baos);
String actual = new String(baos.toByteArray(), "UTF-8");
baos.close();
ByteArrayInputStream bin = new ByteArrayInputStream(actual.getBytes("UTF-8"));
Theme theme2 = Theme.load(bin);
bin.close();
theme2.apply(textArea2);
assertEqualThemeProperties(textArea1, gutter1, textArea2, gutter2);
}
示例13: QueryEditor
import org.fife.ui.rtextarea.Gutter; //导入依赖的package包/类
public QueryEditor(SyntaxElementSource syntaxElementSource, CompletionsSource completionsSource,
ClientSettings clientSettings) {
Check.notNull(syntaxElementSource);
this.syntaxElementSource = syntaxElementSource;
this.completionsSource = completionsSource;
this.clientSettings = clientSettings;
queryText = createTextArea();
queryText.addParser(new GftParser(syntaxElementSource, onStartParsing, onFinshParsing));
queryText.setMarkOccurrences(false);
queryText.setHighlightCurrentLine(clientSettings.highlightCurrentLine);
queryText.setParserDelay(700);
waitStateDisplay = new WaitStateDisplay(queryText);
scrollPane = new RTextScrollPane(queryText, false);
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
Gutter gutter = scrollPane.getGutter();
gutter.setBookmarkingEnabled(true);
scrollPane.setIconRowHeaderEnabled(true);
scrollPane.setLineNumbersEnabled(clientSettings.lineNumbersEnabled);
setTheme(clientSettings.editorThemeXml);
URL url = getClass().getResource(Const.resourcePath + "bookmark.png");
gutter.setBookmarkIcon(new ImageIcon(url));
getContentPane().add(scrollPane);
ErrorStrip errorStrip = new ErrorStrip(queryText);
getContentPane().add(errorStrip, BorderLayout.LINE_END);
setCompletionProvider();
setTokenMaker();
queryText.setSyntaxEditingStyle(Const.languageId);
registerForLongOperationEvent();
}
示例14: handleDocumentEvent
import org.fife.ui.rtextarea.Gutter; //导入依赖的package包/类
private void handleDocumentEvent(DocumentEvent e, Shape a,
ViewFactory f) {
int n = calculateLineCount();
if (this.nlines != n) {
this.nlines = n;
WrappedSyntaxView.this.preferenceChanged(this, false, true);
// have to repaint any views after the receiver.
RSyntaxTextArea textArea = (RSyntaxTextArea) getContainer();
textArea.repaint();
// Must also revalidate container so gutter components, such
// as line numbers, get updated for this line's new height
Container parent = textArea.getParent();
if (parent instanceof JViewport &&
parent.getParent() instanceof RTextScrollPane) {
RTextScrollPane sp = (RTextScrollPane) parent.getParent();
Gutter gutter = sp.getGutter();
if (gutter != null) {
gutter.revalidate();
gutter.repaint();
}
}
}
else if (a != null) {
Component c = getContainer();
Rectangle alloc = (Rectangle) a;
c.repaint(alloc.x, alloc.y, alloc.width, alloc.height);
}
}
示例15: Theme
import org.fife.ui.rtextarea.Gutter; //导入依赖的package包/类
/**
* Creates a theme from an RSyntaxTextArea. It should be contained in
* an <code>RTextScrollPane</code> to get all gutter color information.
*
* @param textArea The text area.
*/
public Theme(RSyntaxTextArea textArea) {
baseFont = textArea.getFont();
bgColor = textArea.getBackground();
caretColor = textArea.getCaretColor();
useSelctionFG = textArea.getUseSelectedTextColor();
selectionFG = textArea.getSelectedTextColor();
selectionBG = textArea.getSelectionColor();
selectionRoundedEdges = textArea.getRoundedSelectionEdges();
currentLineHighlight = textArea.getCurrentLineHighlightColor();
fadeCurrentLineHighlight = textArea.getFadeCurrentLineHighlight();
marginLineColor = textArea.getMarginLineColor();
markAllHighlightColor = textArea.getMarkAllHighlightColor();
markOccurrencesColor = textArea.getMarkOccurrencesColor();
markOccurrencesBorder = textArea.getPaintMarkOccurrencesBorder();
matchedBracketBG = textArea.getMatchedBracketBGColor();
matchedBracketFG = textArea.getMatchedBracketBorderColor();
matchedBracketHighlightBoth = textArea.getPaintMatchedBracketPair();
matchedBracketAnimate = textArea.getAnimateBracketMatching();
hyperlinkFG = textArea.getHyperlinkForeground();
int count = textArea.getSecondaryLanguageCount();
secondaryLanguages = new Color[count];
for (int i=0; i<count; i++) {
secondaryLanguages[i]= textArea.getSecondaryLanguageBackground(i+1);
}
scheme = textArea.getSyntaxScheme();
Gutter gutter = RSyntaxUtilities.getGutter(textArea);
if (gutter!=null) {
bgColor = gutter.getBackground();
gutterBorderColor = gutter.getBorderColor();
activeLineRangeColor = gutter.getActiveLineRangeColor();
iconRowHeaderInheritsGutterBG = gutter.getIconRowHeaderInheritsGutterBackground();
lineNumberColor = gutter.getLineNumberColor();
lineNumberFont = gutter.getLineNumberFont().getFamily();
lineNumberFontSize = gutter.getLineNumberFont().getSize();
foldIndicatorFG = gutter.getFoldIndicatorForeground();
foldBG = gutter.getFoldBackground();
}
}