Search in sources :

Example 1 with BaseCloseable

use of com.revolsys.io.BaseCloseable in project com.revolsys.open by revolsys.

the class ArcGisResponse method refresh.

@Override
public final void refresh() {
    synchronized (this.resfreshSync) {
        try (BaseCloseable noCache = FileResponseCache.disable()) {
            refreshDo();
            this.hasError = false;
        } catch (final WrappedException e) {
            this.hasError = true;
            final Throwable cause = Exceptions.unwrap(e);
            if (cause instanceof UnknownHostException) {
                Logs.error(this, "Cannot find host " + cause.getMessage());
            }
        } catch (final Throwable e) {
            this.hasError = true;
            throw Exceptions.wrap("Unable to initialize: " + this, e);
        }
    }
}
Also used : BaseCloseable(com.revolsys.io.BaseCloseable) WrappedException(com.revolsys.util.WrappedException) UnknownHostException(java.net.UnknownHostException)

Example 2 with BaseCloseable

use of com.revolsys.io.BaseCloseable in project com.revolsys.open by revolsys.

the class AbstractRecordQueryField method valueChanged.

@Override
public void valueChanged(final ListSelectionEvent e) {
    if (!e.getValueIsAdjusting() && this.eventsEnabled.isTrue()) {
        try (final BaseCloseable eventsEnabled = eventsDisabled()) {
            final Record record = (Record) this.list.getSelectedValue();
            if (record != null) {
                setSelectedRecord(record);
                final Identifier identifier = record.getIdentifier();
                final String label = record.getString(this.displayField);
                this.idToDisplayMap.put(identifier, label);
                if (!DataType.equal(label, this.searchField.getText())) {
                    this.searchField.setFieldValue(label);
                }
                super.setFieldValue(identifier);
            }
            this.menu.setVisible(false);
            this.searchField.requestFocus();
        }
    }
}
Also used : BaseCloseable(com.revolsys.io.BaseCloseable) Identifier(com.revolsys.identifier.Identifier) Record(com.revolsys.record.Record)

Example 3 with BaseCloseable

use of com.revolsys.io.BaseCloseable in project com.revolsys.open by revolsys.

the class LayerRecordForm method setValues.

public final void setValues(final Map<String, Object> values) {
    if (values != null) {
        Invoke.later(() -> {
            final Set<String> fieldNames = values.keySet();
            try (final BaseCloseable c = setFieldValidationEnabled(false)) {
                this.fieldValues.putAll(values);
                for (final String fieldName : fieldNames) {
                    final Object value = values.get(fieldName);
                    final JComponent field = (JComponent) getField(fieldName);
                    if (field != null) {
                        SwingUtil.setFieldValue(field, value);
                    }
                }
            }
            validateFields(fieldNames);
        });
    }
}
Also used : BaseCloseable(com.revolsys.io.BaseCloseable) JComponent(javax.swing.JComponent)

Example 4 with BaseCloseable

use of com.revolsys.io.BaseCloseable in project com.revolsys.open by revolsys.

the class AbstractLayer method setName.

@Override
public void setName(final String name) {
    final Object oldValue = this.name;
    final LayerGroup layerGroup = getLayerGroup();
    String newName = name;
    if (layerGroup != null) {
        int i = 1;
        while (layerGroup.hasLayerWithSameName(this, newName)) {
            newName = name + i;
            i++;
        }
    }
    this.name = newName;
    try (final BaseCloseable eventsEnabled = eventsEnabled()) {
        firePropertyChange("name", oldValue, this.name);
    }
}
Also used : BaseCloseable(com.revolsys.io.BaseCloseable) ScrollableSizeHint(org.jdesktop.swingx.ScrollableSizeHint)

Example 5 with BaseCloseable

use of com.revolsys.io.BaseCloseable in project com.revolsys.open by revolsys.

the class AbstractLayer method setIcon.

public void setIcon(final Icon icon) {
    final Object oldValue = this.icon;
    this.icon = icon;
    try (final BaseCloseable eventsEnabled = eventsEnabled()) {
        firePropertyChange("icon", oldValue, icon);
    }
}
Also used : BaseCloseable(com.revolsys.io.BaseCloseable)

Aggregations

BaseCloseable (com.revolsys.io.BaseCloseable)46 Point (com.revolsys.geometry.model.Point)9 BoundingBox (com.revolsys.geometry.model.BoundingBox)8 Geometry (com.revolsys.geometry.model.Geometry)7 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)6 Polygon (com.revolsys.geometry.model.Polygon)6 Record (com.revolsys.record.Record)5 LineString (com.revolsys.geometry.model.LineString)4 Identifier (com.revolsys.identifier.Identifier)4 RecordReader (com.revolsys.record.io.RecordReader)4 Graphics2D (java.awt.Graphics2D)4 ArrayList (java.util.ArrayList)4 Vertex (com.revolsys.geometry.model.vertex.Vertex)3 RecordDefinition (com.revolsys.record.schema.RecordDefinition)3 CloseableAffineTransform (com.revolsys.awt.CloseableAffineTransform)2 GeoreferencedImage (com.revolsys.raster.GeoreferencedImage)2 ArrayRecord (com.revolsys.record.ArrayRecord)2 RecordStore (com.revolsys.record.schema.RecordStore)2 Resource (com.revolsys.spring.resource.Resource)2 MapPanel (com.revolsys.swing.map.MapPanel)2