/** * Returns the y-coordinate of the line containing a specified offset.<p> * * This is faster than calling <code>modelToView(offs).y</code>, so it is * preferred if you do not need the actual bounding box. */ @Override public int yForLineContaining(int offs) throws BadLocationException { Rectangle alloc = getVisibleEditorRect(); if (alloc!=null) { RSTAView view = (RSTAView)getRootView(textArea).getView(0); return view.yForLineContaining(alloc, offs); } return -1; }
public static View getLeafViewAtPoint(Point p, View root, JEditorPane sourcePane) { int pos = sourcePane.viewToModel(p); View v = sourcePane.getUI().getRootView(sourcePane); while (v.getViewCount() > 0) { int i = v.getViewIndex(pos, Position.Bias.Forward); v = v.getView(i); } Shape alloc = getAllocation(root, sourcePane); if (alloc.contains(p)) { return v; } return null; }
private void resetBreakSpots() { for (int i = 0; i < layoutPool.getViewCount(); i++) { View v = layoutPool.getView(i); if (v instanceof WrapLabelView) { ((WrapLabelView) v).resetBreakSpots(); } } }
/** * Returns the y-coordinate of the specified line.<p> * * This method is quicker than using traditional * <code>modelToView(int)</code> calls, as the entire bounding box isn't * computed. */ @Override public int yForLine(int line) throws BadLocationException { Rectangle alloc = getVisibleEditorRect(); if (alloc!=null) { RSTAView view = (RSTAView)getRootView(textArea).getView(0); return view.yForLine(alloc, line); } return -1; }
private void resetBreakSpots() { for (int i = 0; i < layoutPool.getViewCount(); i++) { View v = layoutPool.getView(i); if (v instanceof ViewLabel) { ((ViewLabel) v).resetBreakSpots(); } } } }
private void refreshFontMetrics(Graphics2D g2d) { // It is assumed that any rendering hints are already applied to g2d. defaultFontMetrics = g2d.getFontMetrics(getFont()); syntaxScheme.refreshFontMetrics(g2d); if (!getLineWrap()) { // HORRIBLE HACK! The un-wrapped view needs to refresh its cached // longest line information. SyntaxView sv = (SyntaxView)getUI().getRootView(this).getView(0); sv.calculateLongestLine(); } }
public static void updateRenderer(JXLabel c) { View value = null; View oldValue = (View) c.getClientProperty(BasicHTML.propertyKey); if (oldValue == null || oldValue instanceof Renderer) { value = createView(c); } if (value != oldValue && oldValue != null) { for (int i = 0; i < oldValue.getViewCount(); i++) { oldValue.getView(i).setParent(null); } } c.putClientProperty(BasicHTML.propertyKey, value); }
View v = ui.getRootView(textArea).getView(0); Document doc = textArea.getDocument(); Element root = doc.getDefaultRootElement();
public static void updateRenderer(JXLabel c) { View value = null; View oldValue = (View) c.getClientProperty(BasicHTML.propertyKey); if (oldValue == null || oldValue instanceof Renderer) { value = createView(c); } if (value != oldValue && oldValue != null) { for (int i = 0; i < oldValue.getViewCount(); i++) { oldValue.getView(i).setParent(null); } } c.putClientProperty(BasicHTML.propertyKey, value); }
View v = ui.getRootView(textArea).getView(0);
public static void updateRenderer(JXLabel c) { View value = null; View oldValue = (View) c.getClientProperty(BasicHTML.propertyKey); if (oldValue == null || oldValue instanceof Renderer) { value = createView(c); } if (value != oldValue && oldValue != null) { for (int i = 0; i < oldValue.getViewCount(); i++) { oldValue.getView(i).setParent(null); } } c.putClientProperty(BasicHTML.propertyKey, value); }
View v = ui.getRootView(textArea).getView(0);
public static void updateRenderer(JXLabel c) { View value = null; View oldValue = (View) c.getClientProperty(BasicHTML.propertyKey); if (oldValue == null || oldValue instanceof Renderer) { value = createView(c); } if (value != oldValue && oldValue != null) { for (int i = 0; i < oldValue.getViewCount(); i++) { oldValue.getView(i).setParent(null); } } c.putClientProperty(BasicHTML.propertyKey, value); }
public int updateIndex(int viewIndex, int offset, View view, FlyView.Parent flyParent) { while (--viewIndex >= 0) { int startOffset = (flyParent != null) ? flyParent.getStartOffset(viewIndex) : view.getView(viewIndex).getStartOffset(); if (startOffset != offset) { // view starts below offset if (lowerAdjacent) { viewIndex--; // return the lower view that ends at offset } break; } } return viewIndex + 1; }
public static void updateRenderer(JXLabel c) { View value = null; View oldValue = (View) c.getClientProperty(BasicHTML.propertyKey); if (oldValue == null || oldValue instanceof Renderer) { value = createView(c); } if (value != oldValue && oldValue != null) { for (int i = 0; i < oldValue.getViewCount(); i++) { oldValue.getView(i).setParent(null); } } c.putClientProperty(BasicHTML.propertyKey, value); }
/** * Returns the y-coordinate of the line containing a specified offset.<p> * * This is faster than calling <code>modelToView(offs).y</code>, so it is * preferred if you do not need the actual bounding box. */ @Override public int yForLineContaining(int offs) throws BadLocationException { Rectangle alloc = getVisibleEditorRect(); if (alloc!=null) { RSTAView view = (RSTAView)getRootView(textArea).getView(0); return view.yForLineContaining(alloc, offs); } return -1; }
private void refreshFontMetrics(Graphics2D g2d) { // It is assumed that any rendering hints are already applied to g2d. defaultFontMetrics = g2d.getFontMetrics(getFont()); syntaxScheme.refreshFontMetrics(g2d); if (getLineWrap()==false) { // HORRIBLE HACK! The un-wrapped view needs to refresh its cached // longest line information. SyntaxView sv = (SyntaxView)getUI().getRootView(this).getView(0); sv.calculateLongestLine(); } }
private void refreshFontMetrics(Graphics2D g2d) { // It is assumed that any rendering hints are already applied to g2d. defaultFontMetrics = g2d.getFontMetrics(getFont()); syntaxScheme.refreshFontMetrics(g2d); if (!getLineWrap()) { // HORRIBLE HACK! The un-wrapped view needs to refresh its cached // longest line information. SyntaxView sv = (SyntaxView)getUI().getRootView(this).getView(0); sv.calculateLongestLine(); } }
private void refreshFontMetrics(Graphics2D g2d) { // It is assumed that any rendering hints are already applied to g2d. defaultFontMetrics = g2d.getFontMetrics(getFont()); syntaxScheme.refreshFontMetrics(g2d); if (getLineWrap()==false) { // HORRIBLE HACK! The un-wrapped view needs to refresh its cached // longest line information. SyntaxView sv = (SyntaxView)getUI().getRootView(this).getView(0); sv.calculateLongestLine(); } }