Example usage for java.util EnumMap EnumMap

List of usage examples for java.util EnumMap EnumMap

Introduction

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

Prototype

public EnumMap(Map<K, ? extends V> m) 

Source Link

Document

Creates an enum map initialized from the specified map.

Usage

From source file:de.xaniox.heavyspleef.core.flag.FlagManager.java

public void enableFlag(Class<? extends AbstractFlag<?>> clazz, FlagRegistry registry, Game game) {
    Validate.isTrue(!isFlagPresent(clazz));
    Validate.isTrue(clazz.isAnnotationPresent(Flag.class));

    Flag flagAnnotation = clazz.getAnnotation(Flag.class);
    String path = generatePath(flagAnnotation);

    Validate.isTrue(disabledFlags.contains(path), "Flag is not disabled");
    AbstractFlag<?> flag = registry.newFlagInstance(path, AbstractFlag.class, game);

    if (clazz.isAnnotationPresent(BukkitListener.class)) {
        Bukkit.getPluginManager().registerEvents(flag, plugin);
    }//  w  w w. jav a2 s .  co  m

    if (flagAnnotation.hasGameProperties()) {
        Map<GameProperty, Object> flagGamePropertiesMap = new EnumMap<GameProperty, Object>(GameProperty.class);
        flag.defineGameProperties(flagGamePropertiesMap);

        if (!flagGamePropertiesMap.isEmpty()) {
            GamePropertyBundle properties = new GamePropertyBundle(flag, flagGamePropertiesMap);
            propertyBundles.add(properties);
        }
    }

    if (flagAnnotation.parent() != NullFlag.class) {
        AbstractFlag<?> parent = getFlag(flagAnnotation.parent());
        flag.setParent(parent);
    }

    flags.put(path, flag);
    disabledFlags.remove(path);
}

From source file:org.messic.server.api.dlna.MusicService.java

@Transactional
public List<PlaylistItem> getPlaylists(String containerId, long startIndex, long maxCount, VisualContainer vc) {
    List<PlaylistItem> result = new ArrayList<PlaylistItem>();
    List<MDOPlaylist> playlists = this.daoPlaylist.getAllDLNA();

    for (long i = startIndex; i < startIndex + maxCount && i < playlists.size(); i++) {
        MDOPlaylist mdop = playlists.get((int) i);

        HashMap<MDOAuthor, String> authors = new HashMap<MDOAuthor, String>();
        List<MDOSong> songs = mdop.getSongs();
        for (int j = 0; j < songs.size(); j++) {
            MDOSong song = songs.get(j);
            authors.put(song.getAlbum().getAuthor(), "");
        }/*from  w w  w .java 2  s.c o m*/

        PlaylistItem pli = new PlaylistItem();
        pli.setTitle(mdop.getName());
        pli.setDescription(mdop.getName());
        pli.setLongDescription(mdop.getName());
        pli.setDate("24/01/2013");
        MDOAuthor[] mdoauthors = new MDOAuthor[authors.size()];
        authors.keySet().toArray(mdoauthors);
        PersonWithRole[] persons = new PersonWithRole[mdoauthors.length];
        for (int k = 0; k < mdoauthors.length; k++) {
            MDOAuthor mdoa = mdoauthors[k];
            PersonWithRole pwr = new PersonWithRole(mdoa.getName());
            persons[k] = pwr;
        }
        pli.setArtists(persons);

        pli.setParentID(mdop.getOwner().getSid() + "");
        pli.setId(mdop.getOwner().getSid() + MessicContainer.SEPARATOR);

        for (int l = 0; l < mdop.getSongs().size(); l++) {
            MDOSong song = mdop.getSongs().get(l);

            MDOUser user = song.getOwner();
            String token = loginDLNA(user.getLogin(), user.getPassword());

            Res resource = new Res();
            EnumMap<DLNAAttribute.Type, DLNAAttribute> dlnaAttributes = new EnumMap<DLNAAttribute.Type, DLNAAttribute>(
                    DLNAAttribute.Type.class);

            URI originalUri = null;
            try {
                originalUri = new URI(
                        (isSecured() ? "https" : "http") + "://" + Util.getInternalIp() + ":" + getCurrentPort()
                                + "/messic/services/songs/" + song.getSid() + "/dlna?messic_token=" + token);
            } catch (URISyntaxException e) {
                log.error("failed!", e);
            } catch (Exception e) {
                log.error("failed!", e);
            }
            resource.setValue(originalUri.toString());
            DLNAProfiles originalProfile = DLNAProfiles.MP3;
            dlnaAttributes.put(DLNAAttribute.Type.DLNA_ORG_PN, new DLNAProfileAttribute(originalProfile));
            dlnaAttributes.put(DLNAAttribute.Type.DLNA_ORG_OP,
                    new DLNAOperationsAttribute(DLNAOperations.RANGE));
            dlnaAttributes.put(DLNAAttribute.Type.DLNA_ORG_CI,
                    new DLNAConversionIndicatorAttribute(DLNAConversionIndicator.NONE));
            dlnaAttributes.put(DLNAAttribute.Type.DLNA_ORG_FLAGS,
                    new DLNAFlagsAttribute(DLNAFlags.STREAMING_TRANSFER_MODE,
                            DLNAFlags.BACKGROUND_TRANSFERT_MODE, DLNAFlags.DLNA_V15));

            resource.setProtocolInfo(new DLNAProtocolInfo(Protocol.HTTP_GET, ProtocolInfo.WILDCARD, "audio/mp3",
                    dlnaAttributes));

            pli.addResource(resource);

        }

        result.add(pli);
    }
    return result;
}

