Example usage for org.apache.commons.lang NullArgumentException NullArgumentException

List of usage examples for org.apache.commons.lang NullArgumentException NullArgumentException

Introduction

In this page you can find the example usage for org.apache.commons.lang NullArgumentException NullArgumentException.

Prototype

public NullArgumentException(String argName) 

Source Link

Document

Instantiates with the given argument name.

Usage

From source file:org.nuclos.client.ui.collect.CollectController.java

/**
 * alternative entry point: view single object in Details
 * @param clct the object to view in Details
 * @precondition clct != null//from   w w w  . j a  va2s . c  om
 * @precondition isCollectableComplete(clct)
 * @see #readCollectable(Collectable)
 */
public final void runViewSingleCollectable(Clct clct, boolean bShow) {
    if (clct == null) {
        throw new NullArgumentException("clct");
    }
    if (!ss.isCollectableComplete(clct)) {
        throw new IllegalArgumentException("clct");
    }
    this.viewSingleCollectable(clct);
    if (bShow)
        this.selectTab();
}

From source file:org.nuclos.client.ui.collect.CollectController.java

/**
 * @param clct/*  w  w  w.j ava 2  s .  co m*/
 * @precondition clct != null
 * @precondition isCollectableComplete(clct)
 */
private void viewSingleCollectable(Clct clct) {
    if (clct == null) {
        throw new NullArgumentException("clct");
    }
    if (!ss.isCollectableComplete(clct)) {
        throw new IllegalArgumentException("clct");
    }
    // fill result table:
    this.fillResultPanel(new ArrayList<Clct>(Collections.singletonList(clct)));

    getCollectPanel().getResultPanel().getResultTable().setRowSelectionInterval(0, 0);
    // select the one result row

    this.cmdEnterViewMode();
}

From source file:org.nuclos.client.ui.collect.CollectController.java

/**
 * fills the collectable component models in the details panel with the values in <code>clct</code>.
 * This method is safe as to detailsChanged(), that means detailsChanged() will not be called through filling the panel.
 * @param clct/*w w w  .j  a v  a 2  s  . c o m*/
 * @precondition clct != null
 * @precondition isCollectableComplete(clct)
 * TODO move to DetailsController or DetailsPanel
 */
protected final void safeFillDetailsPanel(Clct clct) throws CommonBusinessException {
    if (clct == null) {
        throw new NullArgumentException("clct");
    }
    if (!ss.isCollectableComplete(clct)) {
        throw new IllegalArgumentException("clct");
    }
    final boolean bWasDetailsChangedIgnored = this.isDetailsChangedIgnored();
    this.setDetailsChangedIgnored(true);
    try {
        this.unsafeFillDetailsPanel(clct);
    } finally {
        this.setDetailsChangedIgnored(bWasDetailsChangedIgnored);
        this.highlightMandatory();
    }
}

From source file:org.nuclos.client.ui.collect.CollectController.java

/**
 * fills the collectable component models in the details panel with the values in <code>clct</code>.
 * This method is unsafe as to the change listeners, that means the change listeners should be removed
 * before calling this method./*  w  w w  .  ja  v a2  s .  co  m*/
 * @param clct
 * @precondition clct != null
 * @precondition isCollectableComplete(clct)
 * TODO move to DetailsController or DetailsPanel
 */
protected void unsafeFillDetailsPanel(Clct clct) throws CommonBusinessException {
    if (clct == null) {
        throw new NullArgumentException("clct");
    }
    if (!ss.isCollectableComplete(clct)) {
        throw new IllegalArgumentException("clct");
    }
    for (DetailsComponentModel clctcompmodel : getDetailsPanel().getEditModel()
            .getCollectableComponentModels()) {
        clctcompmodel.setField(clct.getField(clctcompmodel.getFieldName()));
    }
}

From source file:org.nuclos.client.ui.collect.CollectController.java

/**
 * reads the field values contained in the specified edit panel into <code>clct</code>.
 * @param clct/*  w w  w  . ja  va  2  s . co  m*/
 * @param bSearchTab Read values from Search panel? Otherwise read values from Details panel.
 * @throws CollectableValidationException
 * @precondition clct != null
 * TODO move to SearchPanel / DetailsPanel (or EditView)
 */
