Example usage for java.util List clear

List of usage examples for java.util List clear

Introduction

In this page you can find the example usage for java.util List clear.

Prototype

void clear();

Source Link

Document

Removes all of the elements from this list (optional operation).

Usage

From source file:net.sf.taverna.t2.activities.rshell.views.RshellConfigurationPanel.java

@Override
protected void initialise() {
    json = getConfiguration().getJson().deepCopy();
    List<ActivityPortConfiguration> inputPorts = getInputPorts();
    inputPorts.clear();
    for (InputActivityPort activityPort : getActivity().getInputPorts()) {
        inputPorts.add(/*from   w  w w  . j  a va2 s  .com*/
                new RshellActivityPortConfiguration(activityPort, getInputDataType(activityPort.getName())));
    }
    List<ActivityPortConfiguration> outputPorts = getOutputPorts();
    outputPorts.clear();
    for (OutputActivityPort activityPort : getActivity().getOutputPorts()) {
        outputPorts.add(
                new RshellActivityPortConfiguration(activityPort, getOutputDataType(activityPort.getName())));
    }
    removeAllPages();
    addPage("Script", createScriptEditPanel());
    addPage("Input ports", createInputPanel());
    addPage("Output ports", createOutputPanel());
    addPage("Connection", createSettingsPanel());
    setPreferredSize(new Dimension(600, 500));
}

From source file:nz.co.senanque.validationengine.metadata.PropertyMetadataImpl.java

