/** * Fetches the container hosting the view. This is useful for * things like scheduling a repaint, finding out the host * components font, etc. The default implementation * of this is to forward the query to the parent view. * * @return the container */ public Container getContainer() { EditorUI editorUI = getEditorUI(); return (editorUI==null) ? null : editorUI.getComponent(); }
/** Construct new word match over given view manager */ public WordMatch(EditorUI editorUI) { this.editorUI = editorUI; Settings.addSettingsChangeListener(this); synchronized (editorUI.getComponentLock()) { // if component already installed in EditorUI simulate installation JTextComponent component = editorUI.getComponent(); if (component != null) { propertyChange(new PropertyChangeEvent(editorUI, EditorUI.COMPONENT_PROPERTY, null, component)); } editorUI.addPropertyChangeListener(this); } }
protected int getHeightDimension() { if (editorUI == null) return 0; JComponent comp = editorUI.getComponent(); if (comp == null) return 0; return highestLineNumber * lineHeight + (int)comp.getSize().getHeight(); }
/** Construct new word match over given view manager */ public WordMatch(EditorUI editorUI) { this.editorUI = editorUI; Settings.addSettingsChangeListener(this); synchronized (editorUI.getComponentLock()) { // if component already installed in EditorUI simulate installation JTextComponent component = editorUI.getComponent(); if (component != null) { propertyChange(new PropertyChangeEvent(editorUI, EditorUI.COMPONENT_PROPERTY, null, component)); } editorUI.addPropertyChangeListener(this); } }
protected int getHeightDimension() { JComponent comp = editorUI.getComponent(); if (comp == null) return 0; return highestLineNumber * lineHeight + (int) comp.getSize().getHeight(); }
public Abbrev(EditorUI editorUI, boolean checkDocText, boolean checkTextDelimiter) { this.editorUI = editorUI; this.checkDocText = checkDocText; this.checkTextDelimiter = checkTextDelimiter; Settings.addSettingsChangeListener(this); synchronized (editorUI.getComponentLock()) { // if component already installed in EditorUI simulate installation JTextComponent component = editorUI.getComponent(); if (component != null) { propertyChange(new PropertyChangeEvent(editorUI, EditorUI.COMPONENT_PROPERTY, null, component)); } editorUI.addPropertyChangeListener(this); } }
public void focusGained(FocusEvent evt) { Registry.activate(getComponent()); } };
public void popupMenuCanceled(PopupMenuEvent e2) { editorUI.getComponent().requestFocus(); }
public void popupMenuWillBecomeInvisible(PopupMenuEvent e2) { editorUI.getComponent().requestFocus(); }
private void updateRenderingHints(){ JTextComponent comp = editorUI.getComponent(); if (comp == null) return; Object value = Settings.getValue(Utilities.getKitClass(comp), SettingsNames.RENDERING_HINTS); renderingHints = (value instanceof Map) ? (java.util.Map)value : null; }
private int getLineFromMouseEvent(MouseEvent e){ int line = -1; if (editorUI != null) { try{ JTextComponent component = editorUI.getComponent(); BaseTextUI textUI = (BaseTextUI)component.getUI(); int clickOffset = textUI.viewToModel(component, new Point(0, e.getY())); line = Utilities.getLineOffset(doc, clickOffset); }catch (BadLocationException ble){ } } return line; }
/** GlyphGutter copy pasted utility method. */ private int getLineFromMouseEvent(MouseEvent e){ int line = -1; if (editorUI != null) { try{ JTextComponent component = editorUI.getComponent(); BaseTextUI textUI = (BaseTextUI)component.getUI(); int clickOffset = textUI.viewToModel(component, new Point(0, e.getY())); line = Utilities.getLineOffset(doc, clickOffset); }catch (BadLocationException ble){ } } return line; }
private void updateRenderingHints(Graphics g){ JTextComponent comp = editorUI.getComponent(); if (comp == null) return; Object value = Settings.getValue(Utilities.getKitClass(comp), SettingsNames.RENDERING_HINTS); Map renderingHints = (value instanceof Map) ? (java.util.Map)value : null; // Possibly apply the rendering hints if (renderingHints != null) { ((java.awt.Graphics2D)g).setRenderingHints(renderingHints); } }
public void init(DrawContext ctx) { JTextComponent c = ctx.getEditorUI().getComponent(); gColor = graphics.getColor(); gFont = graphics.getFont(); // initialize reference to annotations annos = ctx.getEditorUI().getDocument().getAnnotations(); }
public void focusGained(FocusEvent evt) { Registry.activate(getComponent()); /* Fix of #25475 - copyAction's enabled flag * must be updated on focus change */ stateChanged(null); if (component!=null){ BaseTextUI ui = (BaseTextUI)component.getUI(); if (ui!=null) ui.refresh(); } } };
public boolean expandString(char typedChar, String expandStr, ActionEvent evt) throws BadLocationException { if (expandString(expandStr, evt)) { if (addTypedAcceptor.accept(typedChar)) { int dotPos = editorUI.getComponent().getCaret().getDot(); editorUI.getDocument().insertString(dotPos, String.valueOf(typedChar), null); } return true; } return false; }
public boolean expandString(char typedChar, String expandStr, ActionEvent evt) throws BadLocationException { if (expandString(expandStr, evt)) { if (addTypedAcceptor.accept(typedChar)) { int dotPos = editorUI.getComponent().getCaret().getDot(); editorUI.getDocument().insertString(dotPos, String.valueOf(typedChar), null); } return true; } return false; }
public boolean isActive(DrawContext ctx, MarkFactory.DrawMark mark) { boolean active; if (mark != null) { active = mark.activateLayer; } else { JTextComponent c = ctx.getEditorUI().getComponent(); active = (c != null) && c.getCaret().isSelectionVisible() && ctx.getFragmentOffset() >= c.getSelectionStart() && ctx.getFragmentOffset() < c.getSelectionEnd(); } return active; }
public boolean isActive(DrawContext ctx, MarkFactory.DrawMark mark) { boolean active; if (mark != null) { active = mark.activateLayer; } else { JTextComponent c = ctx.getEditorUI().getComponent(); active = (c != null) && c.getCaret().isSelectionVisible() && ctx.getFragmentOffset() >= c.getSelectionStart() && ctx.getFragmentOffset() < c.getSelectionEnd(); } return active; }
public void init(DrawContext ctx) { JTextComponent c = ctx.getEditorUI().getComponent(); // initialize reference to annotations annos = ctx.getEditorUI().getDocument().getAnnotations(); drawTextLimitLine = ctx.getEditorUI().textLimitLineVisible; textLimitWidth = ctx.getEditorUI().textLimitWidth; defaultSpaceWidth = ctx.getEditorUI().defaultSpaceWidth; textLimitLineColor = ctx.getEditorUI().textLimitLineColor; absoluteX = ctx.getEditorUI().getTextMargin().left; maxWidth = ctx.getEditorUI().getExtentBounds().width; }