List of usage examples for org.apache.commons.lang NullArgumentException NullArgumentException
public NullArgumentException(String argName)
Instantiates with the given argument name.
From source file:org.nuclos.client.ui.collect.component.CollectableListOfValues.java
/** * accepts the given <code>Collectable</code>, that was selected by the user in a lookup operation. * Notifies all registered <code>LookupListener</code>s. * @param clctLookedUp//w w w .j ava 2s . c o m * @param sReferencedEntityFieldName name of the field to use as the value. * @param additionalCollectables * @precondition clctLookedUp != null * @precondition clctLookedUp.isComplete() */ protected void acceptLookedUpCollectable(final Collectable clctLookedUp, String sReferencedEntityFieldName, List<Collectable> additionalCollectables) { if (clctLookedUp == null) { throw new NullArgumentException("clctLookedUp"); } Object oForeignValue = Utils.getRepresentation(getEntityField().getReferencedEntityName(), sReferencedEntityFieldName, clctLookedUp); this.setField(new CollectableValueIdField(clctLookedUp.getId(), oForeignValue)); this.fireLookupSuccessful(new LookupEvent(this, clctLookedUp, additionalCollectables)); }
From source file:org.nuclos.client.ui.collect.component.CollectableOptionGroup.java
/** * @param lstOptions/*from www .java2 s . c om*/ * @precondition lstOptions != null */ public void setOptions(List<String[]> lstOptions) { if (lstOptions == null) { throw new NullArgumentException("lstOptions"); } getOptionGroup().setOptions(lstOptions); }
From source file:org.nuclos.client.ui.collect.component.DefaultCollectableComponentFactory.java
/** * creates a <code>CollectableComponent</code> for the given entity field. The "control type" may be given as a hint. * @param clctef// ww w . j a v a 2 s . c o m * @param clctcomptype may be <null>, which has the same effect as new CollectableComponentType(null, null). * @return a suitable <code>CollectableComponent</code> for the given entity field. * @precondition clctef != null */ @Override public CollectableComponent newCollectableComponent(CollectableEntityField clctef, CollectableComponentType clctcomptype, boolean bSearchable) { if (clctef == null) { throw new NullArgumentException("clctef"); } if (clctcomptype == null) { clctcomptype = new CollectableComponentType(null, null); } CollectableComponent result; final Class<CollectableComponent> clsclctcomp = clctcomptype.getControlTypeClass(); if (clsclctcomp == null) { result = newCollectableComponentByEnumeratedControlType(clctef, clctcomptype.getEnumeratedControlType(), bSearchable); } else { assert clctcomptype.getEnumeratedControlType() == null; try { final Constructor<CollectableComponent> ctor = clsclctcomp .getConstructor(CollectableEntityField.class, Boolean.class); result = ctor.newInstance(clctef, bSearchable); respectRestrictionToValueList(result, clctef); } catch (NoSuchMethodException ex) { try { final Constructor<CollectableComponent> ctor = clsclctcomp .getConstructor(CollectableEntityField.class, boolean.class); result = ctor.newInstance(clctef, bSearchable); respectRestrictionToValueList(result, clctef); } catch (NoSuchMethodException ex2) { final String sMessage = "The class " + clsclctcomp + " has not the required contructor ctor(CollectableEntityField, Boolean/boolean)."; //"Die Klasse " + clsclctcomp + " hat nicht den erforderlichen Konstruktor ctor(CollectableEntityField, Boolean)."; throw new CommonFatalException(sMessage, ex2); } catch (InstantiationException ex2) { throw new CommonFatalException(ex2); } catch (IllegalAccessException ex2) { throw new CommonFatalException(ex2); } catch (InvocationTargetException ex2) { throw new CommonFatalException(ex2.getTargetException()); } } catch (InstantiationException ex) { throw new CommonFatalException(ex); } catch (IllegalAccessException ex) { throw new CommonFatalException(ex); } catch (InvocationTargetException ex) { throw new CommonFatalException(ex.getTargetException()); } } return result; }
From source file:org.nuclos.client.ui.collect.component.DefaultCollectableComponentFactory.java
/** * creates a <code>CollectableComponent</code> for the given entity field. The "control type" may be given as a hint. * @param clctef// w ww. j av a 2 s.com * @param iEnumeratedControlType may be given as a hint which component to create. May be <code>null</code>, in which * case the entity field's defaultCollectableComponentType is used. * @return a suitable <code>CollectableComponent</code> for the given entity field. * @see CollectableComponentTypes */ protected CollectableComponent newCollectableComponentByEnumeratedControlType(CollectableEntityField clctef, Integer iEnumeratedControlType, boolean bSearchable) { if (clctef == null) { throw new NullArgumentException("clctef"); } /** @todo Naming convention: how to distinguish between int and Integer? (ii for int is stupid) */ final int iiControlType = (iEnumeratedControlType != null) ? iEnumeratedControlType.intValue() : clctef.getDefaultCollectableComponentType(); final CollectableComponent result = this.newCollectableComponentByEnumeratedControlType(clctef, iiControlType, bSearchable); respectRestrictionToValueList(result, clctef); return result; }
From source file:org.nuclos.client.ui.collect.component.model.CollectableComponentModel.java
/** * sets the "collectableField" (the composite value) of this component and optionally notifies the listeners. * Note that a <code>CollectableComponentEvent</code> is fired even if the model did not change. * That's because there may be an inconsistent <code>CollectableComponent</code> listening to * this. In that case, the component (view) must be updated anyway. * @todo @see #setField(CollectableField clctfValue) * @param clctfValue The field type must match the field type of <code>getEntityField</code>. * @param bNotifyListeners Are listeners to be notified? * @precondition clctfValue != null/*from w w w. j a va 2s. co m*/ * @postcondition this.getField().equals(clctfValue) */ void setField(CollectableField clctfValue, boolean bNotifyListeners, boolean bDirty) { if (clctfValue == null) { throw new NullArgumentException("clctfValue"); } if (!bDirty) { try { CollectableUtils.validateFieldType(clctfValue, this.getEntityField()); if (!(clctfValue instanceof CollectableValueIdField)) { if (this.getEntityField().getJavaClass().equals(Date.class) && clctfValue.getValue() != null && clctfValue.getValue().equals(RelativeDate.today().toString())) { //ok } else if (this.getEntityField().getJavaClass().isAssignableFrom(NuclosImage.class)) { // special behavior } else { CollectableUtils.validateValueClass(clctfValue, this.getEntityField()); } } } catch (CollectableFieldValidationException ex) { throw new CommonFatalException(ex); } } final CollectableField clctfOldValue = this.clctfValue; this.clctfValue = clctfValue; setDirty(); assert getField().equals(clctfValue) : "field=" + getField() + " but new value is " + clctfValue; if (bNotifyListeners) { fireFieldChanged(clctfOldValue, clctfValue); } }
From source file:org.nuclos.client.ui.collect.component.model.DetailsComponentModel.java
/** * sets the common value of this model./*from www. j ava 2 s . c o m*/ * @param clctfCommonValue * @precondition this.isMultiEditable() * @postcondition this.hasCommonValue(); * @postcondition this.getCommonValue().equals(clctfCommonValue); */ public void setCommonValue(CollectableField clctfCommonValue) { if (!this.isMultiEditable()) { throw new IllegalStateException("multiEditable"); } if (clctfCommonValue == null) { throw new NullArgumentException("clctfCommonValue"); } this.multiedit.clctfCommonValue = clctfCommonValue; assert this.hasCommonValue(); assert this.getCommonValue().equals(clctfCommonValue); }
From source file:org.nuclos.client.ui.collect.model.CollectableTableModelImpl.java
/** * @param lstclctefColumns List<CollectableEntityField> * @precondition lstclctefColumns != null * @postcondition this.getColumnCount() == lstclctefColumns.size() * @postcondition this.getSortedColumn() < this.getColumnCount() *//*w w w .j a v a2s.c o m*/ @Override public void setColumns(List<? extends CollectableEntityField> lstclctefColumns) { if (lstclctefColumns == null) { throw new NullArgumentException("lstclctefColumns"); } this.lstclctefColumns = new ArrayList<CollectableEntityField>(lstclctefColumns); super.fireTableStructureChanged(); assert this.getColumnCount() == lstclctefColumns.size(); }
From source file:org.nuclos.client.ui.collect.result.ResultController.java
/** * replaces the selected <code>Collectable</code> in the table model with <code>clct</code>. * @param clct//from w w w . j a v a 2 s. c o m * @precondition clct != null * TODO make this private */ public final void replaceSelectedCollectableInTableModel(Clct clct) { if (clct == null) { throw new NullArgumentException("clct"); } this.replaceCollectableInTableModel(clctctl.getResultTable().getSelectedRow(), clct); }
From source file:org.nuclos.client.ui.collect.result.ResultController.java
/** * replaces the <code>Collectable</code> in the table model that has the same id as <code>clct</code> * with <code>clct</code>.// www .j a va 2 s .c o m * @param clct * @precondition clct != null * TODO make this private */ public final void replaceCollectableInTableModel(Clct clct) { if (clct == null) { throw new NullArgumentException("clct"); } final int iRow = clctctl.getResultTableModel().findRowById(clct.getId()); if (iRow == -1) { throw new CommonFatalException( "Der Datensatz mit der Id " + clct.getId() + " ist nicht im Suchergebnis vorhanden."); } this.replaceCollectableInTableModel(iRow, clct); }
From source file:org.nuclos.client.ui.collect.result.ResultController.java
/** * replaces the <code>Collectable</code> in the given row of the table model with <code>clct</code>. * @param iRow/*from w w w .j a v a2 s . c o m*/ * @param clct * @precondition clct != null * TODO move to ResultController */ private void replaceCollectableInTableModel(int iRow, Clct clct) { if (clct == null) { throw new NullArgumentException("clct"); } clctctl.getResultTableModel().setCollectable(iRow, clct); }