Esempio n. 1
0
  public SwingContainer(final IGenericWidgetFactory factory, final Container container) {
    Assert.paramNotNull(factory, "factory");
    Assert.paramNotNull(container, "container");

    this.factory = factory;
    this.container = container;
    this.swingComponentDelegate = new SwingComponent(container);
  }
Esempio n. 2
0
 @Override
 public <VALUE_TYPE> IParameterizedBuilder addParameter(
     final ITypedKey<VALUE_TYPE> key, final IParameter<VALUE_TYPE> parameter) {
   Assert.paramNotNull(key, "key");
   Assert.paramNotNull(parameter, "parameter");
   parameters.put(key, parameter);
   return this;
 }
      DecoratedResultCallback(
          final IResultCallback<Object> original,
          final IExecutionCallback executionCallback,
          final Transaction tx) {

        Assert.paramNotNull(original, "original");
        Assert.paramNotNull(executionCallback, "executionCallback");

        this.original = original;
        this.executionCallback = executionCallback;
        this.tx = tx;
      }
  PasteBeanLinkEnabledChecker(
      final ILinkCreatorService linkCreatorService,
      final IProvider<Collection<ILinkCreation>> linkProvider,
      final IBeanSelectionProvider<SOURCE_BEAN_TYPE> source,
      final IBeanListModel<LINKABLE_BEAN_TYPE> linkedModel,
      final Object expectedBeanTypeId,
      final Class<?> expectedBeanType,
      final boolean serviceBasedEnabledChecking) {

    Assert.paramNotNull(linkCreatorService, "linkCreatorService");
    Assert.paramNotNull(linkProvider, "linkProvider");
    Assert.paramNotNull(source, "source");
    Assert.paramNotNull(expectedBeanTypeId, "expectedBeanTypeId");
    Assert.paramNotNull(expectedBeanType, "expectedBeanType");

    this.linkCreatorService = linkCreatorService;
    this.linkProvider = linkProvider;
    this.source = source;
    this.linkedModel = linkedModel;
    this.serviceBasedEnabledChecking = serviceBasedEnabledChecking;
    this.disposed = false;
    this.conditionsChanged = true;

    this.sourceListener =
        new IBeanSelectionListener<SOURCE_BEAN_TYPE>() {
          @Override
          public void selectionChanged(final IBeanSelectionEvent<SOURCE_BEAN_TYPE> selectionEvent) {
            onConditionsChanged();
          }
        };
    source.addBeanSelectionListener(sourceListener);

    this.linkedModelListener =
        new BeanListModelListenerAdapter<LINKABLE_BEAN_TYPE>() {
          @Override
          public void beansChanged() {
            onConditionsChanged();
          }
        };
    if (linkedModel != null) {
      linkedModel.addBeanListModelListener(linkedModelListener);
    }

    this.clipboardEnabledChecker =
        new ClipboardSelectionEnabledChecker(expectedBeanTypeId, expectedBeanType);
    clipboardEnabledChecker.addChangeListener(
        new IChangeListener() {
          @Override
          public void changed() {
            onConditionsChanged();
          }
        });
  }
 @Override
 public ITitledWindowSetupBuilder<?> setExecutionContext(
     final IExecutionContext executionContext) {
   Assert.paramNotNull(executionContext, "executionContext");
   final IAction action = executionContext.getAction();
   return getBuilder().setTitle(action.getText()).setIcon(action.getIcon());
 }
Esempio n. 6
0
 public static URL create(final File file) {
   Assert.paramNotNull(file, "file");
   try {
     return file.toURI().toURL();
   } catch (final MalformedURLException e) {
     throw new RuntimeException(e);
   }
 }
 public static synchronized void initialize(final IMongoDBClientProvider instance) {
   Assert.paramNotNull(instance, "instance");
   if (MongoDBClientProvider.instance == null) {
     MongoDBClientProvider.instance = instance;
   } else {
     throw new IllegalStateException("The IMongoDBClientProvider is already initialized");
   }
 }
