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.result.ResultController.java

/**
 * replaces the <code>Collectable</code>s the table model that have the same ids
 * as the given <code>Collectable</code>s, with those <code>Collectable</code>s.
 * @param collclct//www  .  j  ava 2 s  . c om
 * @precondition collclct != null
 *
 * TODO Make this protected again.
 */
public final void replaceCollectablesInTableModel(Collection<Clct> collclct) {
    if (collclct == null) {
        throw new NullArgumentException("collclct");
    }
    for (Clct clct : collclct) {
        this.replaceCollectableInTableModel(clct);
    }
}

From source file:org.nuclos.client.ui.collect.result.SearchResultStrategy.java

/**
 * @param searchworker//from www . j  av a  2 s.co m
 * @precondition searchworker != null
 */
private void cmdSearchMultiThreaded(final SearchWorker<Clct> searchworker, final boolean bRefreshOnly) {
    final CollectController<Clct> cc = getCollectController();
    UIUtils.runShortCommand(cc.getTab(), new CommonRunnable() {
        @Override
        public void run() throws CommonValidationException {
            if (searchworker == null) {
                throw new NullArgumentException("searchworker");
            }

            if (!cc.stopEditingInSearch()) {
                throw new CommonValidationException(
                        "Die eingegebene Suchbedingung ist ung\u00fcltig bzw. unvollst\u00e4ndig.");
            } else {
                // TODO remove - painting isn't necessary here:
                UIUtils.paintImmediately(cc.getSearchPanel().tfStatusBar);
                //rc.writeSelectedFieldsAndWidthsToPreferences();
                final List<Clct> selected = cc.getSelectedCollectables();
                adjustVerticalScrollBarForSearch(bRefreshOnly);

                CommonMultiThreader.getInstance().execute(new CommonClientWorkerAdapter<Clct>(cc) {
                    private volatile List<Clct> lstclctResult;

                    @Override
                    public void init() throws CommonBusinessException {
                        super.init();

                        searchworker.startSearch();
                    }

                    @Override
                    public void work() throws CommonBusinessException {
                        this.lstclctResult = searchworker.getResult();
                    }

                    @Override
                    public void paint() throws CommonBusinessException {
                        if (this.lstclctResult != null) {
                            searchworker.finishSearch(this.lstclctResult);

                            if (cc.isSearchPanelAvailable()) {
                                // TODO On refresh, it's "counter intuitive" to leave result mode here.
                                cc.setCollectState(CollectState.OUTERSTATE_SEARCH,
                                        CollectState.SEARCHMODE_SYNCHED);
                            }
                            if (selected != null && !selected.isEmpty()) {
                                selected.clear();
                            }
                            cc.setCollectState(CollectState.OUTERSTATE_RESULT,
                                    CollectState.RESULTMODE_NOSELECTION);
                        }

                        super.paint();
                        if (cc.getResultPanel() != null) {
                            cc.getResultPanel().requestFocusInWindow();
                        }
                    }
                });
            }
        }
    });
}

From source file:org.nuclos.client.ui.collect.searcheditor.AtomicSearchConditionTreeNode.java

/**
 * @param atomiccond//from w w  w .j  a  v  a  2 s .  c  o m
 * @precondition atomiccond != null
 */
public AtomicSearchConditionTreeNode(AtomicCollectableSearchCondition atomiccond) {
    if (atomiccond == null) {
        throw new NullArgumentException("atomiccond");
    }
    this.atomiccond = atomiccond;
}

From source file:org.nuclos.client.ui.collect.searcheditor.SearchConditionTreeNode.java

/**
 * @param clctcond//from   w  ww . j a  v  a2  s.c  o m
 * @precondition clctcond != null
 * @return
 * @postcondition result != null
 */
public static SearchConditionTreeNode newInstance(CollectableSearchCondition clctcond) {
    if (clctcond == null) {
        throw new NullArgumentException("clctcond");
    }
    final SearchConditionTreeNode result = clctcond.accept(new NewSearchConditionTreeNodeVisitor());

    assert result != null;
    return result;
}

From source file:org.nuclos.client.ui.collect.searcheditor.SearchEditorController.java

/**
 * @param treenode/*  w  w  w.  j  a va  2s  .  co m*/
 * @param tree the tree that is to contain the popup menu
 * @return the popupmenu, if any, for the given treenode
 * @precondition treenode != null
 */
