org.isisaddons.wicket.gmap3.cpt.applib.LocationSemanticsProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of isis-wicket-gmap3-cpt Show documentation
Show all versions of isis-wicket-gmap3-cpt Show documentation
A Wicket component for Apache Isis' Wicket viewer to
render any collection of entities that implement
Locatable in a Google map (gmap3 API)
/*
* Copyright 2013~2014 Dan Haywood
*
* Licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.isisaddons.wicket.gmap3.cpt.applib;
import org.apache.isis.applib.adapters.DefaultsProvider;
import org.apache.isis.applib.adapters.EncoderDecoder;
import org.apache.isis.applib.adapters.Parser;
import org.apache.isis.applib.adapters.ValueSemanticsProvider;
/**
* For internal use; allows Isis to parse etc.
*/
public class LocationSemanticsProvider implements ValueSemanticsProvider {
public DefaultsProvider getDefaultsProvider() {
return new DefaultsProvider() {
public Location getDefaultValue() {
return Location.DEFAULT_VALUE;
}
};
}
public EncoderDecoder getEncoderDecoder() {
return new EncoderDecoder() {
public Location fromEncodedString(String encodedString) {
return Location.fromString(encodedString);
}
public String toEncodedString(Location locationToEncode) {
return locationToEncode.toString();
}
};
}
public Parser getParser() {
return new Parser() {
public String displayTitleOf(Location location, String usingMask) {
return location.toString();
}
public String parseableTitleOf(Location existing) {
return existing.toString();
}
public int typicalLength() {
return Location.typicalLength();
}
public String displayTitleOf(Location location) {
return location.toString();
}
public Location parseTextEntry(Object object, String entry) {
return Location.fromString(entry);
}
};
}
public boolean isEqualByContent() {
return true;
}
public boolean isImmutable() {
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy