/** * Overridden to set width of this component correctly when we are first * displayed (as keying off of the RTextArea gives us (0,0) when it isn't * yet displayed. */ @Override public void addNotify() { super.addNotify(); if (textArea!=null) { l.install(textArea); // Won't double-install } updateCellWidths(); updateCellHeights(); }
protected void handleDocumentEvent(DocumentEvent e) { for (int i=0; i<getComponentCount(); i++) { AbstractGutterComponent agc = (AbstractGutterComponent)getComponent(i); agc.handleDocumentEvent(e); } }
AbstractGutterComponent agc = (AbstractGutterComponent)getComponent(i); agc.lineHeightsChanged();
/** * Constructor. * * @param textArea The text area. */ AbstractGutterComponent(RTextArea textArea) { init(); // Called before setTextArea(). setTextArea(textArea); }
/** * Sets the text area being displayed. This will clear any tracking * icons currently displayed. * * @param textArea The text area. */ @Override public void setTextArea(RTextArea textArea) { removeAllTrackingIcons(); super.setTextArea(textArea); }
/** * Called when this component is removed from the view hierarchy. */ @Override public void removeNotify() { super.removeNotify(); if (textArea!=null) { l.uninstall(textArea); } }
/** * Sets the text area being displayed. Subclasses can override, but * should call the super implementation. * * @param textArea The text area. */ public void setTextArea(RTextArea textArea) { this.textArea = textArea; int lineCount = textArea==null ? 0 : textArea.getLineCount(); if (currentLineCount!=lineCount) { currentLineCount = lineCount; repaint(); } }
/** * Overridden to ensure line number cell sizes are updated with the * font size change. * * @param font The new font to use for line numbers. */ @Override public void setFont(Font font) { super.setFont(font); updateCellWidths(); updateCellHeights(); }
/** * {@inheritDoc} */ @Override public void updateUI() { super.updateUI(); // Does nothing updateBackground(); }
/** * Returns the parent <code>Gutter</code> component. * * @return The parent <code>Gutter</code>. */ protected Gutter getGutter() { Container parent = getParent(); return (parent instanceof Gutter) ? (Gutter)parent : null; }
/** * Overridden to use the editor's background if it's detected that the * user isn't using white as the editor bg, but the system's tool tip * background is yellow-ish. * * @return The tool tip. */ @Override public JToolTip createToolTip() { JToolTip tip = super.createToolTip(); Color textAreaBG = textArea.getBackground(); if (textAreaBG!=null && !Color.white.equals(textAreaBG)) { Color bg = TipUtil.getToolTipBackground(); // If current L&F's tool tip color is close enough to "yellow", // and we're not using the default text background of white, use // the editor background as the tool tip background. if (bg.getRed()>=240 && bg.getGreen()>=240 && bg.getBlue()>=200) { tip.setBackground(textAreaBG); } } return tip; }
/** * Overridden so we can track when code folding is enabled/disabled. */ @Override public void setTextArea(RTextArea textArea) { if (this.textArea!=null) { this.textArea.removePropertyChangeListener( RSyntaxTextArea.CODE_FOLDING_PROPERTY, listener); } super.setTextArea(textArea); if (this.textArea!=null) { this.textArea.addPropertyChangeListener( RSyntaxTextArea.CODE_FOLDING_PROPERTY, listener); } }
/** * Constructor. * * @param textArea The text area. */ AbstractGutterComponent(RTextArea textArea) { init(); // Called before setTextArea(). setTextArea(textArea); }
/** * Called when this component is removed from the view hierarchy. */ @Override public void removeNotify() { super.removeNotify(); if (textArea!=null) { l.uninstall(textArea); } }
/** * Sets the text area being displayed. Subclasses can override, but * should call the super implementation. * * @param textArea The text area. */ public void setTextArea(RTextArea textArea) { this.textArea = textArea; int lineCount = textArea==null ? 0 : textArea.getLineCount(); if (currentLineCount!=lineCount) { currentLineCount = lineCount; repaint(); } }
/** * Overridden to ensure line number cell sizes are updated with the * font size change. * * @param font The new font to use for line numbers. */ @Override public void setFont(Font font) { super.setFont(font); updateCellWidths(); updateCellHeights(); }
/** * {@inheritDoc} */ @Override public void updateUI() { super.updateUI(); // Does nothing updateBackground(); }
/** * Returns the parent <code>Gutter</code> component. * * @return The parent <code>Gutter</code>. */ protected Gutter getGutter() { Container parent = getParent(); return (parent instanceof Gutter) ? (Gutter)parent : null; }
/** * Overridden to use the editor's background if it's detected that the * user isn't using white as the editor bg, but the system's tool tip * background is yellow-ish. * * @return The tool tip. */ @Override public JToolTip createToolTip() { JToolTip tip = super.createToolTip(); Color textAreaBG = textArea.getBackground(); if (textAreaBG!=null && !Color.white.equals(textAreaBG)) { Color bg = TipUtil.getToolTipBackground(); // If current L&F's tool tip color is close enough to "yellow", // and we're not using the default text background of white, use // the editor background as the tool tip background. if (bg.getRed()>=240 && bg.getGreen()>=240 && bg.getBlue()>=200) { tip.setBackground(textAreaBG); } } return tip; }
/** * Sets the text area being displayed. * * @param textArea The text area. */ @Override public void setTextArea(RTextArea textArea) { if (l==null) { l = new Listener(); } if (this.textArea!=null) { l.uninstall(textArea); } super.setTextArea(textArea); lastVisibleLine = calculateLastVisibleLineNumber(); if (textArea!=null) { l.install(textArea); // Won't double-install updateCellHeights(); updateCellWidths(); } }