arez.dom.Arez_BrowserLocation Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of arez-extras-dom Show documentation
Show all versions of arez-extras-dom Show documentation
Dom: Arez browser components that make DOM properties observable
The newest version!
package arez.dom;
import arez.ActionFlags;
import arez.Arez;
import arez.ArezContext;
import arez.Component;
import arez.ComputableValue;
import arez.Disposable;
import arez.ObservableValue;
import arez.SafeProcedure;
import arez.component.DisposeNotifier;
import arez.component.internal.ComponentKernel;
import java.util.Objects;
import javax.annotation.Nonnull;
import javax.annotation.processing.Generated;
import org.realityforge.braincheck.Guards;
@Generated("arez.processor.ArezProcessor")
@SuppressWarnings("unchecked")
final class Arez_BrowserLocation extends BrowserLocation implements Disposable, DisposeNotifier {
private static volatile int $$arezi$$_nextId;
private final ComponentKernel $$arezi$$_kernel;
@Nonnull
private final ObservableValue $$arez$$_location;
@Nonnull
private final ComputableValue $$arez$$_browserLocation;
Arez_BrowserLocation() {
super();
final ArezContext $$arezv$$_context = Arez.context();
final int $$arezv$$_id = ( Arez.areNamesEnabled() || Arez.areRegistriesEnabled() || Arez.areNativeComponentsEnabled() ) ? ++$$arezi$$_nextId : 0;
final String $$arezv$$_name = Arez.areNamesEnabled() ? "arez_dom_BrowserLocation." + $$arezv$$_id : null;
final Component $$arezv$$_component = Arez.areNativeComponentsEnabled() ? $$arezv$$_context.component( "arez_dom_BrowserLocation", $$arezv$$_id, $$arezv$$_name, this::$$arezi$$_nativeComponentPreDispose ) : null;
this.$$arezi$$_kernel = new ComponentKernel( Arez.areZonesEnabled() ? $$arezv$$_context : null, Arez.areNamesEnabled() ? $$arezv$$_name : null, $$arezv$$_id, Arez.areNativeComponentsEnabled() ? $$arezv$$_component : null, null, Arez.areNativeComponentsEnabled() ? null : this::$$arezi$$_dispose, null, true, false, false );
this.$$arez$$_location = $$arezv$$_context.observable( Arez.areNativeComponentsEnabled() ? $$arezv$$_component : null, Arez.areNamesEnabled() ? $$arezv$$_name + ".location" : null, Arez.arePropertyIntrospectorsEnabled() ? () -> ( this.$$arezi$$_kernel.isNotReady() ? null : super.getLocation() ) : null, Arez.arePropertyIntrospectorsEnabled() ? v -> super.setLocation( v ) : null );
this.$$arez$$_browserLocation = $$arezv$$_context.computable( Arez.areNativeComponentsEnabled() ? $$arezv$$_component : null, Arez.areNamesEnabled() ? $$arezv$$_name + ".browserLocation" : null, () -> super.getBrowserLocation(), this::onBrowserLocationActivate, this::onBrowserLocationDeactivate, ComputableValue.Flags.AREZ_OR_EXTERNAL_DEPENDENCIES | ComputableValue.Flags.RUN_LATER );
this.$$arezi$$_kernel.componentConstructed();
this.$$arezi$$_kernel.componentReady();
}
private int $$arezi$$_id() {
return this.$$arezi$$_kernel.getId();
}
private void $$arezi$$_nativeComponentPreDispose() {
this.$$arezi$$_kernel.notifyOnDisposeListeners();
}
@Override
public void addOnDisposeListener(@Nonnull final Object key, @Nonnull final SafeProcedure action) {
if ( Arez.shouldCheckApiInvariants() ) {
Guards.apiInvariant( () -> null != this.$$arezi$$_kernel && this.$$arezi$$_kernel.hasBeenInitialized(), () -> "Method named 'addOnDisposeListener' invoked on uninitialized component of type 'arez_dom_BrowserLocation'" );
}
this.$$arezi$$_kernel.addOnDisposeListener( key, action );
}
@Override
public void removeOnDisposeListener(@Nonnull final Object key) {
if ( Arez.shouldCheckApiInvariants() ) {
Guards.apiInvariant( () -> null != this.$$arezi$$_kernel && this.$$arezi$$_kernel.hasBeenInitialized(), () -> "Method named 'removeOnDisposeListener' invoked on uninitialized component of type 'arez_dom_BrowserLocation'" );
}
if ( Arez.shouldCheckApiInvariants() ) {
Guards.apiInvariant( () -> null != this.$$arezi$$_kernel && this.$$arezi$$_kernel.hasBeenConstructed(), () -> "Method named 'removeOnDisposeListener' invoked on un-constructed component named '" + ( null == this.$$arezi$$_kernel ? "?" : this.$$arezi$$_kernel.getName() ) + "'" );
}
this.$$arezi$$_kernel.removeOnDisposeListener( key );
}
@Override
public boolean isDisposed() {
if ( Arez.shouldCheckApiInvariants() ) {
Guards.apiInvariant( () -> null != this.$$arezi$$_kernel && this.$$arezi$$_kernel.hasBeenInitialized(), () -> "Method named 'isDisposed' invoked on uninitialized component of type 'arez_dom_BrowserLocation'" );
}
if ( Arez.shouldCheckApiInvariants() ) {
Guards.apiInvariant( () -> null != this.$$arezi$$_kernel && this.$$arezi$$_kernel.hasBeenConstructed(), () -> "Method named 'isDisposed' invoked on un-constructed component named '" + ( null == this.$$arezi$$_kernel ? "?" : this.$$arezi$$_kernel.getName() ) + "'" );
}
return this.$$arezi$$_kernel.isDisposed();
}
@Override
public void dispose() {
if ( Arez.shouldCheckApiInvariants() ) {
Guards.apiInvariant( () -> null != this.$$arezi$$_kernel && this.$$arezi$$_kernel.hasBeenInitialized(), () -> "Method named 'dispose' invoked on uninitialized component of type 'arez_dom_BrowserLocation'" );
}
if ( Arez.shouldCheckApiInvariants() ) {
Guards.apiInvariant( () -> null != this.$$arezi$$_kernel && this.$$arezi$$_kernel.hasBeenConstructed(), () -> "Method named 'dispose' invoked on un-constructed component named '" + ( null == this.$$arezi$$_kernel ? "?" : this.$$arezi$$_kernel.getName() ) + "'" );
}
this.$$arezi$$_kernel.dispose();
}
private void $$arezi$$_dispose() {
this.$$arez$$_browserLocation.dispose();
this.$$arez$$_location.dispose();
}
@Override
@Nonnull
public String getLocation() {
if ( Arez.shouldCheckApiInvariants() ) {
Guards.apiInvariant( () -> null != this.$$arezi$$_kernel && this.$$arezi$$_kernel.isActive(), () -> "Method named 'getLocation' invoked on " + this.$$arezi$$_kernel.describeState() + " component named '" + this.$$arezi$$_kernel.getName() + "'" );
}
this.$$arez$$_location.reportObserved();
return super.getLocation();
}
@Override
void setLocation(@Nonnull final String location) {
if ( Arez.shouldCheckApiInvariants() ) {
Guards.apiInvariant( () -> null != this.$$arezi$$_kernel && this.$$arezi$$_kernel.isActive(), () -> "Method named 'setLocation' invoked on " + this.$$arezi$$_kernel.describeState() + " component named '" + this.$$arezi$$_kernel.getName() + "'" );
}
this.$$arez$$_location.preReportChanged();
final String $$arezv$$_currentValue = super.getLocation();
assert null != location;
if ( !Objects.equals( location, $$arezv$$_currentValue ) ) {
super.setLocation( location );
this.$$arez$$_location.reportChanged();
}
}
@Override
public void changeLocation(@Nonnull final String targetLocation) {
if ( Arez.shouldCheckApiInvariants() ) {
Guards.apiInvariant( () -> null != this.$$arezi$$_kernel && this.$$arezi$$_kernel.isActive(), () -> "Method named 'changeLocation' invoked on " + this.$$arezi$$_kernel.describeState() + " component named '" + this.$$arezi$$_kernel.getName() + "'" );
}
this.$$arezi$$_kernel.getContext().safeAction( Arez.areNamesEnabled() ? this.$$arezi$$_kernel.getName() + ".changeLocation" : null, () -> super.changeLocation( targetLocation ), ActionFlags.READ_WRITE | ActionFlags.NO_VERIFY_ACTION_REQUIRED, Arez.areSpiesEnabled() ? new Object[] { targetLocation } : null );
}
@Override
public void resetBrowserLocation() {
if ( Arez.shouldCheckApiInvariants() ) {
Guards.apiInvariant( () -> null != this.$$arezi$$_kernel && this.$$arezi$$_kernel.isActive(), () -> "Method named 'resetBrowserLocation' invoked on " + this.$$arezi$$_kernel.describeState() + " component named '" + this.$$arezi$$_kernel.getName() + "'" );
}
this.$$arezi$$_kernel.getContext().safeAction( Arez.areNamesEnabled() ? this.$$arezi$$_kernel.getName() + ".resetBrowserLocation" : null, () -> super.resetBrowserLocation(), ActionFlags.READ_WRITE | ActionFlags.VERIFY_ACTION_REQUIRED, null );
}
@Override
void updateBrowserLocation() {
if ( Arez.shouldCheckApiInvariants() ) {
Guards.apiInvariant( () -> null != this.$$arezi$$_kernel && this.$$arezi$$_kernel.isActive(), () -> "Method named 'updateBrowserLocation' invoked on " + this.$$arezi$$_kernel.describeState() + " component named '" + this.$$arezi$$_kernel.getName() + "'" );
}
this.$$arezi$$_kernel.getContext().safeAction( Arez.areNamesEnabled() ? this.$$arezi$$_kernel.getName() + ".updateBrowserLocation" : null, () -> super.updateBrowserLocation(), ActionFlags.READ_WRITE | ActionFlags.VERIFY_ACTION_REQUIRED, null );
}
@Override
@Nonnull
public String getBrowserLocation() {
if ( Arez.shouldCheckApiInvariants() ) {
Guards.apiInvariant( () -> null != this.$$arezi$$_kernel && this.$$arezi$$_kernel.isActive(), () -> "Method named 'getBrowserLocation' invoked on " + this.$$arezi$$_kernel.describeState() + " component named '" + this.$$arezi$$_kernel.getName() + "'" );
}
return this.$$arez$$_browserLocation.get();
}
@Override
@Nonnull
ComputableValue> getBrowserLocationComputableValue() {
if ( Arez.shouldCheckApiInvariants() ) {
Guards.apiInvariant( () -> null != this.$$arezi$$_kernel && this.$$arezi$$_kernel.isActive(), () -> "Method named 'getBrowserLocationComputableValue' invoked on " + this.$$arezi$$_kernel.describeState() + " component named '" + this.$$arezi$$_kernel.getName() + "'" );
}
return $$arez$$_browserLocation;
}
@Override
public String toString() {
if ( Arez.areNamesEnabled() ) {
return "ArezComponent[" + this.$$arezi$$_kernel.getName() + "]";
} else {
return super.toString();
}
}
}