Esempio n. 8
0
 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);
   }
 }
Esempio n. 9
0
 public static URL create(final String url) {
   Assert.paramNotEmpty(url, "url");
   try {
     return new URL(url);
   } catch (final MalformedURLException e) {
     throw new RuntimeException(e);
   }
 }
  Neo4JServicesDecoratorProviderImpl(
      final Set<Class<?>> transactionalServices,
      final List<IDecorator<Throwable>> exceptionDecorators,
      final IExceptionLogger deprecatedExceptionLogger,
      final IServiceExceptionLogger exceptionLogger,
      final int order) {

    Assert.paramNotNull(transactionalServices, "transactionalServices");
    Assert.paramNotNull(exceptionDecorators, "exceptionDecorators");
    Assert.paramNotNull(deprecatedExceptionLogger, "deprecatedExceptionLogger");
    Assert.paramNotNull(exceptionLogger, "exceptionLogger");

    this.transactionalServices = new HashSet<Class<?>>(transactionalServices);
    this.exceptionDecorators = new LinkedList<IDecorator<Throwable>>(exceptionDecorators);
    this.deprecatedExceptionLogger = deprecatedExceptionLogger;
    this.exceptionLogger = exceptionLogger;
    this.order = order;
  }
 private void setDisplayFormatImpl(final IDisplayFormat displayFormat) {
   Assert.paramNotNull(displayFormat, "displayFormat");
   final IControlPanelProvider<ELEMENT_VALUE_TYPE> controlPanel = findControlPanel(displayFormat);
   if (controlPanel == null) {
     throw new IllegalArgumentException(
         "The displayFormat '" + displayFormat + "' is not a known display format.");
   } else {
     currentControlPanel = controlPanel;
   }
 }
Esempio n. 12
0
 @Override
 public <VALUE_TYPE> IParameter<VALUE_TYPE> getParameter(final ITypedKey<VALUE_TYPE> key) {
   Assert.paramNotNull(key, "key");
   @SuppressWarnings("unchecked")
   final IParameter<VALUE_TYPE> result = (IParameter<VALUE_TYPE>) parameters.get(key);
   if (result != null) {
     return result;
   } else {
     throw new IllegalArgumentException("The parameter '" + key + "' is not known");
   }
 }
 @Override
 public <SERVICE_TYPE> IDecorator<SERVICE_TYPE> getDecorator(final IServiceId<SERVICE_TYPE> id) {
   Assert.paramNotNull(id, "id");
   final Class<? extends SERVICE_TYPE> serviceType = id.getServiceType();
   return new IDecorator<SERVICE_TYPE>() {
     @SuppressWarnings("unchecked")
     @Override
     public SERVICE_TYPE decorate(final SERVICE_TYPE original) {
       final InvocationHandler invocationHandler =
           new Neo4JInvocationHandler(serviceType, original);
       return (SERVICE_TYPE)
           Proxy.newProxyInstance(
               serviceType.getClassLoader(), new Class[] {serviceType}, invocationHandler);
     }
   };
 }
Esempio n. 14
0
 @Override
 public final void setLayout(final ILayoutDescriptor layout) {
   Assert.paramNotNull(layout, "layout");
   if (layout instanceof MigLayoutDescriptor) {
     final MigLayoutDescriptor migLayoutManager = (MigLayoutDescriptor) layout;
     container.setLayout(
         new MigLayout(
             migLayoutManager.getLayoutConstraints(),
             migLayoutManager.getColumnConstraints(),
             migLayoutManager.getRowConstraints()));
   } else if (layout instanceof ILayouter) {
     container.setLayout(new LayoutManagerImpl(getUiReference(), (ILayouter) layout));
   } else {
     throw new IllegalArgumentException(
         "Layout Descriptor of type '" + layout.getClass().getName() + "' is not supported");
   }
 }
 @Override
 public void setConfig(final IAttributeConfig config) {
   Assert.paramNotNull(config, "config");
   if (config.isVisible() != null) {
     this.visible = config.isVisible();
   }
   if (config.getLabelDisplayFormat() != null) {
     this.labelDisplayFormat = config.getLabelDisplayFormat();
   }
   if (config.getDisplayFormat() != null) {
     setDisplayFormatImpl(config.getDisplayFormat());
   }
   if (config.getTableAlignment() != null) {
     this.tableAlignment = config.getTableAlignment();
   }
   if (config.getTableWidth() != null) {
     this.tableColumnWidth = config.getTableWidth();
   }
   changeObservable.fireChangedEvent();
 }
