public final Dimension getPreferredSize() { Dimension result; if (inner == null) { //Use the renderer infrastructure to do it if we're not initialized result = new RendererPropertyDisplayer(getProperty()).getRenderer(this).getPreferredSize(); } else { result = inner.getPreferredSize(); } return result; }
public void setUseLabels(boolean useLabels) { if (useLabels != this.useLabels) { Dimension oldPreferredSize = null; if (isShowing()) { JComponent innermost = findInnermostRenderer(getRenderer(this)); if (innermost instanceof RadioInplaceEditor || innermost instanceof JCheckBox) { oldPreferredSize = getPreferredSize(); } } this.useLabels = useLabels; if (oldPreferredSize != null) { firePropertyChange("preferredSize", oldPreferredSize, getPreferredSize()); //NOI18N } } }
public void setShowCustomEditorButton(boolean val) { //A property saying it doesn't want the custom editor button should //always override anything set on the property panel. if (getProperty() != null) { Boolean explicit = (Boolean) getProperty().getValue("suppressCustomEditor"); //NOI18N if (explicit != null) { val = explicit.booleanValue(); } } if (showCustomEditorButton != val) { prefSize = null; Dimension oldPreferredSize = null; if (isShowing()) { oldPreferredSize = getPreferredSize(); } showCustomEditorButton = val; if (oldPreferredSize != null) { firePropertyChange("preferredSize", oldPreferredSize, getPreferredSize()); //NOI18N repaint(); } } }
/** Convenience method to allow reuse of mutable renderer components - * will either create a renderer or reuse the current displayer if there * is one and it's a renderer */ private RendererPropertyDisplayer getRendererComponent(Node.Property prop) { RendererPropertyDisplayer result; if (inner instanceof RendererPropertyDisplayer) { //re-use the one we already have if possible ((RendererPropertyDisplayer) inner).setProperty(prop); result = (RendererPropertyDisplayer) inner; } else { result = new RendererPropertyDisplayer(prop); } return result; }
public void setProperty(Property prop) { if (prop == null) { throw new NullPointerException("Property cannot be null"); //NOI18N } if (prop != this.prop) { this.prop = prop; prefSize = null; if (isShowing()) { firePropertyChange("preferredSize", null, null); //NOI18N } repaint(); } }
protected void prepareRenderer(JComponent comp) { comp.setBackground(getBackground()); comp.setForeground(getForeground()); comp.setBounds(0, 0, getWidth(), getHeight()); JComponent innermost; if ((innermost = findInnermostRenderer(comp)) instanceof JComboBox) { if (comp.getLayout() != null) { comp.getLayout().layoutContainer(comp); } } if (!isTableUI() && ((InplaceEditor) comp).supportsTextEntry()) { innermost.setBackground(PropUtils.getTextFieldBackground()); innermost.setForeground(PropUtils.getTextFieldForeground()); } }
public void paintComponent(Graphics g) { //Hack for issue 38132 - Beans are set via TTVBridge as a package //private property on the parent PropertyPanel (if there is one). //FindBeans() will locate the beans either in the model or as a //property of the PropertyPanel (if an esoteric undocumented client property //is set on the PropertyPanel). RendererFactory will set the env //value (if there is an env) to the value of ReusablePropertyEnv.NODE //(a performance hack to avoid creating 1 property env for each property //painted each time we paint). Cool, huh? reusableEnv.setNode(EditorPropertyDisplayer.findBeans(this)); JComponent comp = getRenderer(this); prepareRenderer(comp); comp.setBounds(0,0,getWidth(),getHeight()); if (comp instanceof InplaceEditor) { Component inner = findInnermostRenderer(comp); SwingUtilities.paintComponent (g, comp, this, 0, 0, getWidth(), getHeight()); return; } comp.paint(g); }
public void setRadioButtonMax(int i) { if (i != radioButtonMax) { Dimension oldPreferredSize = null; if (isShowing()) { oldPreferredSize = getPreferredSize(); } int old = radioButtonMax; radioButtonMax = i; if (oldPreferredSize != null) { //see if the change will affect anything PropertyEditor ed = PropUtils.getPropertyEditor(prop); String[] tags = ed.getTags(); if (tags != null) { if ((tags.length >= i) != (tags.length >= old)) { firePropertyChange("preferredSize", oldPreferredSize, getPreferredSize()); //NOI18N } } } } }
public String toString() { StringBuffer sb = new StringBuffer("Inline editor for property "); //NOI18N sb.append(getProperty().getDisplayName()); sb.append(" = "); //NOI18N sb.append(getProperty()); sb.append(" inplace editor="); //NOI18N if (!inGetRenderer) { try { sb.append(getRenderer(this)); } catch (Exception e) { sb.append(e); } } return sb.toString(); }
public final boolean isShowCustomEditorButton() { boolean result = showCustomEditorButton; if (getProperty() != null) { Boolean explicit = (Boolean) getProperty().getValue("suppressCustomEditor"); //NOI18N if (explicit != null) { result = !explicit.booleanValue(); } } return result; }
public Dimension getPreferredSize() { Dimension result; if (!isDisplayable() && ((preferences & PREF_CUSTOM_EDITOR) == 0)) { //XXX use rendererfactory to make this more efficient and just //configure a shared renderer instacne with the property & fetch size result = getRendererComponent(getProperty()).getComponent().getPreferredSize(); } else if (inner != null) { result = inner.getPreferredSize(); } else { result = PropUtils.getMinimumPanelSize(); } return result; }
protected void prepareRenderer(JComponent comp) { comp.setBackground(getBackground()); comp.setForeground(getForeground()); comp.setBounds(0,0,getWidth(),getHeight()); JComponent innermost; if ((innermost = findInnermostRenderer(comp)) instanceof JComboBox) { if (comp.getLayout() != null) { comp.getLayout().layoutContainer(comp); } } if (!isTableUI() && ((InplaceEditor) comp).supportsTextEntry()) { innermost.setBackground(PropUtils.getTextFieldBackground()); innermost.setForeground(PropUtils.getTextFieldForeground()); } }
public void paintComponent(Graphics g) { //Hack for issue 38132 - Beans are set via TTVBridge as a package //private property on the parent PropertyPanel (if there is one). //FindBeans() will locate the beans either in the model or as a //property of the PropertyPanel (if an esoteric undocumented client property //is set on the PropertyPanel). RendererFactory will set the env //value (if there is an env) to the value of ReusablePropertyEnv.NODE //(a performance hack to avoid creating 1 property env for each property //painted each time we paint). Cool, huh? reusableEnv.setNode(EditorPropertyDisplayer.findBeans(this)); JComponent comp = getRenderer(this); prepareRenderer(comp); comp.setBounds(0, 0, getWidth(), getHeight()); if (comp instanceof InplaceEditor) { Component inner = findInnermostRenderer(comp); SwingUtilities.paintComponent(g, comp, this, 0, 0, getWidth(), getHeight()); removeAll(); return; } comp.paint(g); }
public void setProperty(Property prop) { if (prop == null) { throw new NullPointerException("Property cannot be null"); //NOI18N } if (prop != this.prop) { this.prop = prop; prefSize = null; if (isShowing()) { firePropertyChange("preferredSize",null,null); //NOI18N } repaint(); } }
public void setRadioButtonMax(int i) { if (i != radioButtonMax) { Dimension oldPreferredSize = null; if (isShowing()) { oldPreferredSize = getPreferredSize(); } int old = radioButtonMax; radioButtonMax = i; if (oldPreferredSize != null) { //see if the change will affect anything PropertyEditor ed = PropUtils.getPropertyEditor(prop); String[] tags = ed.getTags(); if (tags != null) { if (tags.length >= i != tags.length >= old) { firePropertyChange("preferredSize", oldPreferredSize, getPreferredSize()); //NOI18N } } } } }
/** Convenience method to allow reuse of mutable renderer components - * will either create a renderer or reuse the current displayer if there * is one and it's a renderer */ private RendererPropertyDisplayer getRendererComponent(Node.Property prop) { RendererPropertyDisplayer result; if (inner instanceof RendererPropertyDisplayer) { //re-use the one we already have if possible ((RendererPropertyDisplayer) inner).setProperty(prop); result = (RendererPropertyDisplayer) inner; } else { result = new RendererPropertyDisplayer(prop); } return result; }
public String toString() { StringBuffer sb = new StringBuffer("Inline editor for property "); //NOI18N sb.append(getProperty().getDisplayName()); sb.append(" = "); //NOI18N sb.append(getProperty()); sb.append(" inplace editor="); //NOI18N if (!inGetRenderer) { try { sb.append(getRenderer(this)); } catch (Exception e) { sb.append(e); } } return sb.toString(); }
public final boolean isShowCustomEditorButton() { boolean result = showCustomEditorButton; if (getProperty() != null) { Boolean explicit = (Boolean) getProperty().getValue( "suppressCustomEditor"); //NOI18N if (explicit != null) { result = !explicit.booleanValue(); } } return result; }
public Dimension getPreferredSize() { Dimension result; if (!isDisplayable() && (preferences & PREF_CUSTOM_EDITOR) == 0) { //XXX use rendererfactory to make this more efficient and just //configure a shared renderer instacne with the property & fetch size result = getRendererComponent( getProperty()).getComponent().getPreferredSize(); } else if (inner != null) { result = inner.getPreferredSize(); } else { result = PropUtils.getMinimumPanelSize(); } return result; }