X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.databoard%2Fsrc%2Forg%2Fsimantics%2Fdataboard%2Fbinding%2FBooleanBinding.java;h=6848fc01c32f44b1739023101e26ae11e28b679d;hb=a1696e5257fae039410c924155fdeffc1ce1b3e9;hp=239188cee44834caec3211ab70a7e4900df0350f;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.databoard/src/org/simantics/databoard/binding/BooleanBinding.java b/bundles/org.simantics.databoard/src/org/simantics/databoard/binding/BooleanBinding.java index 239188cee..6848fc01c 100644 --- a/bundles/org.simantics.databoard/src/org/simantics/databoard/binding/BooleanBinding.java +++ b/bundles/org.simantics.databoard/src/org/simantics/databoard/binding/BooleanBinding.java @@ -1,27 +1,27 @@ -/******************************************************************************* - * Copyright (c) 2010 Association for Decentralized Information Management in - * Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ +/******************************************************************************* + * Copyright (c) 2010 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ package org.simantics.databoard.binding; -import java.util.IdentityHashMap; -import java.util.Set; - -import org.simantics.databoard.accessor.reference.ChildReference; -import org.simantics.databoard.binding.error.BindingException; -import org.simantics.databoard.binding.error.RuntimeBindingException; -import org.simantics.databoard.binding.impl.BindingPrintContext; -import org.simantics.databoard.binding.impl.BooleanBindingDefault; -import org.simantics.databoard.binding.mutable.MutableBooleanBinding; -import org.simantics.databoard.type.BooleanType; -import org.simantics.databoard.util.IdentityPair; +import java.util.IdentityHashMap; +import java.util.Set; + +import org.simantics.databoard.accessor.reference.ChildReference; +import org.simantics.databoard.binding.error.BindingException; +import org.simantics.databoard.binding.error.RuntimeBindingException; +import org.simantics.databoard.binding.impl.BindingPrintContext; +import org.simantics.databoard.binding.impl.BooleanBindingDefault; +import org.simantics.databoard.binding.mutable.MutableBooleanBinding; +import org.simantics.databoard.type.BooleanType; +import org.simantics.databoard.util.IdentityPair; /** * This is a binding of Boolean Type and a Java Object. @@ -43,20 +43,20 @@ public abstract class BooleanBinding extends Binding { public abstract void setValue(Object obj, boolean newValue) throws BindingException; public abstract Boolean getValue(Object o) throws BindingException; public abstract boolean getValue_(Object o) throws BindingException; - + public Object createUnchecked(Boolean value) throws RuntimeBindingException { try { return create(value); } catch (BindingException e) { throw new RuntimeBindingException(e); } - } - - @Override - public void readFrom(Binding srcBinding, Object src, Object dst) - throws BindingException { - boolean v = ((BooleanBinding)srcBinding).getValue_(src); - setValue(dst, v); + } + + @Override + public void readFrom(Binding srcBinding, Object src, Object dst) + throws BindingException { + boolean v = ((BooleanBinding)srcBinding).getValue_(src); + setValue(dst, v); } @Override @@ -93,26 +93,26 @@ public abstract class BooleanBinding extends Binding { boolean v1 = getValue_(o1); boolean v2 = getValue_(o2); return (v2 == v1 ? 0 : (v1 ? 1 : -1)); - } - - @Override - protected void toString(Object value, BindingPrintContext ctx) throws BindingException { - ctx.b.append(getValue_(value)); } - - @Override - public Binding getComponentBinding(ChildReference path) { - if (path==null) return this; - throw new IllegalArgumentException(); - } - - @Override - public int getComponentCount() { - return 0; - } - - @Override - public Binding getComponentBinding(int index) { - throw new IllegalArgumentException(); + + @Override + protected void toString(Object value, BindingPrintContext ctx) throws BindingException { + ctx.b.append(getValue_(value)); + } + + @Override + public Binding getComponentBinding(ChildReference path) { + if (path==null) return this; + throw new IllegalArgumentException(); + } + + @Override + public int getComponentCount() { + return 0; + } + + @Override + public Binding getComponentBinding(int index) { + throw new IllegalArgumentException(); } }