From source file:org.apache.accumulo.server.problems.ProblemReports.java

public Map<String, Map<ProblemType, Integer>> summarize() {

    TreeMap<String, Map<ProblemType, Integer>> summary = new TreeMap<String, Map<ProblemType, Integer>>();

    for (ProblemReport pr : this) {
        Map<ProblemType, Integer> tableProblems = summary.get(pr.getTableName());
        if (tableProblems == null) {
            tableProblems = new EnumMap<ProblemType, Integer>(ProblemType.class);
            summary.put(pr.getTableName(), tableProblems);
        }//from  w  ww  .j a  v a  2s.c  om

        Integer count = tableProblems.get(pr.getProblemType());
        if (count == null) {
            count = 0;
        }

        tableProblems.put(pr.getProblemType(), count + 1);
    }

    return summary;
}

From source file:com.adobe.acs.commons.mcp.impl.processes.TagCreator.java

private void record(ReportRowSatus status, String tagId, String path, String title) {
    final EnumMap<ReportColumns, Object> row = new EnumMap<>(ReportColumns.class);

    row.put(ReportColumns.STATUS, StringUtil.getFriendlyName(status.name()));
    row.put(ReportColumns.TAG_ID, tagId);
    row.put(ReportColumns.TAG_PATH, path);
    row.put(ReportColumns.TAG_TITLE, title);

    reportRows.add(row);/*from w  ww.  j  a  va2s.  c  o  m*/
}

From source file:org.openecomp.sdc.be.components.impl.ServiceBusinessLogic.java