Esempio n. 16
0
 private ParameterizedImpl(final Map<ITypedKey<?>, IParameter<?>> parameters) {
   Assert.paramNotNull(parameters, "parameters");
   this.parameters = parameters;
   this.availableParameters =
       Collections.unmodifiableList(new LinkedList<ITypedKey<?>>(parameters.keySet()));
 }
 @Override
 public IComponentNode componentNode(final IComponentNodeModelBuilder modelBuilder) {
   Assert.paramNotNull(modelBuilder, "modelBuilder");
   return componentNode(modelBuilder.build());
 }
 @Override
 public IWorkbenchApplication application(final IWorkbenchApplicationModelBuilder modelBuilder) {
   Assert.paramNotNull(modelBuilder, "modelBuilder");
   return application(modelBuilder.build());
 }
 @Override
 public IWorkbench workbench(final IWorkbenchModelBuilder modelBuilder) {
   Assert.paramNotNull(modelBuilder, "modelBuilder");
   return workbench(modelBuilder.build());
 }
 @Override
 public IWorkbench workbench(final IWorkbenchModel model) {
   Assert.paramNotNull(model, "model");
   return new Workbench(model);
 }
 public SecurityRemotingServlet(final String brokerId) {
   Assert.paramNotNull(brokerId, "brokerId");
   this.brokerId = brokerId;
 }
  @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);
  }
 private DecoratedServiceProvider(final IServiceProvider original) {
   Assert.paramNotNull(original, "original");
   this.original = original;
 }
 @Override
 public ILookUpEntryBuilder setValue(final String propertyName, final Object value) {
   Assert.paramNotNull(propertyName, "propertyName");
   values.put(propertyName, value);
   return this;
 }
 @Override
 public ICreatorService createAdapter(final ISyncCreatorService adaptee) {
   Assert.paramNotNull(adaptee, "adaptee");
   return new CreatorServiceAdapter(adaptee);
 }
 OperatorProvider(final OPERATOR_TYPE defaultOperator, final OPERATOR_TYPE... operators) {
   Assert.paramNotNull(defaultOperator, "defaultOperator");
   Assert.paramNotNull(operators, "operators");
   this.defaultOperator = defaultOperator;
   this.operators = Collections.unmodifiableList(Arrays.asList(operators));
 }
 @Override
 public IControlPanelProvider<ELEMENT_VALUE_TYPE> getCurrentIncludingFilterControlPanel(
     final IFilterType filterType) {
   Assert.paramNotNull(filterType, "filterType");
   return getCurrentIncludingFilterControlPanelImpl(filterType);
 }
Esempio n. 28
0
 @Override
 public void removeTreeNodeListener(final ITreeNodeListener listener) {
   Assert.paramNotNull(listener, "listener");
   listeners.remove(listener);
 }
Esempio n. 29
0
 @Override
 public Dimension computeDecoratedSize(final Dimension clientAreaSize) {
   Assert.paramNotNull(clientAreaSize, "clientAreaSize");
   return DecorationCalc.computeDecoratedSize(container, clientAreaSize);
 }
 @Override
 public void removeSelectionVetoListener(final IListSelectionVetoListener listener) {
   Assert.paramNotNull(listener, "listener");
   listeners.remove(listener);
 }