private JPopupMenu getPopupMenu(SearchConditionTreeNode treenode, JTree tree) {
    if (treenode == null) {
        throw new NullArgumentException("treenode");
    }
    if (this.clctfproviderfactory == null) {
        throw new IllegalStateException(
                "No CollectableFieldsProviderFactory was defined for the search editor.");
    }

    final List<TreeNodeAction> lstaction = treenode.getTreeNodeActions(tree, this.clcteRoot,
            this.clctfproviderfactory, this.additionalFields);
    final JPopupMenu result = lstaction.isEmpty() ? null : new JPopupMenu();
    if (result != null) {
        final String sDefaultTreeNodeActionCommand = treenode.getDefaultTreeNodeActionCommand();
        for (TreeNodeAction action : lstaction) {
            if (action == null) {
                Logger.getLogger(SearchEditorController.class).warn("exploreraction == null");
            } else {
                final boolean bDefault = (sDefaultTreeNodeActionCommand != null)
                        && sDefaultTreeNodeActionCommand.equals(action.getValue(Action.ACTION_COMMAND_KEY));
                action.addToMenu(result, bDefault);
            }
        }
    }
    return result;
}

From source file:org.nuclos.client.ui.collect.strategy.AbstractCompleteCollectablesStrategy.java

/**
 * reads a bunch of <code>Collectable</code>s from the database.
 * This default implementation reads them one by one. Successors may implement a more efficient version here.
 * @param collclct Collection<Collectable>
 * @return Collection<Collectable> contains the read <code>Collectable</code>s.
 * @throws CommonBusinessException//from  w  w w  .ja  va 2  s  .  com
 * @precondition collclct != null
 * @postcondition result != null
 * @postcondition result.size() == collclct.size()
 */
@Override
public Collection<Clct> getCompleteCollectables(Collection<Clct> collclct, String customUsage)
        throws CommonBusinessException {
    if (collclct == null) {
        throw new NullArgumentException("collclct");
    }
    final Collection<Clct> result = new ArrayList<Clct>();
    for (Clct clct : collclct) {
        final Clct clctComplete = this.isComplete(clct) ? clct : cc.readCollectable(clct);
        result.add(clctComplete);
    }
    assert result != null;
    assert result.size() == collclct.size();
    return result;
}

From source file:org.nuclos.client.ui.collect.strategy.CompleteGenericObjectsStrategy.java

/**
 * reads a bunch of <code>CollectableGenericObjectWithDependants</code> from the database.
 * @param collclctlo Collection<Collectable>
 * @return Collection<Collectable> contains the read <code>CollectableGenericObjectWithDependants</code>.
 * @throws CommonBusinessException/*from  w w  w .  java2  s  . c om*/
 * @precondition collclctlo != null
 * @postcondition result != null
 * @postcondition result.size() == collclct.size()
 */
@Override
public Collection<CollectableGenericObjectWithDependants> getCompleteCollectables(
        Collection<CollectableGenericObjectWithDependants> collclctlo, String customUsage)
        throws CommonBusinessException {
    if (collclctlo == null)
        throw new NullArgumentException("collclctlo");
    final Collection<CollectableGenericObjectWithDependants> result = new ArrayList<CollectableGenericObjectWithDependants>();

    final Collection<CollectableGenericObject> collclctIncomplete = new ArrayList<CollectableGenericObject>();
    CollectionUtils.split(collclctlo, new Collectable.IsComplete(), result, collclctIncomplete);

    if (!collclctIncomplete.isEmpty()) {
        final Collection<Object> collIds = CollectionUtils.transform(collclctIncomplete,
                new Collectable.GetId());
        final CollectableSearchCondition cond = SearchConditionUtils
                .getCollectableSearchConditionForIds(collIds);

        final Integer iCommonModuleId = getCommonModuleId(collclctlo);

        final Set<String> stRequiredSubEntityNames = (iCommonModuleId == null) ? Collections.<String>emptySet()
                : GenericObjectMetaDataCache.getInstance().getSubFormEntityNamesByModuleId(iCommonModuleId);

        final List<GenericObjectWithDependantsVO> lstlowdcvo = GenericObjectDelegate.getInstance()
                .getCompleteGenericObjectsWithDependants(iCommonModuleId, cond, stRequiredSubEntityNames,
                        customUsage);
        result.addAll(CollectionUtils.transform(lstlowdcvo,
                new CollectableGenericObjectWithDependants.MakeCollectable()));
    }

    assert result != null;
    assert result.size() == collclctlo.size();
    return result;
}

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