public Either<Service, ResponseFormat> changeServiceDistributionState(String serviceId, String state,
        LifecycleChangeInfoWithAction commentObj, User user) {

    Either<User, ResponseFormat> resp = validateUserExists(user.getUserId(),
            "change Service Distribution State", false);
    if (resp.isRight()) {
        return Either.right(resp.right().value());
    }/*  ww w  .java2  s .  c o m*/

    log.debug("check request state");
    Either<DistributionTransitionEnum, ResponseFormat> validateEnum = validateTransitionEnum(state, user);
    if (validateEnum.isRight()) {
        return Either.right(validateEnum.right().value());
    }
    DistributionTransitionEnum distributionTransition = validateEnum.left().value();
    AuditingActionEnum auditAction = (distributionTransition == DistributionTransitionEnum.APPROVE
            ? AuditingActionEnum.DISTRIBUTION_STATE_CHANGE_APPROV
            : AuditingActionEnum.DISTRIBUTION_STATE_CHANGE_REJECT);
    Either<String, ResponseFormat> commentResponse = validateComment(commentObj, user, auditAction);
    if (commentResponse.isRight()) {
        return Either.right(commentResponse.right().value());
    }
    String comment = commentResponse.left().value();

    Either<Service, ResponseFormat> validateService = validateServiceDistributionChange(user, serviceId,
            auditAction, comment);
    if (validateService.isRight()) {
        return Either.right(validateService.right().value());
    }
    Service service = validateService.left().value();
    DistributionStatusEnum initState = service.getDistributionStatus();

    Either<User, ResponseFormat> validateUser = validateUserDistributionChange(user, service, auditAction,
            comment);
    if (validateUser.isRight()) {
        return Either.right(validateUser.right().value());
    }
    user = validateUser.left().value();

    // lock resource
    /*
     * StorageOperationStatus lockResult = graphLockOperation.lockComponent(serviceId, NodeTypeEnum.Service); if (!lockResult.equals(StorageOperationStatus.OK)) { BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.
     * BeFailedLockObjectError, "ChangeServiceDistributionState"); log.debug("Failed to lock service {} error - {}", serviceId, lockResult); ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR,
     * service.getVersion(), service.getServiceName());
     * 
     * createAudit(user, auditAction, comment, service, responseFormat); return Either.right(componentsUtils.getResponseFormat(ActionStatus. GENERAL_ERROR)); }
     */
    Either<Boolean, ResponseFormat> lockResult = lockComponent(serviceId, service,
            "ChangeServiceDistributionState");
    if (lockResult.isRight()) {
        ResponseFormat responseFormat = lockResult.right().value();
        createAudit(user, auditAction, comment, service, responseFormat);
        return Either.right(responseFormat);
    }

    try {

        DistributionStatusEnum newState;
        if (distributionTransition == DistributionTransitionEnum.APPROVE) {
            newState = DistributionStatusEnum.DISTRIBUTION_APPROVED;
        } else {
            newState = DistributionStatusEnum.DISTRIBUTION_REJECTED;
        }
        Either<Service, StorageOperationStatus> result = serviceOperation.updateDestributionStatus(service,
                user, newState);
        if (result.isRight()) {
            titanGenericDao.rollback();
            BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeSystemError,
                    "ChangeServiceDistributionState");
            BeEcompErrorManager.getInstance().logBeSystemError("ChangeServiceDistributionState");
            log.debug("service {} is  change destribuation status failed", service.getUniqueId());
            ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR,
                    service.getVersion(), service.getName());
            createAudit(user, auditAction, comment, service, responseFormat);
            return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR));
        }
        titanGenericDao.commit();
        Service updatedService = result.left().value();
        ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.OK);
        EnumMap<AuditingFieldsKeysEnum, Object> auditingFields = new EnumMap<AuditingFieldsKeysEnum, Object>(
                AuditingFieldsKeysEnum.class);
        auditingFields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_DCURR_STATUS,
                updatedService.getDistributionStatus().name());
        auditingFields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_DPREV_STATUS, initState.name());
        createAudit(user, auditAction, comment, updatedService, responseFormat, auditingFields);
        return Either.left(result.left().value());

    } finally {
        graphLockOperation.unlockComponent(serviceId, NodeTypeEnum.Service);
    }

}

From source file:org.apache.hadoop.corona.ClusterNode.java

/**
 * Get a mapping of the resource type to amount of resources for a given
 * number of cpus./*from   w ww.  j  ava2 s .  c  o m*/
 *
 * @param numCpus Number of cpus available
 * @param cpuToResourcePartitioning Mapping of number of cpus to resources
 * @return Resources for this amount of cpus
 */
public static Map<ResourceType, Integer> getResourceTypeToCountMap(int numCpus,
        Map<Integer, Map<ResourceType, Integer>> cpuToResourcePartitioning) {
    Map<ResourceType, Integer> ret = cpuToResourcePartitioning.get(numCpus);
    if (ret == null) {
        Map<ResourceType, Integer> oneCpuMap = cpuToResourcePartitioning.get(1);
        if (oneCpuMap == null) {
            throw new RuntimeException(
                    "No matching entry for cpu count: " + numCpus + " in node and no 1 cpu map");
        }

        ret = new EnumMap<ResourceType, Integer>(ResourceType.class);
        for (ResourceType key : oneCpuMap.keySet()) {
            ret.put(key, oneCpuMap.get(key).intValue() * numCpus);
        }
    }
    return ret;
}

From source file:fr.free.movierenamer.scrapper.impl.movie.RottenTomatoesScrapper.java

