List of usage examples for com.google.gwt.core.ext BadPropertyValueException BadPropertyValueException
public BadPropertyValueException(String propName)
From source file:com.googlecode.gwt.test.internal.handlers.StaticPropertyOracle.java
License:Apache License
public com.google.gwt.core.ext.ConfigurationProperty getConfigurationProperty(String propertyName) throws BadPropertyValueException { ConfigurationProperty config = configPropertiesByName.get(propertyName); if (config == null) { throw new BadPropertyValueException(propertyName); }//from ww w. jav a 2 s . c o m return new DefaultConfigurationProperty(config.getName(), config.getValues()); }
From source file:com.googlecode.gwt.test.internal.handlers.StaticPropertyOracle.java
License:Apache License
public com.google.gwt.core.ext.SelectionProperty getSelectionProperty(TreeLogger logger, String propertyName) throws BadPropertyValueException { // In practice there will probably be so few properties that a linear // search is at least as fast as a map lookup by name would be. // If that turns out not to be the case, the ctor could build a // name-to-index map. for (int i = 0; i < orderedProps.length; i++) { final BindingProperty prop = orderedProps[i]; final String name = prop.getName(); if (name.equals(propertyName)) { final String value = orderedPropValues[i]; String[] values = prop.getDefinedValues(); final TreeSet<String> possibleValues = new TreeSet<String>(); for (String v : values) { possibleValues.add(v);/*w ww .j a v a 2 s . c o m*/ } return new DefaultSelectionProperty(value, prop.getFallback(), name, possibleValues, prop.getFallbackValuesMap()); } } throw new BadPropertyValueException(propertyName); }
From source file:org.jboss.as.console.rebind.ProductConfigGenerator.java
License:Open Source License
private void generateMethods(SourceWriter sourceWriter, GeneratorContext context) throws Throwable { PropertyOracle propertyOracle = context.getPropertyOracle(); String consoleProfileProperty = propertyOracle.getConfigurationProperty("console.profile").getValues() .get(0);/* w w w . j a va 2s. co m*/ if (null == consoleProfileProperty) throw new BadPropertyValueException("Missing configuration property 'console.profile'!"); String prodVersionProperty = propertyOracle.getConfigurationProperty("console.product.version").getValues() .get(0); String consoleProductVersion = (prodVersionProperty != null) ? prodVersionProperty : ""; String devHostProperty = propertyOracle.getConfigurationProperty("console.dev.host").getValues().get(0); String consoleDevHost = (devHostProperty != null) ? devHostProperty : "127.0.0.1"; // most of the config attributes are by default empty // they need be overriden by custom gwt.xml descriptor on a project/product level sourceWriter.println("public String getProductTitle() { "); sourceWriter.indent(); sourceWriter.println("return \"\";"); sourceWriter.outdent(); sourceWriter.println("}"); sourceWriter.println("public String getProductVersion() { "); sourceWriter.indent(); sourceWriter.println("return \"" + consoleProductVersion + "\";"); sourceWriter.outdent(); sourceWriter.println("}"); sourceWriter.println("public String getCoreVersion() { "); sourceWriter.indent(); sourceWriter.println("return org.jboss.as.console.client.Build.VERSION;"); sourceWriter.outdent(); sourceWriter.println("}"); sourceWriter.println("public String getDevHost() { "); sourceWriter.indent(); sourceWriter.println("return \"" + devHostProperty + "\";"); sourceWriter.outdent(); sourceWriter.println("}"); sourceWriter.println("public ProductConfig.Profile getProfile() { "); sourceWriter.indent(); if ("eap".equals(consoleProfileProperty)) sourceWriter.println("return ProductConfig.Profile.EAP;"); else sourceWriter.println("return ProductConfig.Profile.JBOSS;"); sourceWriter.outdent(); sourceWriter.println("}"); }