コード例 #1
0
ファイル: UrlFactory.java プロジェクト: jo-source/jo-widgets
 public static URL create(final String url) {
   Assert.paramNotEmpty(url, "url");
   try {
     return new URL(url);
   } catch (final MalformedURLException e) {
     throw new RuntimeException(e);
   }
 }
コード例 #2
0
ファイル: UrlFactory.java プロジェクト: jo-source/jo-widgets
 public static URL createFromFileName(final String filename) {
   Assert.paramNotEmpty(filename, "filename");
   try {
     return new File(filename).toURI().toURL();
   } catch (final MalformedURLException e) {
     throw new RuntimeException(e);
   }
 }
コード例 #3
0
  @SuppressWarnings({"unchecked", "rawtypes"})
  AttributeImpl(
      final String propertyName,
      final IValueRange valueRange,
      final Object defaultValue,
      final IMessage label,
      final IMessage labelLong,
      final DisplayFormat labelDisplayFormat,
      final IMessage description,
      final boolean visible,
      final boolean mandatory,
      final boolean editable,
      final boolean batchEditable,
      final boolean readonly,
      final AlignmentHorizontal tableAlignment,
      final int tableColumnWidth,
      final IAttributeGroup attributeGroup,
      final boolean sortable,
      final boolean filterable,
      final boolean searchable,
      final Class<?> valueType,
      final Class<? extends ELEMENT_VALUE_TYPE> elementValueType,
      final IValidator<Object> validator,
      final Cardinality cardinality,
      final List<IControlPanelProvider<? extends ELEMENT_VALUE_TYPE>> controlPanels,
      final IDisplayFormat displayFormat) {

    Assert.paramNotEmpty(propertyName, "propertyName");
    Assert.paramNotNull(valueRange, "valueRange");
    Assert.paramNotNull(label, "label");
    Assert.paramNotNull(labelDisplayFormat, "labelDisplayFormat");
    Assert.paramNotNull(tableAlignment, "tableAlignment");
    Assert.paramNotNull(valueType, "valueType");
    Assert.paramNotNull(elementValueType, "elementValueType");
    Assert.paramNotNull(cardinality, "cardinality");
    Assert.paramNotNull(controlPanels, "controlPanels");
    Assert.paramNotNull(displayFormat, "displayFormat");

    if (Collections.class.isAssignableFrom(elementValueType)) {
      throw new IllegalArgumentException(
          "The parameter 'elementValueType' must not be a collection but has the type '"
              + elementValueType.getClass().getName()
              + "'.");
    }
    if (!elementValueType.equals(valueType) && !Collection.class.isAssignableFrom(valueType)) {
      throw new IllegalArgumentException(
          "If the 'elementValueType' differs from the 'valueType', the value type must be a 'Collection'");
    }
    if (readonly && editable) {
      throw new IllegalArgumentException("The attribute must not be 'readonly' and 'editable'");
    }

    if (!filterable && searchable) {
      throw new IllegalArgumentException(
          "A property that is not filterable could not be searchable");
    }

    this.changeObservable = new ChangeObservable();

    this.propertyName = propertyName;
    this.valueRange = valueRange;
    this.defaultValue = defaultValue;
    this.label = label;
    if (labelLong != null) {
      this.labelLong = labelLong;
    } else {
      this.labelLong = new StaticMessage();
    }
    if (description != null) {
      this.description = description;
    } else {
      this.description = new StaticMessage();
    }
    this.labelDisplayFormat = labelDisplayFormat;
    this.visible = visible;
    this.mandatory = mandatory;
    this.editable = editable;
    this.batchEditable = batchEditable;
    this.readonly = readonly;
    this.tableAlignment = tableAlignment;
    this.tableColumnWidth = tableColumnWidth;
    this.attributeGroup = attributeGroup;
    this.sortable = sortable;
    this.filterable = filterable;
    this.searchable = searchable;
    this.valueType = valueType;
    this.elementValueType = (Class<ELEMENT_VALUE_TYPE>) elementValueType;
    this.validator = validator;
    this.cardinality = cardinality;
    this.controlPanels = new LinkedList(controlPanels);

    setDisplayFormatImpl(displayFormat);
  }
コード例 #4
0
 private static IMessage getMessage(final String keySuffix) {
   Assert.paramNotEmpty(keySuffix, "keySuffix");
   return EntityMessages.getMessage("RoleDtoDescriptorBuilder." + keySuffix);
 }