/**
 * @param entityName/*www.j  ava 2s. co  m*/
 * @param toolBarOrientation @see JToolbar#setOrientation
 * @param foreignKeyFieldToParent Needs only be specified if not unique. @see #getForeignKeyFieldToParent()
 * @precondition entityName != null
 * @postcondition this.getForeignKeyFieldToParent() == foreignKeyFieldToParent
 */
public SubForm(String entityName, int toolBarOrientation, String foreignKeyFieldToParent, boolean bLayout) {
    super(new GridLayout(1, 1));
    this.rowHeightCtrl = new RowHeightController(this);

    this.bLayout = bLayout;
    this.toolbar = UIUtils.createNonFloatableToolBar(toolBarOrientation);

    this.listeners = new ArrayList<SubFormToolListener>();
    subformtbl = new SubFormTable(this) {
        protected void configureEnclosingScrollPane() {
            super.configureEnclosingScrollPane();
            if (getSubFormFilter() != null) {
                getSubFormFilter().setupTableHeaderForScrollPane(scrollPane);
            }
        }
    };
    subformtbl.addMouseListener(new SubFormPopupMenuMouseAdapter(subformtbl));
    subformtbl.addMouseListener(new DoubleClickMouseAdapter());
    subformtbl.addMouseMotionListener(new URIMouseAdapter());
    subformtbl.addMouseListener(new URIMouseAdapter());
    contentPane.add(scrollPane, BorderLayout.CENTER);

    if (entityName == null) {
        throw new NullArgumentException("entityName");
    }
    this.entityName = entityName;
    if (toolBarOrientation == -1) {
        this.toolbar.setVisible(false);
    } else {
        this.toolbar.setOrientation(toolBarOrientation);
    }
    this.foreignKeyFieldToParent = foreignKeyFieldToParent;
    this.collectableComponentFactory = CollectableComponentFactory.getInstance();
    layer = new JXLayer<JComponent>(contentPane, new TranslucentLockableUI());
    layer.setName("JXLayerGlasspane");
    add(layer);

    toolbarButtons = new HashMap<String, AbstractButton>();
    toolbarMenuItems = new HashMap<String, JMenuItem>();
    toolbarOrder = new ArrayList<String>();
    for (ToolbarFunction func : ToolbarFunction.values()) {
        AbstractButton button = func.createButton();
        JMenuItem mi = func.createMenuItem();
        toolbarButtons.put(func.name(), button);
        toolbarMenuItems.put(func.name(), mi);
        toolbar.add(button);
        button.addActionListener(this);
        mi.addActionListener(this);
        toolbarOrder.add(func.name());
    }

    setToolbarFunctionState(ToolbarFunction.REMOVE, ToolbarFunctionState.DISABLED);
    setToolbarFunctionState(ToolbarFunction.MULTIEDIT, ToolbarFunctionState.HIDDEN);
    setToolbarFunctionState(ToolbarFunction.DOCUMENTIMPORT, ToolbarFunctionState.HIDDEN);
    setToolbarFunctionState(ToolbarFunction.FILTER, ToolbarFunctionState.HIDDEN);

    this.init();

    assert this.getForeignKeyFieldToParent() == foreignKeyFieldToParent;
}

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

/**
 * @param clctef//from   ww w  .  j a  va2  s.c om
 * @param clctfValue
 * @return
 * @precondition clctfValue != null
 * @postcondition clctfValue.isNull() --> result == null
 */
private static CollectableComparison getSearchConditionForValue(CollectableEntityField clctef,
        CollectableField clctfValue) {
    if (clctfValue == null) {
        throw new NullArgumentException("clctfValue");
    }
    return clctfValue.isNull() ? null : new CollectableComparison(clctef, ComparisonOperator.EQUAL, clctfValue);
}

From source file:org.nuclos.client.ui.FileIcons.java

/**
 * @param sFileType/* ww  w . ja  v a 2 s.  c o m*/
 * @return the Icon suitable to the given file type.
 * @precondition sFileType != null
 */
public static ImageIcon getIcon(String sFileType) {
    if (sFileType == null) {
        throw new NullArgumentException("sFileType");
    }
    final String sIconFileName = "org/nuclos/client/ui/images/file/" + getIconFileName(sFileType);
    final URL url = FileIcons.class.getClassLoader().getResource(sIconFileName);
    if (url == null) {
        throw new CommonFatalException(
                StringUtils.getParameterizedExceptionMessage("FileIcons.1", sIconFileName));//"Bilddatei nicht gefunden: " + sIconFileName);
    }
    return new ImageIcon(url);
}