protected void readValuesFromEditPanel(Clct clct, boolean bSearchTab) throws CollectableValidationException {
    if (clct == null) {
        throw new NullArgumentException("clct");
    }
    for (CollectableComponent clctcomp : this.getEditView(bSearchTab).getCollectableComponents()) {
        final String sFieldName = clctcomp.getFieldName();
        final CollectableField clctf;
        try {
            clctf = clctcomp.getModel().getField();
        } catch (Exception ex) {
            final String sMessage = "Fehler beim Lesen des Felds " + sFieldName + ".";
            throw new CommonFatalException(sMessage, ex);
        }
        clct.setField(sFieldName, clctf);
    }
}

From source file:org.nuclos.client.ui.collect.CollectController.java

/**
 * validates the given <code>Collectable</code>.
 * This is called before the <code>clct</code> is stored.
 * @param clct//from   www  . j  av  a2  s.  c  o m
 * @throws CommonBusinessException
 * @precondition clct != null
 * @precondition isCollectableComplete(clct)
 */
protected void validate(Clct clct) throws CommonBusinessException {
    if (clct == null) {
        throw new NullArgumentException("clct");
    }
    if (!ss.isCollectableComplete(clct)) {
        throw new IllegalArgumentException("clct");
    }
}

From source file:org.nuclos.client.ui.collect.component.AbstractCollectableComponent.java

/**
 * @param clctef//from   www  .  j  a  v  a2s . c o m
 * @param comp
 * @param bSearchable
 * @precondition clctef != null
 * @precondition comp != null
 * @postcondition isSearchComponent() == bSearchable
 */
protected AbstractCollectableComponent(CollectableEntityField clctef, JComponent comp, boolean bSearchable) {
    if (clctef == null) {
        throw new NullArgumentException("clctef");
    }
    if (comp == null) {
        throw new NullArgumentException("comp");
    }
    this.clctef = clctef;
    this.comp = comp;

    try {
        dataTyp = getDataTyp(clctef.getJavaClass().getName(), clctef.getDefaultComponentType(),
                clctef.getMaxLength(), clctef.getPrecision(), clctef.getFormatInput(),
                clctef.getFormatOutput());
    } catch (CommonPermissionException e) {
        throw new NuclosFatalException(e);
    } catch (CommonFinderException e) {
        throw new NuclosFatalException(e);
    }

    // set the name of the JComponent so it can be identified by GUI testing tools:
    comp.setName(getFieldName());
    this.bSearchable = bSearchable;
    setModel(CollectableComponentModel.newCollectableComponentModel(clctef, bSearchable));

    if (isSearchComponent() && hasComparisonOperator()) {
        setComparisonOperator(ComparisonOperator.NONE);
    }

    setupJPopupMenuListener(newJPopupMenuListener());

    assert isSearchComponent() == bSearchable;
}

From source file:org.nuclos.client.ui.collect.component.CollectableComponentTableCellEditor.java

/**
 * creates a <code>TableCellEditor</code> that lazily creates a suitable <code>CollectableComponent</code>
 * according to <code>clctef</code>.
 * @param clctef/*  ww w. j  a v  a 2 s .  c om*/
 * @postcondition !this.isSearchable()
 */
public CollectableComponentTableCellEditor(CollectableEntityField clctef) {
    if (clctef == null) {
        throw new NullArgumentException("clctef");
    }
    this.clctef = clctef;
    this.bSearchable = false;
    this.editorDateInputVerifier = new DateInputVerifier(clctef);
    this.floatAndDoubleInputVerifier = new FloatAndDoubleInputVerifier(clctef);
    this.trueInputVerifier = new TrueInputVerifier();

    assert !this.isSearchable();
}

From source file:org.nuclos.client.ui.collect.component.CollectableComponentTableCellEditor.java

/**
 * creates a <code>TableCellEditor</code> that uses the given <code>CollectableComponent</code>.
 * @param clctcomp//from w w w .j a  va 2 s .co m
 * @param bSearchable
 * @postcondition this.isSearchable() <--> bSearchable
 */
public CollectableComponentTableCellEditor(CollectableComponent clctcomp, boolean bSearchable) {
    if (clctcomp == null) {
        throw new NullArgumentException("clctcomp");
    }
    this.clctcomp = clctcomp;
    this.clctcomp.getModel().addCollectableComponentModelListener(this);
    this.clctef = clctcomp.getEntityField();
    this.bSearchable = bSearchable;
    this.editorDateInputVerifier = new DateInputVerifier(clctef);
    this.floatAndDoubleInputVerifier = new FloatAndDoubleInputVerifier(clctef);
    this.trueInputVerifier = new TrueInputVerifier();

    assert this.isSearchable() == bSearchable;
}