public void setChoiceList(final Object[] t) {
    final List<ChoiceBase> list = getInternalChoiceList();
    list.clear();
    for (Object o : t) {
        try {// w  w  w.  jav  a2  s.  c  om
            final Method m = o.getClass().getMethod("value");
            final String s = (String) m.invoke(o);
            list.add(new ChoiceBase(o, s, m_messageSource));
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

From source file:test.integ.be.fedict.hsm.ws.WebServiceSecurityTest.java

private void addSOAPHandler(SOAPHandler<SOAPMessageContext> soapHandler,
        DigitalSignatureServicePortType dssPort) {
    BindingProvider bindingProvider = (BindingProvider) dssPort;
    Binding binding = bindingProvider.getBinding();
    List<Handler> handlerChain = binding.getHandlerChain();
    handlerChain.clear();
    handlerChain.add(soapHandler);/*from w w  w  .ja va2 s . co  m*/
    handlerChain.add(new LoggingSOAPHandler());
    binding.setHandlerChain(handlerChain);
}

From source file:hydrograph.ui.validators.impl.LookupMappingValidationRule.java

@Override
public boolean validate(Object object, String propertyName, Map<String, List<FixedWidthGridRow>> inputSchemaMap,
        boolean isJobImported) {
    LookupMappingGrid lookupMappingGrid = (LookupMappingGrid) object;
    if (lookupMappingGrid == null) {
        errorMessage = propertyName + " is mandatory";
        return false;
    }/*from  w  w  w . ja  v a 2 s . com*/
    List<List<FilterProperties>> lookupInputProperties = lookupMappingGrid.getLookupInputProperties();
    List<LookupMapProperty> lookupMapProperties = lookupMappingGrid.getLookupMapProperties();
    if (isJobImported) {
        lookupInputProperties.clear();
        for (Entry<String, List<FixedWidthGridRow>> inputRow : inputSchemaMap.entrySet()) {
            List<FilterProperties> filterPropertiesList = new ArrayList<FilterProperties>();

            for (FixedWidthGridRow row : inputRow.getValue()) {
                FilterProperties filterProperties = new FilterProperties();
                filterProperties.setPropertyname(row.getFieldName());
                filterPropertiesList.add(filterProperties);
            }
            lookupInputProperties.add(filterPropertiesList);
        }

        lookupMappingGrid.setLookupInputProperties(lookupInputProperties);
        isJobImported = false;
    }
    if (lookupInputProperties == null || lookupInputProperties.isEmpty() || lookupInputProperties.size() < 2) {
        errorMessage = "Invalid input for lookup component";
        return false;
    }
    if (lookupMapProperties == null || lookupMapProperties.isEmpty()) {
        errorMessage = "Invalid output from lookup component";
        return false;
    }

    for (List<FilterProperties> input : lookupInputProperties) {
        if (input == null || input.size() == 0) {
            errorMessage = "Input mapping is mandatory";
            return false;
        }
        for (FilterProperties properties : input) {
            if (StringUtils.isBlank(properties.getPropertyname())) {
                errorMessage = "Input mapping is mandatory";
                return false;
            }
        }
    }

    for (LookupMapProperty lookupMapProperty : lookupMapProperties) {
        if (StringUtils.isBlank(lookupMapProperty.getSource_Field())
                || StringUtils.isBlank(lookupMapProperty.getOutput_Field())) {
            errorMessage = "Output names are mandatory";
            return false;
        }
    }

    if (isInputFieldInvalid(getAllInputFieldNames(lookupInputProperties), lookupMapProperties)) {
        errorMessage = "Invalid input fields in lookup mapping";
        return false;
    }

    if (isOutputFieldInvalid(lookupMapProperties)) {
        errorMessage = "Invalid output fields in lookup mapping";
        return false;
    }

    return true;
}

From source file:com.microsoft.tfs.client.common.ui.framework.helper.ViewHelper.java

/**
 * Locates all views by ID in the workbench and returns them (or null if
 * none were located.)/*from ww  w.  ja v  a  2 s .co  m*/
 *
 * @param id
 *        The view ID to locate (not <code>null</code>)
 * @param activate
 *        True to activate an inactive (but existing) view
 * @return an array of {@link IViewPart}s (never <code>null</code>)
 */
public static IViewPart[] getActiveViews(final String id, final boolean activate) {
    Check.notNull(id, "id"); //$NON-NLS-1$

    final List viewList = new ArrayList();

    try {
        final IWorkbenchWindow workbenchWindow = Workbench.getInstance().getActiveWorkbenchWindow();

        if (workbenchWindow != null) {
            final IWorkbenchPage[] pages = workbenchWindow.getPages();

            for (int i = 0; i < pages.length; i++) {
                final IViewReference[] viewReferences = pages[i].getViewReferences();

                for (int j = 0; j < viewReferences.length; j++) {
                    if (id.equals(viewReferences[j].getId())) {
                        final IViewPart view = viewReferences[j].getView(activate);

                        if (view != null) {
                            viewList.add(view);
                        }
                    }
                }
            }
        } else {
            log.warn("Could not locate active workbench window"); //$NON-NLS-1$
        }
    } catch (final Exception e) {
        final String messageFormat = "Could not locate any view part for {0}"; //$NON-NLS-1$
        final String message = MessageFormat.format(messageFormat, id);
        log.warn(message, e);
        viewList.clear();
    }

    return (IViewPart[]) viewList.toArray(new IViewPart[viewList.size()]);
}

From source file:com.amalto.workbench.actions.XSDDeleteConceptAction.java

private boolean isCommonReferedBy(XSDElementDeclaration decl) {
    List<Object> objList = new ArrayList<Object>();
    IStructuredContentProvider elementContentProvider = (IStructuredContentProvider) page.getTreeViewer()
            .getContentProvider();/*w  w  w.j  ava  2 s .  c om*/
    Object[] objs = Util.getAllObject(page.getSite(), objList, elementContentProvider);

    objList.clear();
    IStructuredContentProvider typeContentProvider = (IStructuredContentProvider) page.getTypesViewer()
            .getContentProvider();
    Object[] typeElems = Util.getAllObject(page.getSite(), objList, typeContentProvider);

    boolean referencedBy = Util.isReferencedBy(decl, objs) || Util.isReferencedBy(decl, typeElems);

    return referencedBy;
}

From source file:com.SignalDiagram.FXMLDocumentController.java

private void updateAnalogChart(List<XYChart.Series<Double, Double>> serieList,
        ObservableList<XYChart.Series<Double, Double>> chartData, AnalogSignal signal) {

    chartData.clear();/*from w  ww  .j a v  a2 s.  c  o  m*/
    serieList.clear();

    for (List<Point2D> lp : signal.getPoints()) {
        XYChart.Series<Double, Double> test = updatePoints(lp);
        serieList.add(updatePoints(lp));
    }

    chartData.addAll(serieList);
}

From source file:gov.nih.nci.cabig.caaers.web.study.SolicitedAdverseEventTab.java

@Override
public void onBind(HttpServletRequest request, StudyCommand command, Errors errors) {
    // TODO Auto-generated method stub
    super.onBind(request, command, errors);

    if (request.getParameter("_ajaxInPlaceEditParam") != null
            || request.getParameter(AJAX_REQUEST_PARAMETER) != null
            || request.getAttribute(AJAX_REQUEST_PARAMETER) != null)
        return;//from  w w w .  j a  v  a2  s. c o  m

    String[] epoch_ids = request.getParameterValues("epoch_id");

    int indexOfEpoch = 0;

    for (Epoch e : command.getStudy().getActiveEpochs()) {
        List<SolicitedAdverseEvent> listOfSolicitedAEs = new ArrayList<SolicitedAdverseEvent>();
        String[] termIDs = request.getParameterValues("epoch[" + indexOfEpoch + "]");

        Term term = command.getStudy().getAeTerminology().getTerm();
        if (termIDs != null)
            for (String termID : termIDs) {
                if (term.equals(Term.CTC)) {
                    CtcTerm ctcterm = ctcTermDao.getById(Integer.parseInt(termID));
                    SolicitedAdverseEvent solicitedAE = new SolicitedAdverseEvent();
                    solicitedAE.setCtcterm(ctcterm);
                    // Add otherMeddra term if exists
                    if (ctcterm.isOtherRequired()) {
                        String attributeName = "otherMeddra-" + ctcterm.getId();
                        String lowLevelTermIdString = (String) findInRequest(request, attributeName);

                        if (StringUtils.isNotBlank(lowLevelTermIdString)) {
                            LowLevelTerm lowLevelTerm = lowLevelTermDao
                                    .getById(Integer.parseInt(lowLevelTermIdString));
                            solicitedAE.setOtherTerm(lowLevelTerm);
                        }

                        attributeName = "verbatim-" + ctcterm.getId();
                        String verbatimString = (String) findInRequest(request, attributeName);
                        if (StringUtils.isNotBlank(verbatimString))
                            solicitedAE.setVerbatim(verbatimString);
                    }
                    listOfSolicitedAEs.add(solicitedAE);
                } else {
                    LowLevelTerm medraterm = lowLevelTermDao.getById(Integer.parseInt(termID));
                    SolicitedAdverseEvent solicitedAE = new SolicitedAdverseEvent();
                    solicitedAE.setLowLevelTerm(medraterm);
                    listOfSolicitedAEs.add(solicitedAE);
                }
            }

        List<SolicitedAdverseEvent> listOfOldSolicitedAEs = e.getArms().get(0).getSolicitedAdverseEvents();
        listOfOldSolicitedAEs.clear();
        listOfOldSolicitedAEs.addAll(listOfSolicitedAEs);
        indexOfEpoch++;
    }
    retainOnlyTheseEpochsInStudy(request, command.getStudy(), epoch_ids);
}

From source file:edu.ku.brc.af.tasks.subpane.BarChartPane.java

public synchronized void allResultsBack(final QueryResultsContainerIFace qrc) {
    // create a dataset... 
    String cat = ""; //$NON-NLS-1$
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    java.util.List<Object> list = handler.getDataObjects();
    for (int i = 0; i < list.size(); i++) {
        Object descObj = list.get(i++);
        Object valObj = list.get(i);
        dataset.addValue(getInt(valObj), getString(descObj), cat);
    }//from   www. j a v a  2s. c  om
    list.clear();

    // create the chart... 
    JFreeChart chart = ChartFactory.createBarChart3D(title, // chart title 
            xAxisTitle, // domain axis label 
            yAxisTitle, // range axis label 
            dataset, // data 
            isVertical ? PlotOrientation.VERTICAL : PlotOrientation.HORIZONTAL, true, // include legend 
            true, // tooltips? 
            false // URLs? 
    );
    // create and display a frame... 
    ChartPanel panel = new ChartPanel(chart, true, true, true, true, true);
    panel.setMaximumSize(new Dimension(100, 100));
    panel.setPreferredSize(new Dimension(100, 100));

    //chart.getCategoryPlot().setRenderer(new CustomColorBarChartRenderer());

    addCompletedComp(panel);

}

From source file:com.utest.domain.service.EnvironmentServiceIntegrationTest.java

public void testSaveEnvironmentGroup() throws Exception {
    final Integer companyId = 9;
    final User user = userService.getUser(1);
    loginUser(user);/* ww w  . ja v  a 2s .c  om*/
    final List<Integer> environmentIds = new ArrayList<Integer>();
    environmentIds.add(1);
    environmentIds.add(2);
    environmentIds.add(3);
    EnvironmentGroup group = environmentService.addEnvironmentGroup(companyId, "VMK test group",
            "VMK description", environmentIds);
    environmentIds.clear();
    environmentIds.add(1);
    environmentIds.add(4);
    group = environmentService.saveEnvironmentsForGroup(group.getId(), environmentIds);
    environmentService.deleteEnvironmentGroup(group.getId(), group.getVersion());
}