Example usage for java.awt Component validate

List of usage examples for java.awt Component validate

Introduction

In this page you can find the example usage for java.awt Component validate.

Prototype

public void validate() 

Source Link

Document

Validates this component.

Usage

From source file:org.pentaho.reporting.designer.core.editor.report.AbstractRenderComponent.java

protected boolean installEditor(final ReportElementInlineEditor inlineEditor, final Element element) {
    if (inlineEditor == null) {
        throw new NullPointerException();
    }/*from  w w  w .jav a2 s. com*/

    this.inlineEditor = inlineEditor;

    final CachedLayoutData data = ModelUtility.getCachedLayoutData(element);
    if (data == null) {
        removeEditor();
        return false;
    }
    final Component editorComponent = inlineEditor.getElementCellEditorComponent(this, element);
    if (editorComponent == null) {
        removeEditor();
        return false;
    }

    if (editorRemover == null) {
        final KeyboardFocusManager fm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        editorRemover = new CellEditorRemover(fm);
        fm.addPropertyChangeListener("permanentFocusOwner", editorRemover); // NON-NLS
    }

    this.editorComponent = editorComponent;

    final float zoomFactor = getRenderContext().getZoomModel().getZoomAsPercentage();

    final Rectangle2D bounds = getElementRenderer().getBounds();
    final int x = (int) ((getLeftBorder() + StrictGeomUtility.toExternalValue(data.getX())) * zoomFactor);
    final int y = (int) ((getTopBorder()
            + (StrictGeomUtility.toExternalValue(data.getY()) - bounds.getY()) * zoomFactor));
    final int width = (int) (StrictGeomUtility.toExternalValue(data.getWidth()) * zoomFactor);
    final int height = (int) (StrictGeomUtility.toExternalValue(data.getHeight()) * zoomFactor);
    editorComponent.setBounds(x, y, width, height);
    add(editorComponent);
    editorComponent.validate();
    inlineEditor.addCellEditorListener(this);

    List<Element> selectedElements = getRenderContext().getSelectionModel()
            .getSelectedElementsOfType(Element.class);
    final Element[] visualElements = selectedElements.toArray(new Element[selectedElements.size()]);
    if (visualElements.length > 0) {
        oldValues = new ArrayList<Object>();
        for (int i = 0; i < visualElements.length; i++) {
            final Object attribute = visualElements[i].getAttribute(AttributeNames.Core.NAMESPACE,
                    AttributeNames.Core.VALUE);
            oldValues.add(attribute);
        }
    }

    return true;
}

From source file:org.shaman.rpg.editor.dialog.DialogVisualElement.java

private void recursiveValidate(Component p) {
    if (p instanceof Container) {
        for (Component c : ((Container) p).getComponents()) {
            recursiveValidate(c);//from  w  w  w .j a va  2  s.  c  o m
        }
    }
    p.invalidate();
    p.validate();
}