From source file:org.nuclos.client.ui.collect.component.CollectableListOfValues.java

final void init() {
    final CollectableEntityField clctef = getEntityField();
    if (clctef == null) {
        throw new NullArgumentException("clctef");
    }/*from  ww  w .j  a v  a2s.c  o m*/
    if (!clctef.isIdField()) {
        throw new IllegalArgumentException(StringUtils
                .getParameterizedExceptionMessage("collectable.listofvalues.exception.1", clctef.getName()));
        //"Das Feld \"" + clctef.getName() + "\" ist kein Id-Feld und kann daher nicht in einem LOV (Suchfeld) dargestellt werden.");
    }

    EntityFieldMetaDataVO efMeta = MetaDataClientProvider.getInstance().getEntityField(clctef.getEntityName(),
            clctef.getName());

    if (!clctef.isReferencing()) {
        throw new IllegalArgumentException(StringUtils
                .getParameterizedExceptionMessage("collectable.listofvalues.exception.2", clctef.getName()));
        //"Das Feld \"" + clctef.getName() + "\" ist kein Fremdschl\u00fcssel-Feld und kann daher nicht in einem LOV (Suchfeld) dargestellt werden.");
    }
    assert !this.isInsertable();
    this.setInsertable(this.isSearchComponent());

    setEntityFacadeRemote((EntityFacadeRemote) SpringApplicationContextHolder.getBean("entityService"));
    getListOfValues().setQuickSearchResulting(new QuickSearchResulting() {
        @Override
        protected List<CollectableValueIdField> getQuickSearchResult(String inputString) {
            Integer vlpId = null;
            Map<String, Object> vlpParameter = null;
            CollectableFieldsProvider provider = getValueListProvider();
            if (provider instanceof CachingCollectableFieldsProvider) {
                provider = ((CachingCollectableFieldsProvider) provider).getDelegate();
            }
            if (provider instanceof DatasourceBasedCollectableFieldsProvider) {
                DatasourceBasedCollectableFieldsProvider dsProvider = ((DatasourceBasedCollectableFieldsProvider) provider);
                if (dsProvider.isValuelistProviderDatasource()) {
                    vlpId = dsProvider.getDatasourceVO().getId();
                    vlpParameter = dsProvider.getValueListParameter();
                }
            }

            return CollectableListOfValues.this.getQuickSearchResult(clctef, inputString, vlpId, vlpParameter);
        }
    });

    this.setupLookupListener();

    this.getListOfValues().setQuickSearchEnabled(enableQuickSearch(clctef));

    final EntityMetaDataVO eMetaForeign = MetaDataClientProvider.getInstance().getEntity(
            efMeta.getForeignEntity() != null ? efMeta.getForeignEntity() : efMeta.getLookupEntity());

    this.getListOfValues().setQuickSearchSelectedListener(new ListOfValues.QuickSearchSelectedListener() {
        @Override
        public void actionPerformed(CollectableValueIdField itemSelected) {
            if (itemSelected == null) {
                clearListOfValues();
            } else {
                try {
                    Collectable c = Utils.getReferencedCollectable(clctef.getEntityName(), clctef.getName(),
                            itemSelected.getValueId());
                    CollectableListOfValues.this.acceptLookedUpCollectable(c);
                } catch (Exception e) {
                    Errors.getInstance().showExceptionDialog(CollectableListOfValues.this.getListOfValues(), e);
                }
            }
        }
    });
    this.getListOfValues().setQuickSearchCanceledListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            CollectableListOfValues.this.setViewLocked(true);
            CollectableListOfValues.this.modelToView();
            CollectableListOfValues.this.setViewLocked(false);
        }
    });
    if (this.isSearchComponent()) {
        this.getListOfValues().setSearchOnLostFocus(false);
    }

    blnIsLookupEntity = efMeta.getLookupEntity() != null;

    this.getListOfValues().setQuickSearchOnly(!SecurityCache.getInstance().isReadAllowedForEntity(
            efMeta.getForeignEntity() != null ? efMeta.getForeignEntity() : efMeta.getLookupEntity()));

    assert this.isInsertable() == this.isSearchComponent();
}