@Override
protected List<CastingInfo> fetchCastingInfo(Movie movie, IdInfo id, AvailableLanguages language)
        throws Exception {

    URL searchUrl = new URL("http", apiHost,
            "/api/public/v" + version + "/movies/" + id + "/cast.json?apikey=" + apikey);
    JSONObject json = URIRequest.getJsonDocument(searchUrl.toURI());

    List<CastingInfo> casting = new ArrayList<CastingInfo>();

    String section = "cast";

    List<JSONObject> jsonObjs = JSONUtils.selectList(section, json);
    for (JSONObject jsonObj : jsonObjs) {
        Map<CastingInfo.PersonProperty, String> personFields = new EnumMap<CastingInfo.PersonProperty, String>(
                CastingInfo.PersonProperty.class);
        personFields.put(CastingInfo.PersonProperty.name, JSONUtils.selectString("name", jsonObj));
        personFields.put(CastingInfo.PersonProperty.character, JSONUtils.selectString("character", jsonObj));
        personFields.put(CastingInfo.PersonProperty.job, CastingInfo.ACTOR);

        casting.add(new CastingInfo(personFields, null));
    }//from  w  w w  .  j  a va2s. co  m

    searchUrl = new URL("http", apiHost,
            "/api/public/v" + version + "/movies/" + movie.getMediaId() + ".json?apikey=" + apikey);
    json = URIRequest.getJsonDocument(searchUrl.toURI());

    for (JSONObject jsonObj : JSONUtils.selectList("abridged_director", json)) {
        Map<CastingInfo.PersonProperty, String> personFields = new EnumMap<CastingInfo.PersonProperty, String>(
                CastingInfo.PersonProperty.class);
        personFields.put(CastingInfo.PersonProperty.name, JSONUtils.selectString("name", jsonObj));
        personFields.put(CastingInfo.PersonProperty.job, CastingInfo.DIRECTOR);

        casting.add(new CastingInfo(personFields, null));
    }

    return casting;
}

From source file:org.apache.falcon.regression.ui.search.MirrorWizardPage.java

public Map<Summary, String> getSummaryProperties() {
    String formText = driver.findElement(By.id("formSummaryBox")).getText();
    Map<Summary, String> props = new EnumMap<>(Summary.class);
    props.put(Summary.NAME, getBetween(formText, "Name", "Type"));
    props.put(Summary.TYPE, getBetween(formText, "Type", "Tags"));
    props.put(Summary.TAGS, getBetween(formText, "Tags", "Source"));
    props.put(Summary.RUN_ON, getBetween(formText, "Run On", "Schedule"));
    props.put(Summary.START, getBetween(formText, "Start on:", "End on:"));
    props.put(Summary.END, getBetween(formText, "End on:", "Max Maps"));
    props.put(Summary.MAX_MAPS, getBetween(formText, "Max Maps", "Max Bandwidth"));
    props.put(Summary.MAX_BANDWIDTH, getBetween(formText, "Max Bandwidth", "ACL"));

    props.put(Summary.ACL_OWNER, getBetween(formText, "Owner:", "Group:"));
    props.put(Summary.ACL_GROUP, getBetween(formText, "Group:", "Permissions:"));
    props.put(Summary.ACL_PERMISSIONS, getBetween(formText, "Permissions:", "Retry"));

    props.put(Summary.RETRY_POLICY, getBetween(formText, "Policy:", "delay:"));
    props.put(Summary.RETRY_DELAY, getBetween(formText, "delay:", "Attempts:"));
    props.put(Summary.RETRY_ATTEMPTS, getBetween(formText, "Attempts:", "Frequency"));

    props.put(Summary.FREQUENCY, getBetween(formText, "Frequency", "Previous"));

    String source = getBetween(formText, "Source", "Target");
    String target = getBetween(formText, "Target", "Run On");
    if ("HDFS".equals(props.get(Summary.TYPE))) {
        props.put(Summary.SOURCE_LOCATION, getBetween(source, "Location", "Path"));
        props.put(Summary.TARGET_LOCATION, getBetween(target, "Location", "Path"));
        if ("HDFS".equals(props.get(Summary.SOURCE_LOCATION))) {
            props.put(Summary.SOURCE_CLUSTER, getBetween(source, "^", "Location"));
            props.put(Summary.SOURCE_PATH, getBetween(source, "Path:", "$"));

        } else {/*from  ww  w.j  av  a  2s . co  m*/
            props.put(Summary.SOURCE_PATH, getBetween(source, "Path:", "URL"));
            props.put(Summary.SOURCE_URL, getBetween(source, "URL:", "$"));

        }
        if ("HDFS".equals(props.get(Summary.TARGET_LOCATION))) {
            props.put(Summary.TARGET_CLUSTER, getBetween(target, "^", "Location"));
            props.put(Summary.TARGET_PATH, getBetween(target, "Path:", "$"));

        } else {
            props.put(Summary.TARGET_PATH, getBetween(target, "Path:", "URL"));
            props.put(Summary.TARGET_URL, getBetween(target, "URL:", "$"));

        }

    } else {
        LOGGER.error("TODO Read info for HIVE replication.");
    }

    return props;
}

From source file:org.apache.shindig.gadgets.JsFeatureLoader.java

public ParsedFeature() {
    libraries = new EnumMap<RenderingContext, Map<String, List<JsLibrary>>>(RenderingContext.class);
    deps = Lists.newLinkedList();//from  ww  w .  j av  a2s. c o m
}

From source file:org.yccheok.jstock.gui.charting.ChartJDialog.java

/**
 * Build menu items for TA.//from   w  ww  . j  av a2s.c om
 */
private void buildTAMenuItems() {
    final int[] days = { 14, 28, 50, 100, 200 };
    final MACD.Period[] macd_periods = { MACD.Period.newInstance(12, 26, 9) };

    // day_keys, week_keys and month_keys should be having same length as
    // days.        
    final String[] day_keys = { "ChartJDialog_14Days", "ChartJDialog_28Days", "ChartJDialog_50Days",
            "ChartJDialog_100Days", "ChartJDialog_200Days" };
    final String[] week_keys = { "ChartJDialog_14Weeks", "ChartJDialog_28Weeks", "ChartJDialog_50Weeks",
            "ChartJDialog_100Weeks", "ChartJDialog_200Weeks" };
    final String[] month_keys = { "ChartJDialog_14Months", "ChartJDialog_28Months", "ChartJDialog_50Months",
            "ChartJDialog_100Months", "ChartJDialog_200Months" };
    assert (days.length == day_keys.length);
    assert (days.length == week_keys.length);
    assert (days.length == week_keys.length);
    // macd_day_keys, macd_week_keys and macd_month_keys should be having 
    // same length as macd_periods.
    final String[] macd_day_keys = { "ChartJDialog_12_26_9Days" };
    final String[] macd_week_keys = { "ChartJDialog_12_26_9Weeks" };
    final String[] macd_month_keys = { "ChartJDialog_12_26_9Months" };
    assert (macd_periods.length == macd_day_keys.length);
    assert (macd_periods.length == macd_week_keys.length);
    assert (macd_periods.length == macd_month_keys.length);

    String[] keys = null;
    String[] macd_keys = null;
    if (this.getCurrentInterval() == Interval.Daily) {
        keys = day_keys;
        macd_keys = macd_day_keys;
    } else if (this.getCurrentInterval() == Interval.Weekly) {
        keys = week_keys;
        macd_keys = macd_week_keys;
    } else if (this.getCurrentInterval() == Interval.Monthly) {
        keys = month_keys;
        macd_keys = macd_month_keys;
    } else {
        assert (false);
    }
    final TA[] tas = TA.values();
    final String[] ta_keys = { "ChartJDialog_SMA", "ChartJDialog_EMA", "ChartJDialog_MACD", "ChartJDialog_RSI",
            "ChartJDialog_MFI", "ChartJDialog_CCI" };
    final String[] ta_tip_keys = { "ChartJDialog_SimpleMovingAverage", "ChartJDialog_ExponentialMovingAverage",
            "ChartJDialog_MovingAverageConvergenceDivergence", "ChartJDialog_RelativeStrengthIndex",
            "ChartJDialog_MoneyFlowIndex", "ChartJDialog_CommodityChannelIndex" };
    final String[] custom_message_keys = { "info_message_please_enter_number_of_days_for_SMA",
            "info_message_please_enter_number_of_days_for_EMA", "dummy",
            "info_message_please_enter_number_of_days_for_RSI",
            "info_message_please_enter_number_of_days_for_MFI",
            "info_message_please_enter_number_of_days_for_CCI" };
    final Map<TA, Set<Object>> m = new EnumMap<TA, Set<Object>>(TA.class);
    final int taExSize = JStock.instance().getChartJDialogOptions().getTAExSize();
    for (int i = 0; i < taExSize; i++) {
        final TAEx taEx = JStock.instance().getChartJDialogOptions().getTAEx(i);
        if (m.containsKey(taEx.getTA()) == false) {
            m.put(taEx.getTA(), new HashSet<Object>());
        }
        m.get(taEx.getTA()).add(taEx.getParameter());
    }

    for (int i = 0, length = tas.length; i < length; i++) {
        final TA ta = tas[i];
        javax.swing.JMenu menu = new javax.swing.JMenu();
        menu.setText(GUIBundle.getString(ta_keys[i])); // NOI18N
        menu.setToolTipText(GUIBundle.getString(ta_tip_keys[i])); // NOI18N

        if (ta == TA.MACD) {
            for (int j = 0, length2 = macd_periods.length; j < length2; j++) {
                final int _j = j;
                final javax.swing.JCheckBoxMenuItem item = new javax.swing.JCheckBoxMenuItem();
                item.setText(GUIBundle.getString(macd_keys[j]));
                if (m.containsKey(ta)) {
                    if (m.get(ta).contains(macd_periods[_j])) {
                        item.setSelected(true);
                    }
                }
                item.addActionListener(new java.awt.event.ActionListener() {
                    @Override
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        if (ta == TA.MACD) {
                            updateMACD(macd_periods[_j], item.isSelected());
                        }
                    }
                });
                menu.add(item);
            }
        } else {
            for (int j = 0, length2 = days.length; j < length2; j++) {
                final int _j = j;
                final javax.swing.JCheckBoxMenuItem item = new javax.swing.JCheckBoxMenuItem();
                item.setText(GUIBundle.getString(keys[j])); // NOI18N
                if (m.containsKey(ta)) {
                    if (m.get(ta).contains(days[_j])) {
                        item.setSelected(true);
                    }
                }
                item.addActionListener(new java.awt.event.ActionListener() {
                    @Override
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        if (ta == TA.SMA) {
                            updateSMA(days[_j], item.isSelected());
                        } else if (ta == TA.EMA) {
                            updateEMA(days[_j], item.isSelected());
                        } else if (ta == TA.MFI) {
                            updateMFI(days[_j], item.isSelected());
                        } else if (ta == TA.RSI) {
                            updateRSI(days[_j], item.isSelected());
                        } else if (ta == TA.CCI) {
                            updateCCI(days[_j], item.isSelected());
                        }
                    }
                });
                menu.add(item);
            } // for
        } // if (ta == TA.MACD)

        menu.add(new javax.swing.JSeparator());
        javax.swing.JMenuItem item = new javax.swing.JMenuItem();
        item.setText(GUIBundle.getString("ChartJDialog_Custom...")); // NOI18N
        final int _i = i;
        item.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                if (ta == TA.MACD) {
                    showMACDCustomDialog();
                } else {
                    do {
                        final String days_string = JOptionPane.showInputDialog(ChartJDialog.this,
                                MessagesBundle.getString(custom_message_keys[_i]));
                        if (days_string == null) {
                            return;
                        }
                        try {
                            final int days = Integer.parseInt(days_string);
                            if (days <= 0) {
                                JOptionPane.showMessageDialog(ChartJDialog.this,
                                        MessagesBundle.getString("info_message_number_of_days_required"),
                                        MessagesBundle.getString("info_title_number_of_days_required"),
                                        JOptionPane.WARNING_MESSAGE);
                                continue;
                            }
                            ChartJDialog.this.updateTA(ta, days, true);
                            return;
                        } catch (java.lang.NumberFormatException exp) {
                            log.error(null, exp);
                            JOptionPane.showMessageDialog(ChartJDialog.this,
                                    MessagesBundle.getString("info_message_number_of_days_required"),
                                    MessagesBundle.getString("info_title_number_of_days_required"),
                                    JOptionPane.WARNING_MESSAGE);
                            continue;
                        }
                    } while (true);
                }
            }
        });
        menu.add(item);

        // TEMP DISABLE MACD
        // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        if (ta != TA.MACD) {
            this.jMenu2.add(menu);
        }
    } // for
    this.jMenu2.add(new javax.swing.JSeparator());
    javax.swing.JMenuItem item = new javax.swing.JMenuItem();
    item.setText(GUIBundle.getString("ChartJDialog_ClearAll")); // NOI18N
    item.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            ChartJDialog.this.clearAll();
        }
    });
    this.jMenu2.add(item);
}