Commit 79c7d49e authored by Florian Hölzl's avatar Florian Hölzl
Browse files

added graph viewer display

refs 907
parent 91a520d2
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2012 ForTISS GmbH |
| |
| 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.fortiss.af3.expression.ui.databinding.validate;
import org.eclipse.core.databinding.conversion.Converter;
/**
* Converts from int to String.
*
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: DC2D44987CBE1A51C4BE9C1679A27974
*/
public class IntToStringConverter extends Converter {
/** Singleton instance. */
public static final IntToStringConverter INT_STRING_CONVERTER = new IntToStringConverter();
/** Constructor. */
public IntToStringConverter() {
super(Integer.class, String.class);
}
/** {@inheritDoc} */
@Override
public Object convert(Object fromObject) {
return fromObject.toString();
}
}
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2012 ForTISS GmbH |
| |
| 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.fortiss.af3.expression.ui.databinding.validate;
import static org.eclipse.core.databinding.validation.ValidationStatus.cancel;
import static org.eclipse.core.runtime.Status.OK_STATUS;
import org.eclipse.core.databinding.validation.IValidator;
import org.eclipse.core.runtime.IStatus;
/**
* Validator for String to Int conversion.
*
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: F05B3F76077DD7658783FB56B6DBFA15
*/
public class IntValidator implements IValidator {
/** Singleton instance. */
public static final IntValidator INT_VALIDATOR = new IntValidator();
/** {@inheritDoc} */
@Override
public IStatus validate(Object value) {
if(value instanceof String) {
try {
Integer.valueOf((String)value);
return OK_STATUS;
} catch(NumberFormatException nfex) {
// ignore
}
}
return cancel("Illegal int value!");
}
}
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2012 ForTISS GmbH |
| |
| 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.fortiss.af3.expression.ui.databinding.validate;
import org.eclipse.core.databinding.conversion.Converter;
/**
* Converts from string to int.
*
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 282E21C9675C5717D0253CC452F846EE
*/
public class StringToIntConverter extends Converter {
/** Singleton instance. */
public static final StringToIntConverter STRING_INT_CONVERTER = new StringToIntConverter();
/** Constructor. */
public StringToIntConverter() {
super(String.class, Integer.class);
}
/** {@inheritDoc} */
@Override
public Object convert(Object fromObject) {
return Integer.valueOf((String)fromObject);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment