javatips.net counter

Java Examples for org.achartengine.model.XYMultipleSeriesDataset

The following java examples will help you to understand the usage of org.achartengine.model.XYMultipleSeriesDataset. These source code samples are taken from different open source projects.

Example 1
Project: slkr-master  File: CourseSummaryActivity.java View source code
public void addBarChart(View view) {
    pie.getBackground().setColorFilter(0xFF37474f, PorterDuff.Mode.MULTIPLY);
    bar.getBackground().setColorFilter(0xFFff3d00, PorterDuff.Mode.MULTIPLY);
    line.getBackground().setColorFilter(0xFF37474f, PorterDuff.Mode.MULTIPLY);
    List<String> names = new ArrayList<String>();
    // Creating an XYSeries for Income
    XYSeries earnedSeries = new XYSeries("Earned");
    XYSeries totalSeries = new XYSeries("Total");
    // Adding data to Income and Expense Series
    float maxWeight = 0;
    for (int i = 0; i < mAssignments.size(); i++) {
        earnedSeries.add(i, (mAssignments.get(i).getGrade() * mAssignments.get(i).getWeight() * .01));
        totalSeries.add(i, mAssignments.get(i).getWeight());
        if (mAssignments.get(i).getWeight() > maxWeight) {
            maxWeight = mAssignments.get(i).getWeight();
        }
    }
    XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
    dataset.addSeries(earnedSeries);
    dataset.addSeries(totalSeries);
    // Creating XYSeriesRenderer to customize incomeSeries
    XYSeriesRenderer earnedRenderer = new XYSeriesRenderer();
    earnedRenderer.setColor(Color.rgb(228, 26, 28));
    earnedRenderer.setFillPoints(true);
    earnedRenderer.setLineWidth(2);
    earnedRenderer.setDisplayChartValues(true);
    // Creating a XYMultipleSeriesRenderer to customize the whole chart
    XYMultipleSeriesRenderer multiRenderer = new XYMultipleSeriesRenderer();
    multiRenderer.setXLabels(0);
    for (int i = 0; i < mAssignments.size(); i++) {
        multiRenderer.addXTextLabel(i, mAssignments.get(i).getName());
    }
    // Creating XYSeriesRenderer to customize expenseSeries
    XYSeriesRenderer totalRenderer = new XYSeriesRenderer();
    totalRenderer.setColor(Color.rgb(55, 126, 184));
    totalRenderer.setFillPoints(true);
    totalRenderer.setLineWidth(2);
    totalRenderer.setDisplayChartValues(true);
    // Adding incomeRenderer and expenseRenderer to multipleRenderer
    // Note: The order of adding dataseries to dataset and renderers to multipleRenderer
    // should be same
    multiRenderer.addSeriesRenderer(earnedRenderer);
    multiRenderer.addSeriesRenderer(totalRenderer);
    multiRenderer.setBarSpacing(.2);
    multiRenderer.setMarginsColor(Color.WHITE);
    multiRenderer.setYAxisMin(0);
    multiRenderer.setYAxisMax(maxWeight);
    multiRenderer.setXAxisMin(-1);
    multiRenderer.setLabelsTextSize(20);
    // Creating an intent to plot bar chart using dataset and multipleRenderer
    LinearLayout layout = (LinearLayout) findViewById(R.id.chart_layout);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    if (mChartView != null) {
        layout.removeView(mChartView);
    }
    mChartView = ChartFactory.getBarChartView(this, dataset, multiRenderer, BarChart.Type.DEFAULT);
    mChartView.setLayoutParams(params);
    layout.addView(mChartView);
}
Example 2
Project: ohmagePhone-master  File: ChartFactory.java View source code
/**
   * Creates a combined XY chart view.
   * 
   * @param context the context
   * @param dataset the multiple series dataset (cannot be null)
   * @param renderer the multiple series renderer (cannot be null)
   * @param types the chart types (cannot be null)
   * @return a combined XY chart graphical view
   * @throws IllegalArgumentException if dataset is null or renderer is null or
   *           if a dataset number of items is different than the number of
   *           series renderers or number of chart types
   */
public static final GraphicalView getCombinedXYChartView(Context context, XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer, String[] types) {
    if (dataset == null || renderer == null || types == null || dataset.getSeriesCount() != types.length) {
        throw new IllegalArgumentException("Dataset, renderer and types should be not null and the datasets series count should be equal to the types length");
    }
    checkParameters(dataset, renderer);
    CombinedXYChart chart = new CombinedXYChart(dataset, renderer, types);
    return new GraphicalView(context, chart);
}
Example 3
Project: Heart-master  File: TimePressureGraph.java View source code
/**
   * prepares an intent for starting the graph activity
   *
   * @return: the intent or null if nothing to display
   */
public Intent getIntent() {
    XYMultipleSeriesDataset dataset = getDataset();
    if (dataset == null) {
        return null;
    }
    XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer();
    renderer.setAxisTitleTextSize(16);
    renderer.setChartTitleTextSize(20);
    renderer.setLabelsTextSize(15);
    renderer.setLegendTextSize(15);
    renderer.setPointSize(5f);
    renderer.setMargins(new int[] { 20, 50, 15, 20 });
    XYSeriesRenderer seriesOne = new XYSeriesRenderer();
    seriesOne.setColor(Color.MAGENTA);
    seriesOne.setPointStyle(PointStyle.CIRCLE);
    renderer.addSeriesRenderer(seriesOne);
    XYSeriesRenderer seriesTwo = new XYSeriesRenderer();
    seriesTwo.setColor(Color.GREEN);
    seriesTwo.setPointStyle(PointStyle.TRIANGLE);
    renderer.addSeriesRenderer(seriesTwo);
    renderer.setChartTitle(ctxt.getString(R.string.graph_title));
    renderer.setXTitle("");
    renderer.setYTitle("mmHg");
    renderer.setShowGridX(true);
    renderer.setYLabelsAlign(Paint.Align.RIGHT);
    renderer.setYAxisMax(getYDataMax(dataset) + 10);
    renderer.setYAxisMin(getYDataMin(dataset) - 10);
    return ChartFactory.getTimeChartIntent(ctxt, getDataset(), renderer, "MM/dd/yyyy", ctxt.getString(R.string.app_name));
}

Java Examples for org.springframework.beans.factory.config.BeanDefinitionHolder

The following java examples will help you to understand the usage of org.springframework.beans.factory.config.BeanDefinitionHolder. These source code samples are taken from different open source projects.

Example 1
Project: spring-framework-2.5.x-master  File: BeanDefinitionParserDelegate.java View source code
/**
	 * Parses the supplied <code><bean></code> element. May return <code>null</code>
	 * if there were errors during parse. Errors are reported to the
	 * [email protected] org.springframework.beans.factory.parsing.ProblemReporter}.
	 */
public BeanDefinitionHolder parseBeanDefinitionElement(Element ele, BeanDefinition containingBean) {
    String id = ele.getAttribute(ID_ATTRIBUTE);
    String nameAttr = ele.getAttribute(NAME_ATTRIBUTE);
    List aliases = new ArrayList();
    if (StringUtils.hasLength(nameAttr)) {
        String[] nameArr = StringUtils.tokenizeToStringArray(nameAttr, BEAN_NAME_DELIMITERS);
        aliases.addAll(Arrays.asList(nameArr));
    }
    String beanName = id;
    if (!StringUtils.hasText(beanName) && !aliases.isEmpty()) {
        beanName = (String) aliases.remove(0);
        if (logger.isDebugEnabled()) {
            logger.debug("No XML 'id' specified - using '" + beanName + "' as bean name and " + aliases + " as aliases");
        }
    }
    if (containingBean == null) {
        checkNameUniqueness(beanName, aliases, ele);
    }
    AbstractBeanDefinition beanDefinition = parseBeanDefinitionElement(ele, beanName, containingBean);
    if (beanDefinition != null) {
        if (!StringUtils.hasText(beanName)) {
            try {
                if (containingBean != null) {
                    beanName = BeanDefinitionReaderUtils.generateBeanName(beanDefinition, this.readerContext.getRegistry(), true);
                } else {
                    beanName = this.readerContext.generateBeanName(beanDefinition);
                    // Register an alias for the plain bean class name, if still possible,
                    // if the generator returned the class name plus a suffix.
                    // This is expected for Spring 1.2/2.0 backwards compatibility.
                    String beanClassName = beanDefinition.getBeanClassName();
                    if (beanClassName != null && beanName.startsWith(beanClassName) && beanName.length() > beanClassName.length() && !this.readerContext.getRegistry().isBeanNameInUse(beanClassName)) {
                        aliases.add(beanClassName);
                    }
                }
                if (logger.isDebugEnabled()) {
                    logger.debug("Neither XML 'id' nor 'name' specified - " + "using generated bean name [" + beanName + "]");
                }
            } catch (Exception ex) {
                error(ex.getMessage(), ele);
                return null;
            }
        }
        String[] aliasesArray = StringUtils.toStringArray(aliases);
        return new BeanDefinitionHolder(beanDefinition, beanName, aliasesArray);
    }
    return null;
}
Example 2
Project: automation-test-engine-master  File: RunTimeDataHolderBeanDefinitionParser.java View source code
/**
	 * [email protected]}
	 */
@Override
@Nullable
protected AbstractBeanDefinition parseInternal(@Nullable Element element, @Nullable ParserContext parserContext) {
    // Here we parse the Spring elements such as < property>
    if (parserContext == null || element == null)
        throw GlobalUtils.createNotInitializedException("element and parserContext");
    // Here we parse the Spring elements such as < property>
    String dataHolderType = element.getAttribute(XsdElementConstants.ATTR_RUNTIMEDATAHOLDER_DATAHOLDERTYPE).toUpperCase();
    if (null == dataHolderType || !StringUtils.hasText(dataHolderType)) {
        throw GlobalUtils.createNotInitializedException("dataHolderType attribute in xml test case");
    }
    RumtimeDataHolderType enumDataHolderType = RumtimeDataHolderType.valueOf(dataHolderType);
    BeanDefinitionHolder holder = parserContext.getDelegate().parseBeanDefinitionElement(element);
    BeanDefinition bDef = holder.getBeanDefinition();
    switch(enumDataHolderType) {
        case PAGESOURCEPARSED:
            bDef.setBeanClassName(PageParsedDataHolder.class.getName());
            break;
        case MANUALASSIGNED:
            bDef.setBeanClassName(ManualAssignedValueDataHolder.class.getName());
            break;
        case CASESERVICEPARSED:
            bDef.setBeanClassName(CaseServiceParsedDataHolder.class.getName());
            break;
        case STEPSERVICEPARSED:
            bDef.setBeanClassName(StepServiceParsedDataHolder.class.getName());
            break;
        case RANDOMALPHATEXT:
            bDef.setBeanClassName(RandomAlphaTextValueDataHolder.class.getName());
            break;
        case RANDOMNUMBERS:
            bDef.setBeanClassName(RandomNumericValueDataHolder.class.getName());
            break;
        case RANDOMTEXTNUMBERS:
            bDef.setBeanClassName(RandomAlphaNumericValueDataHolder.class.getName());
            break;
        case RANDOMEMAIL:
            bDef.setBeanClassName(RandomEmailDataHolder.class.getName());
            break;
        default:
            break;
    }
    String dataType = element.getAttribute(XsdElementConstants.ATTR_RUNTIMEDATAHOLDER_DATATYPE).toUpperCase();
    if (null != dataType && StringUtils.hasText(dataType)) {
        EnumRunTimeDataType enumDataType = EnumRunTimeDataType.valueOf(dataType);
        bDef.getConstructorArgumentValues().addGenericArgumentValue(enumDataType);
    }
    String dataValue = element.getAttribute(XsdElementConstants.ATTR_RUNTIMEDATAHOLDER_DATAVALUE);
    if (StringUtils.hasText(dataValue)) {
        bDef.getConstructorArgumentValues().addGenericArgumentValue(dataValue);
    }
    String leftBoundry = element.getAttribute(XsdElementConstants.ATTR_RUNTIMEDATAHOLDER_LEFTBOUNDRY);
    if (StringUtils.hasText(leftBoundry)) {
        bDef.getConstructorArgumentValues().addGenericArgumentValue(leftBoundry);
    }
    String rightBoundry = element.getAttribute(XsdElementConstants.ATTR_RUNTIMEDATAHOLDER_RIGHTBOUNDRY);
    if (StringUtils.hasText(rightBoundry)) {
        bDef.getConstructorArgumentValues().addGenericArgumentValue(rightBoundry);
    }
    String page = element.getAttribute(XsdElementConstants.ATTR_RUNTIMEDATAHOLDER_PAGE);
    if (StringUtils.hasText(page)) {
        bDef.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference(page));
    }
    String beanID = element.getAttribute("id");
    bDef.getConstructorArgumentValues().addGenericArgumentValue(beanID);
    String mappedBeanID = element.getAttribute(XsdElementConstants.ATTR_RUNTIMEDATAHOLDER_SUBCASEMAPPEDDATAHOLDERID);
    if (StringUtils.hasText(mappedBeanID)) {
        bDef.getConstructorArgumentValues().addGenericArgumentValue(mappedBeanID);
    }
    String indexOfSameTypeDataOnPage = element.getAttribute(XsdElementConstants.ATTR_RUNTIMEDATAHOLDER_INDEXOFSAMETYPEDATAONPAGE);
    if (StringUtils.hasText(indexOfSameTypeDataOnPage)) {
        int index = Integer.parseInt(indexOfSameTypeDataOnPage);
        bDef.getConstructorArgumentValues().addGenericArgumentValue(index);
    }
    String randomTextLength = element.getAttribute(XsdElementConstants.ATTR_RUNTIMEDATAHOLDER_RANDOMINPUTLENGTH);
    if (StringUtils.hasText(randomTextLength)) {
        int length = Integer.parseInt(randomTextLength);
        bDef.getConstructorArgumentValues().addGenericArgumentValue(length);
    }
    parserContext.getRegistry().registerBeanDefinition(element.getAttribute("id"), bDef);
    return (AbstractBeanDefinition) bDef;
}
Example 3
Project: cloudtm-data-platform-master  File: InfinispanNamespaceUtils.java View source code
public static BeanComponentDefinition parseInnerBeanDefinition(Element element, ParserContext parserContext) {
    List<Element> childElements = DomUtils.getChildElementsByTagName(element, "bean");
    BeanComponentDefinition innerComponentDefinition = null;
    if (childElements != null && childElements.size() == 1) {
        Element beanElement = childElements.get(0);
        if (!"http://www.springframework.org/schema/beans".equals(beanElement.getNamespaceURI())) {
            throw new IllegalStateException("Illegal inner child element");
        }
        BeanDefinitionParserDelegate delegate = parserContext.getDelegate();
        BeanDefinitionHolder beanDefinitionHolder = delegate.parseBeanDefinitionElement(beanElement);
        beanDefinitionHolder = delegate.decorateBeanDefinitionIfRequired(beanElement, beanDefinitionHolder);
        BeanDefinition beanDefinition = beanDefinitionHolder.getBeanDefinition();
        innerComponentDefinition = new BeanComponentDefinition(beanDefinition, beanDefinitionHolder.getBeanName());
    }
    return innerComponentDefinition;
}
Example 4
Project: Katari-master  File: ConstructorArgumentsBeanNameAutoProxyCreator.java View source code
/** Extracts the actual value from the given [email protected] ValueHolder}, resolving
     * bean references through the bean factory.
     *
     * @param holder The holder to resolve
     *
     * @return The actual value of the holder
     */
protected Object getActualValue(final ValueHolder holder) {
    Validate.notNull(holder, "The value holder cannot be null.");
    log.trace("Start getActualValue");
    Object value = holder.getValue();
    if (value instanceof BeanDefinitionHolder) {
        // Constructor argument is an inner bean
        throw new IllegalArgumentException("Inner bean definitions are not supported");
    }
    if (value instanceof BeanReference) {
        BeanReference ref = (BeanReference) value;
        if (log.isDebugEnabled()) {
            log.debug("Value is a reference to " + ref.getBeanName() + ", resolving reference");
        }
        value = beanFactory.getBean(ref.getBeanName());
    } else if (value instanceof TypedStringValue) {
        TypedStringValue typedStringValue = (TypedStringValue) value;
        value = typedStringValue.getValue();
    }
    if (log.isTraceEnabled()) {
        log.trace("Finishing getActualValue, actual value is " + value);
    }
    return value;
}

Java Examples for org.apache.lucene.document.Field.Index

The following java examples will help you to understand the usage of org.apache.lucene.document.Field.Index. These source code samples are taken from different open source projects.

Example 1
Project: yarep-master  File: DateIndexerSearcherImplV1.java View source code
/**
     * Get revision from index file
     * @param path2 Absolute path of index file
     * @return TODO
     */
private Revision getRevisionFromIndexFile(String path2) throws Exception, IndexOutOfSyncException {
    if (path2 != null) {
        if (new File(path2).isFile()) {
            String revisionName = getRevisionName(path2);
            if (revisionName != null) {
                try {
                    //log.debug("Get revision name from index file '" + path2 + "' for node '" + nodePath + "'.");
                    return new VirtualFileSystemRevision(repo, nodePath, revisionName);
                } catch (NoSuchRevisionException e) {
                    log.warn("No revision for revision name '" + revisionName + "' of index file: " + path2);
                    throw new IndexOutOfSyncException(path2);
                }
            } else {
                log.warn("Index file '" + path2 + "' does not seem to contain a revision name!");
                return null;
            }
        } else {
            log.warn("No such index file: " + path2);
            return null;
        }
    } else {
        //log.debug("No path.");
        return null;
    }
}
Example 2
Project: cloudtm-data-platform-master  File: DocumentBuilderIndexedEntity.java View source code
protected void checkDocumentId(XProperty member, PropertiesMetadata propertiesMetadata, boolean isRoot, String prefix, ConfigContext context, PathsContext pathsContext) {
    Annotation idAnnotation = getIdAnnotation(member, context);
    NumericField numericFieldAnn = member.getAnnotation(NumericField.class);
    if (idAnnotation != null) {
        String attributeName = getIdAttributeName(member, idAnnotation);
        if (pathsContext != null) {
            pathsContext.markEncounteredPath(prefix + attributeName);
        }
        if (isRoot) {
            if (explicitDocumentId) {
                if (idAnnotation instanceof DocumentId) {
                    throw log.duplicateDocumentIdFound(getBeanClass().getName());
                } else {
                    //If it's not a DocumentId it's a JPA @Id: ignore it as we already have a @DocumentId
                    return;
                }
            }
            if (idAnnotation instanceof DocumentId) {
                explicitDocumentId = true;
            }
            idKeywordName = prefix + attributeName;
            FieldBridge fieldBridge = BridgeFactory.guessType(null, numericFieldAnn, member, reflectionManager);
            if (fieldBridge instanceof TwoWayFieldBridge) {
                idBridge = (TwoWayFieldBridge) fieldBridge;
            } else {
                throw new SearchException("Bridge for document id does not implement TwoWayFieldBridge: " + member.getName());
            }
            Float boost = AnnotationProcessingHelper.getBoost(member, null);
            if (boost != null) {
                idBoost = boost.floatValue();
            }
            ReflectionHelper.setAccessible(member);
            idGetter = member;
        } else {
            //component should index their document id
            ReflectionHelper.setAccessible(member);
            propertiesMetadata.fieldGetters.add(member);
            propertiesMetadata.fieldGetterNames.add(member.getName());
            String fieldName = prefix + attributeName;
            propertiesMetadata.fieldNames.add(fieldName);
            propertiesMetadata.fieldStore.add(Store.YES);
            Field.Index index = AnnotationProcessingHelper.getIndex(Index.YES, Analyze.NO, Norms.YES);
            propertiesMetadata.fieldIndex.add(index);
            propertiesMetadata.fieldTermVectors.add(AnnotationProcessingHelper.getTermVector(TermVector.NO));
            propertiesMetadata.fieldNullTokens.add(null);
            propertiesMetadata.fieldBridges.add(BridgeFactory.guessType(null, null, member, reflectionManager));
            propertiesMetadata.fieldBoosts.add(AnnotationProcessingHelper.getBoost(member, null));
            propertiesMetadata.precisionSteps.add(getPrecisionStep(null));
            propertiesMetadata.dynamicFieldBoosts.add(AnnotationProcessingHelper.getDynamicBoost(member));
            // property > entity analyzer (no field analyzer)
            Analyzer analyzer = AnnotationProcessingHelper.getAnalyzer(member.getAnnotation(org.hibernate.search.annotations.Analyzer.class), context);
            if (analyzer == null) {
                analyzer = propertiesMetadata.analyzer;
            }
            if (analyzer == null) {
                throw new AssertionFailure("Analyzer should not be undefined");
            }
            addToScopedAnalyzer(fieldName, analyzer, index);
        }
    }
}
Example 3
Project: apache-nutch-fork-master  File: TestIndexSorter.java View source code
protected void setUp() throws Exception {
    if (conf == null)
        conf = NutchConfiguration.create();
    // create test index
    testDir = new File("indexSorter-test-" + System.currentTimeMillis());
    if (!testDir.mkdirs()) {
        throw new Exception("Can't create test dir " + testDir.toString());
    }
    LOG.info("Creating test index: " + testDir.getAbsolutePath());
    File plain = new File(testDir, INDEX_PLAIN);
    Directory dir = FSDirectory.open(plain);
    IndexWriter writer = new IndexWriter(dir, new NutchDocumentAnalyzer(conf), true, MaxFieldLength.UNLIMITED);
    // create test documents
    for (int i = 0; i < NUM_DOCS; i++) {
        Document doc = new Document();
        for (int k = 0; k < fieldNames.length; k++) {
            Field f;
            Store s;
            Index ix;
            String val = null;
            if (fieldNames[k].equals("id")) {
                s = Store.YES;
                ix = Index.NOT_ANALYZED;
                val = String.valueOf(i);
            } else if (fieldNames[k].equals("host")) {
                s = Store.YES;
                ix = Index.NOT_ANALYZED;
                val = "www.example" + i + ".com";
            } else if (fieldNames[k].equals("site")) {
                s = Store.NO;
                ix = Index.NOT_ANALYZED;
                val = "www.example" + i + ".com";
            } else if (fieldNames[k].equals("content")) {
                s = Store.NO;
                ix = Index.ANALYZED;
                val = "This is the content of the " + i + "-th document.";
            } else if (fieldNames[k].equals("boost")) {
                s = Store.YES;
                ix = Index.NO;
                // XXX note that this way we ensure different values of encoded boost
                // XXX note also that for this reason we can't reliably test more than
                // XXX 255 documents.
                float boost = Similarity.decodeNorm((byte) (i + 1));
                val = String.valueOf(boost);
                doc.setBoost(boost);
            } else {
                s = Store.YES;
                ix = Index.ANALYZED;
                if (fieldNames[k].equals("anchor")) {
                    val = "anchors to " + i + "-th page.";
                } else if (fieldNames[k].equals("url")) {
                    val = "http://www.example" + i + ".com/" + i + ".html";
                }
            }
            f = new Field(fieldNames[k], val, s, ix);
            doc.add(f);
        }
        writer.addDocument(doc);
    }
    writer.optimize();
    writer.close();
}
Example 4
Project: extension-aws-master  File: AutoCompleteLuceneSearcher.java View source code
public void updateHits(HitTracker tracker, String word) {
    if (new Date().after(getCacheDate())) {
        //clear the cache once a day
        getCache().clear();
        setCacheDate(null);
    }
    if (getCache().contains(word)) {
        return;
    }
    int size = getCache().size();
    if (//TODO: Move to a normal 1000 cache system
    size > 2000) {
        getCache().clear();
    }
    getCache().add(word);
    //word could be "hot dog"
    int hits = tracker.size();
    if (word == null || hits == 0) {
        return;
    }
    SearchQuery suggestionsQuery = createSearchQuery();
    //String nospace = word.replace(' ', '_'); //hot_dog
    suggestionsQuery.addExact("synonyms", word);
    //Todo: Do a local mem cache with a max of 1000 entries. To keep us from search for the same things
    HitTracker wordsHits = search(suggestionsQuery);
    Field id = new Field("synonyms", word, Store.YES, Index.NOT_ANALYZED_NO_NORMS);
    try {
        if (wordsHits.size() == 0) {
            saveHitCount(word, hits, id);
        } else if (wordsHits.size() > 0) {
            Object row = wordsHits.get(0);
            String hitstring = wordsHits.getValue(row, "hitcount");
            int currentcount = Integer.parseInt(hitstring);
            if (currentcount == hits) {
                return;
            }
            /* Check for timestamp */
            String stamp = wordsHits.getValue(row, "timestamp");
            GregorianCalendar timestamp = new GregorianCalendar();
            timestamp.setTime(DateTools.stringToDate(stamp));
            GregorianCalendar yesterday = new GregorianCalendar();
            yesterday.add(Calendar.DATE, -1);
            if (timestamp.before(yesterday)) {
                saveHitCountWithSynonyms(word, hits, id);
            }
        }
    } catch (Exception ex) {
        throw new OpenEditException(ex);
    }
}

Java Examples for com.google.gwt.user.client.ui.InlineLabel

The following java examples will help you to understand the usage of com.google.gwt.user.client.ui.InlineLabel. These source code samples are taken from different open source projects.

Example 1
Project: aokp-gerrit-master  File: ChangeScreen.java View source code
private void display(final ChangeDetail detail) {
    displayTitle(detail.getChange().getKey(), detail.getChange().getSubject());
    discardDiffBaseIfNotApplicable(detail.getChange().getId());
    if (Status.MERGED == detail.getChange().getStatus()) {
        includedInPanel.setVisible(true);
        includedInPanel.addOpenHandler(includedInTable);
    } else {
        includedInPanel.setVisible(false);
    }
    dependencies.setAccountInfoCache(detail.getAccounts());
    descriptionBlock.display(detail, detail.isStarred(), detail.canEditCommitMessage(), detail.getCurrentPatchSetDetail().getInfo(), detail.getAccounts(), detail.getSubmitTypeRecord(), commentLinkProcessor);
    dependsOn.display(detail.getDependsOn());
    neededBy.display(detail.getNeededBy());
    approvals.display(changeInfo);
    patchesList.clear();
    if (detail.getCurrentPatchSetDetail().getInfo().getParents().size() > 1) {
        patchesList.addItem(Util.C.autoMerge());
    } else {
        patchesList.addItem(Util.C.baseDiffItem());
    }
    for (PatchSet pId : detail.getPatchSets()) {
        patchesList.addItem(Util.M.patchSetHeader(pId.getPatchSetId()), pId.getId().toString());
    }
    if (diffBaseId != null) {
        patchesList.setSelectedIndex(diffBaseId.get());
    }
    patchSetsBlock.display(detail, diffBaseId);
    addComments(detail);
    // If any dependency change is still open, or is outdated,
    // or the change is needed by a change that is new or submitted,
    // show our dependency list.
    //
    boolean depsOpen = false;
    int outdated = 0;
    if (!detail.getChange().getStatus().isClosed()) {
        final List<ChangeInfo> dependsOn = detail.getDependsOn();
        if (dependsOn != null) {
            for (final ChangeInfo ci : dependsOn) {
                if (!ci.isLatest()) {
                    depsOpen = true;
                    outdated++;
                } else if (ci.getStatus() != Change.Status.MERGED) {
                    depsOpen = true;
                }
            }
        }
    }
    final List<ChangeInfo> neededBy = detail.getNeededBy();
    if (neededBy != null) {
        for (final ChangeInfo ci : neededBy) {
            if ((ci.getStatus() == Change.Status.NEW) || (ci.getStatus() == Change.Status.SUBMITTED) || (ci.getStatus() == Change.Status.DRAFT)) {
                depsOpen = true;
            }
        }
    }
    dependenciesPanel.setOpen(depsOpen);
    dependenciesPanel.getHeader().clear();
    if (outdated > 0) {
        dependenciesPanel.getHeader().add(new InlineLabel(Util.M.outdatedHeader(outdated)));
    }
    if (!isCurrentView()) {
        display();
    }
    patchSetsBlock.setRegisterKeys(true);
}
Example 2
Project: mini-git-server-master  File: PatchSetComplexDisclosurePanel.java View source code
private void displayDownload() {
    final Project.NameKey projectKey = changeDetail.getChange().getProject();
    final String projectName = projectKey.get();
    final CopyableLabel copyLabel = new CopyableLabel("");
    final DownloadCommandPanel commands = new DownloadCommandPanel();
    final DownloadUrlPanel urls = new DownloadUrlPanel(commands);
    final Set<DownloadScheme> allowedSchemes = Gerrit.getConfig().getDownloadSchemes();
    copyLabel.setStyleName(Gerrit.RESOURCES.css().downloadLinkCopyLabel());
    if (changeDetail.isAllowsAnonymous() && Gerrit.getConfig().getGitDaemonUrl() != null && allowedSchemes.contains(DownloadScheme.ANON_GIT)) {
        StringBuilder r = new StringBuilder();
        r.append(Gerrit.getConfig().getGitDaemonUrl());
        r.append(projectName);
        r.append(" ");
        r.append(patchSet.getRefName());
        urls.add(new DownloadUrlLink(DownloadScheme.ANON_GIT, Util.M.anonymousDownload("Git"), r.toString()));
    }
    if (changeDetail.isAllowsAnonymous() && (allowedSchemes.contains(DownloadScheme.ANON_HTTP) || allowedSchemes.contains(DownloadScheme.DEFAULT_DOWNLOADS))) {
        StringBuilder r = new StringBuilder();
        r.append(GWT.getHostPageBaseURL());
        r.append("p/");
        r.append(projectName);
        r.append(" ");
        r.append(patchSet.getRefName());
        urls.add(new DownloadUrlLink(DownloadScheme.ANON_HTTP, Util.M.anonymousDownload("HTTP"), r.toString()));
    }
    if (Gerrit.getConfig().getSshdAddress() != null && Gerrit.isSignedIn() && Gerrit.getUserAccount().getUserName() != null && Gerrit.getUserAccount().getUserName().length() > 0 && (allowedSchemes.contains(DownloadScheme.SSH) || allowedSchemes.contains(DownloadScheme.DEFAULT_DOWNLOADS))) {
        String sshAddr = Gerrit.getConfig().getSshdAddress();
        final StringBuilder r = new StringBuilder();
        r.append("ssh://");
        r.append(Gerrit.getUserAccount().getUserName());
        r.append("@");
        if (sshAddr.startsWith("*:") || "".equals(sshAddr)) {
            r.append(Window.Location.getHostName());
        }
        if (sshAddr.startsWith("*")) {
            sshAddr = sshAddr.substring(1);
        }
        r.append(sshAddr);
        r.append("/");
        r.append(projectName);
        r.append(" ");
        r.append(patchSet.getRefName());
        urls.add(new DownloadUrlLink(DownloadScheme.SSH, "SSH", r.toString()));
    }
    if (Gerrit.isSignedIn() && Gerrit.getUserAccount().getUserName() != null && Gerrit.getUserAccount().getUserName().length() > 0 && (allowedSchemes.contains(DownloadScheme.HTTP) || allowedSchemes.contains(DownloadScheme.DEFAULT_DOWNLOADS))) {
        String base = GWT.getHostPageBaseURL();
        int p = base.indexOf("://");
        int s = base.indexOf('/', p + 3);
        if (s < 0) {
            s = base.length();
        }
        String host = base.substring(p + 3, s);
        if (host.contains("@")) {
            host = host.substring(host.indexOf('@') + 1);
        }
        final StringBuilder r = new StringBuilder();
        r.append(base.substring(0, p + 3));
        r.append(Gerrit.getUserAccount().getUserName());
        r.append('@');
        r.append(host);
        r.append(base.substring(s));
        r.append("p/");
        r.append(projectName);
        r.append(" ");
        r.append(patchSet.getRefName());
        urls.add(new DownloadUrlLink(DownloadScheme.HTTP, "HTTP", r.toString()));
    }
    if (allowedSchemes.contains(DownloadScheme.REPO_DOWNLOAD)) {
        // This site prefers usage of the 'repo' tool, so suggest
        // that for easy fetch.
        //
        final StringBuilder r = new StringBuilder();
        r.append("repo download ");
        r.append(projectName);
        r.append(" ");
        r.append(changeDetail.getChange().getChangeId());
        r.append("/");
        r.append(patchSet.getPatchSetId());
        final String cmd = r.toString();
        commands.add(new DownloadCommandLink(DownloadCommand.REPO_DOWNLOAD, "repo download") {

            @Override
            void setCurrentUrl(DownloadUrlLink link) {
                urls.setVisible(false);
                copyLabel.setText(cmd);
            }
        });
    }
    if (!urls.isEmpty()) {
        commands.add(new DownloadCommandLink(DownloadCommand.CHECKOUT, "checkout") {

            @Override
            void setCurrentUrl(DownloadUrlLink link) {
                urls.setVisible(true);
                copyLabel.setText("git fetch " + link.urlData + " && git checkout FETCH_HEAD");
            }
        });
        commands.add(new DownloadCommandLink(DownloadCommand.PULL, "pull") {

            @Override
            void setCurrentUrl(DownloadUrlLink link) {
                urls.setVisible(true);
                copyLabel.setText("git pull " + link.urlData);
            }
        });
        commands.add(new DownloadCommandLink(DownloadCommand.CHERRY_PICK, "cherry-pick") {

            @Override
            void setCurrentUrl(DownloadUrlLink link) {
                urls.setVisible(true);
                copyLabel.setText("git fetch " + link.urlData + " && git cherry-pick FETCH_HEAD");
            }
        });
        commands.add(new DownloadCommandLink(DownloadCommand.FORMAT_PATCH, "patch") {

            @Override
            void setCurrentUrl(DownloadUrlLink link) {
                urls.setVisible(true);
                copyLabel.setText("git fetch " + link.urlData + " && git format-patch -1 --stdout FETCH_HEAD");
            }
        });
    }
    final FlowPanel fp = new FlowPanel();
    if (!commands.isEmpty()) {
        final AccountGeneralPreferences pref;
        if (Gerrit.isSignedIn()) {
            pref = Gerrit.getUserAccount().getGeneralPreferences();
        } else {
            pref = new AccountGeneralPreferences();
            pref.resetToDefaults();
        }
        commands.select(pref.getDownloadCommand());
        urls.select(pref.getDownloadUrl());
        FlowPanel p = new FlowPanel();
        p.setStyleName(Gerrit.RESOURCES.css().downloadLinkHeader());
        p.add(commands);
        final InlineLabel glue = new InlineLabel();
        glue.setStyleName(Gerrit.RESOURCES.css().downloadLinkHeaderGap());
        p.add(glue);
        p.add(urls);
        fp.add(p);
        fp.add(copyLabel);
    }
    infoTable.setWidget(R_DOWNLOAD, 1, fp);
}
Example 3
Project: viaja-facil-master  File: Colectivos.java View source code
private void showResults() {
    // evtl. relevant falls es n�tig ist das stackPanel zu resizen: http://stackoverflow.com/questions/4334216/stacklayoutpanel-has-no-more-place-to-show-the-children-when-there-are-too-many-h
    resultsPanel.setVisible(false);
    resultsPanel.clear();
    DOM.getElementById("leftcontainer").getStyle().setProperty("display", "none");
    boolean gotAResult = false;
    int stackPanelTotalHeight = 0;
    int biggestContentHeight = 0;
    for (SearchResultProxy resultProxy : resultList) {
        if (resultProxy.getConnections() != null) {
            for (ConnectionProxy connProxy : resultProxy.getConnections()) {
                if (connProxy != null) {
                    gotAResult = true;
                    int col = 0;
                    String connection = connProxy.getTime() + CONSTANTS.min() + " " + CONSTANTS.with() + " ";
                    FlowPanel connectionDetailsPanelnew = new FlowPanel();
                    ;
                    for (LineProxy l : connProxy.getLines()) {
                        if (col >= colors.size()) {
                            col = col % colors.size();
                        }
                        if (l.getType() != 0) {
                            String lineText = l.getLinenum();
                            if (l.getType() == 1 && connProxy.getLines().size() == 3) {
                                String[] parts1 = l.getRamal().split("-");
                                if (parts1.length == 2) {
                                    lineText += " " + parts1[0].substring(0, parts1[0].length() - 1);
                                }
                            }
                            connection += l.getTypeAsString() + " ";
                            connection += lineText + ", ";
                            InlineLabel lineNum = new InlineLabel(l.getLinenum() + " ");
                            connectionDetailsPanelnew.add(lineNum);
                            lineNum.getElement().setAttribute("style", "color:" + colors.get(col) + ";font-size:120%");
                            col++;
                            InlineLabel lineRamal = new InlineLabel(" " + l.getRamal());
                            lineRamal.getElement().setAttribute("style", "font-size:120%");
                            connectionDetailsPanelnew.add(lineRamal);
                            if (l.getAlternativeLines().size() > 0) {
                                String alternativesText = " (" + CONSTANTS.alternatives() + ": ";
                                for (String s : l.getAlternativeLines()) {
                                    alternativesText += s + ", ";
                                }
                                alternativesText = alternativesText.substring(0, alternativesText.length() - 2);
                                alternativesText += ")";
                                InlineLabel alternatives = new InlineLabel(alternativesText);
                                connectionDetailsPanelnew.add(alternatives);
                            }
                            if (l.getStartStreet() != null && l.getDestStreet() != null) {
                                FlowPanel streets = new FlowPanel();
                                InlineLabel from = new InlineLabel(CONSTANTS.from() + " ");
                                streets.add(from);
                                InlineLabel fromStreet = new InlineLabel(l.getStartStreet());
                                fromStreet.addStyleName("resultPosLink");
                                fromStreet.getElement().setPropertyDouble("x_coord", l.getRelevantPoints().get(0));
                                fromStreet.getElement().setPropertyDouble("y_coord", l.getRelevantPoints().get(1));
                                fromStreet.addClickHandler(new ClickHandler() {

                                    @Override
                                    public void onClick(ClickEvent event) {
                                        InlineLabel source = (InlineLabel) event.getSource();
                                        panToAndMark(source.getElement().getPropertyDouble("x_coord"), source.getElement().getPropertyDouble("y_coord"));
                                    }
                                });
                                streets.add(fromStreet);
                                InlineLabel to = new InlineLabel(" " + CONSTANTS.to() + " ");
                                streets.add(to);
                                InlineLabel toStreet = new InlineLabel(l.getDestStreet());
                                toStreet.addStyleName("resultPosLink");
                                toStreet.getElement().setPropertyDouble("x_coord", l.getRelevantPoints().get(l.getRelevantPoints().size() - 2));
                                toStreet.getElement().setPropertyDouble("y_coord", l.getRelevantPoints().get(l.getRelevantPoints().size() - 1));
                                toStreet.addClickHandler(new ClickHandler() {

                                    @Override
                                    public void onClick(ClickEvent event) {
                                        InlineLabel source = (InlineLabel) event.getSource();
                                        panToAndMark(source.getElement().getPropertyDouble("x_coord"), source.getElement().getPropertyDouble("y_coord"));
                                    }
                                });
                                streets.add(toStreet);
                                connectionDetailsPanelnew.add(streets);
                            }
                        }
                    }
                    connection = connection.substring(0, connection.length() - 2);
                    Label lConnTemp = new Label(connection);
                    Label lConn = new Label(connection);
                    lConnTemp.setStyleName("gwt-StackLayoutPanelHeader");
                    lConnTemp.setWidth(resultsWidth + "px");
                    dummyPanel.add(lConnTemp);
                    int heightHeader = lConnTemp.getElement().getOffsetHeight();
                    dummyPanel.remove(lConnTemp);
                    connectionDetailsPanelnew.setStyleName("gwt-StackLayoutPanelContent");
                    connectionDetailsPanelnew.setWidth(resultsWidth + "px");
                    dummyPanel.add(connectionDetailsPanelnew);
                    int heightContent = connectionDetailsPanelnew.getElement().getOffsetHeight() + 5;
                    //				GWT.log("eleD: " +lConnDetailsTemp.getElement().getOffsetHeight() + ", widgetD: " + lConnDetailsTemp.getOffsetHeight());
                    dummyPanel.remove(connectionDetailsPanelnew);
                    resultsPanel.add(connectionDetailsPanelnew, lConn, heightHeader);
                    stackPanelTotalHeight += heightHeader;
                    if (heightContent > biggestContentHeight) {
                        biggestContentHeight = heightContent;
                    }
                /*GWT.log(connection);
						GWT.log(connectionDetails);*/
                }
            }
        }
    }
    stackPanelTotalHeight += biggestContentHeight + 5;
    //		GWT.log("Total height: " + stackPanelTotalHeight);
    resultsPanel.setHeight(stackPanelTotalHeight + "px");
    /*int spacerheight = 120 + stackPanelTotalHeight;
		if(spacerheight > 120 + scrollPanel.getOffsetHeight()) {
			spacerheight = 120 + scrollPanel.getOffsetHeight();
		}
		DOM.getElementById("topspacer").getStyle().setProperty("height", spacerheight + "px");*/
    resultsPanel.setVisible(true);
    if (gotAResult) {
        drawConnection(0);
    }
}

Java Examples for org.jfree.ui.TextAnchor

The following java examples will help you to understand the usage of org.jfree.ui.TextAnchor. These source code samples are taken from different open source projects.

Example 1
Project: bonita-simulation-master  File: BarChartVisibleBarLabel.java View source code
/* (non-Javadoc)
	 * @see net.sf.jasperreports.engine.JRChartCustomizer#customize(org.jfree.chart.JFreeChart, net.sf.jasperreports.engine.JRChart)
	 */
public void customize(JFreeChart chart, JRChart jasperChart) {
    BarRenderer bsr = (BarRenderer) chart.getCategoryPlot().getRenderer();
    bsr.setItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    bsr.setItemLabelsVisible(true);
    // Set position of Items label : center
    bsr.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER));
    bsr.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER));
    // If there isn't enough space to draw the ItemLabel...
    bsr.setPositiveItemLabelPositionFallback(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.CENTER));
    bsr.setNegativeItemLabelPositionFallback(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.CENTER));
}
Example 2
Project: queueing-simulation-master  File: PiePlot.java View source code
/**
     * Draws the pie section labels in the simple form.
     *
     * @param g2  the graphics device.
     * @param keys  the section keys.
     * @param totalValue  the total value for all sections in the pie.
     * @param plotArea  the plot area.
     * @param pieArea  the area containing the pie.
     * @param state  the plot state.
     *
     * @since 1.0.7
     */
protected void drawSimpleLabels(Graphics2D g2, List keys, double totalValue, Rectangle2D plotArea, Rectangle2D pieArea, PiePlotState state) {
    Composite originalComposite = g2.getComposite();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f));
    Rectangle2D labelsArea = this.simpleLabelOffset.createInsetRectangle(pieArea);
    double runningTotal = 0.0;
    Iterator iterator = keys.iterator();
    while (iterator.hasNext()) {
        Comparable key = (Comparable) iterator.next();
        boolean include = true;
        double v = 0.0;
        Number n = getDataset().getValue(key);
        if (n == null) {
            include = !getIgnoreNullValues();
        } else {
            v = n.doubleValue();
            include = getIgnoreZeroValues() ? v > 0.0 : v >= 0.0;
        }
        if (include) {
            runningTotal = runningTotal + v;
            // work out the mid angle (0 - 90 and 270 - 360) = right,
            // otherwise left
            double mid = getStartAngle() + (getDirection().getFactor() * ((runningTotal - v / 2.0) * 360) / totalValue);
            Arc2D arc = new Arc2D.Double(labelsArea, getStartAngle(), mid - getStartAngle(), Arc2D.OPEN);
            int x = (int) arc.getEndPoint().getX();
            int y = (int) arc.getEndPoint().getY();
            PieSectionLabelGenerator labelGenerator = getLabelGenerator();
            if (labelGenerator == null) {
                continue;
            }
            String label = labelGenerator.generateSectionLabel(this.dataset, key);
            if (label == null) {
                continue;
            }
            g2.setFont(this.labelFont);
            FontMetrics fm = g2.getFontMetrics();
            Rectangle2D bounds = TextUtilities.getTextBounds(label, g2, fm);
            Rectangle2D out = this.labelPadding.createOutsetRectangle(bounds);
            Shape bg = ShapeUtilities.createTranslatedShape(out, x - bounds.getCenterX(), y - bounds.getCenterY());
            if (this.labelShadowPaint != null && this.shadowGenerator == null) {
                Shape shadow = ShapeUtilities.createTranslatedShape(bg, this.shadowXOffset, this.shadowYOffset);
                g2.setPaint(this.labelShadowPaint);
                g2.fill(shadow);
            }
            if (this.labelBackgroundPaint != null) {
                g2.setPaint(this.labelBackgroundPaint);
                g2.fill(bg);
            }
            if (this.labelOutlinePaint != null && this.labelOutlineStroke != null) {
                g2.setPaint(this.labelOutlinePaint);
                g2.setStroke(this.labelOutlineStroke);
                g2.draw(bg);
            }
            g2.setPaint(this.labelPaint);
            g2.setFont(this.labelFont);
            TextUtilities.drawAlignedString(getLabelGenerator().generateSectionLabel(getDataset(), key), g2, x, y, TextAnchor.CENTER);
        }
    }
    g2.setComposite(originalComposite);
}
Example 3
Project: snap-desktop-master  File: CustomLogarithmicAxis.java View source code
private void addHorizontalTicks(RectangleEdge edge, List ticks, double lowerBoundVal, String tickLabel, double tickVal) {
    if (tickVal >= lowerBoundVal - SMALL_LOG_VALUE) {
        //tick value not below lowest data value
        TextAnchor anchor;
        TextAnchor rotationAnchor;
        double angle = 0.0;
        if (isVerticalTickLabels()) {
            anchor = TextAnchor.CENTER_RIGHT;
            rotationAnchor = TextAnchor.CENTER_RIGHT;
            if (edge == RectangleEdge.TOP) {
                angle = Math.PI / 2.0;
            } else {
                angle = -Math.PI / 2.0;
            }
        } else {
            if (edge == RectangleEdge.TOP) {
                anchor = TextAnchor.BOTTOM_CENTER;
                rotationAnchor = TextAnchor.BOTTOM_CENTER;
            } else {
                anchor = TextAnchor.TOP_CENTER;
                rotationAnchor = TextAnchor.TOP_CENTER;
            }
        }
        ticks.add(new NumberTick(new Double(tickVal), tickLabel, anchor, rotationAnchor, angle));
    }
}
Example 4
Project: jeql-master  File: CategoryChart.java View source code
/**
	 * Creates a chart.
	 * 
	 * @param dataset  the dataset.
	 * 
	 * @return A chart.
	 */
private JFreeChart createChart(CategoryDataset dataset) {
    String chartType = getChartType();
    JFreeChart chart = null;
    if (chartType == CHART_TYPE_LINE && param.isExtruded) {
        chart = ChartFactory.createLineChart3D(param.title, param.axisXTitle, param.axisYTitle, dataset, param.plotOrientation, param.showLegend, false, false);
    } else if (chartType == CHART_TYPE_LINE && param.isFilled)
        chart = ChartFactory.createAreaChart(param.title, param.axisXTitle, param.axisYTitle, dataset, param.plotOrientation, param.showLegend, false, false);
    else if (chartType == CHART_TYPE_BAR && param.isExtruded)
        chart = ChartFactory.createBarChart3D(param.title, param.axisXTitle, param.axisYTitle, dataset, param.plotOrientation, param.showLegend, false, false);
    else if (chartType == CHART_TYPE_LINE) {
        chart = ChartFactory.createLineChart(param.title, param.axisXTitle, param.axisYTitle, dataset, param.plotOrientation, param.showLegend, false, false);
    } else if (chartType == CHART_TYPE_BAR) {
        // Create a simple Bar chart
        chart = ChartFactory.createBarChart(param.title, param.axisXTitle, param.axisYTitle, dataset, param.plotOrientation, param.showLegend, false, false);
    } else if (chartType == CHART_TYPE_BAR_STACKED && param.isExtruded) {
        chart = ChartFactory.createStackedBarChart3D(param.title, param.axisXTitle, param.axisYTitle, dataset, param.plotOrientation, param.showLegend, false, false);
    } else if (chartType == CHART_TYPE_BAR_STACKED) {
        chart = ChartFactory.createStackedBarChart(param.title, param.axisXTitle, param.axisYTitle, dataset, param.plotOrientation, param.showLegend, false, false);
    }
    CategoryPlot plot = chart.getCategoryPlot();
    // set X axis label angles
    if (param.axisXLabelRotation != 0.0) {
        CategoryAxis axis = plot.getDomainAxis();
        axis.setCategoryLabelPositions(getCategoryLabelPosition(param.axisXLabelRotation));
    }
    CategoryItemRenderer renderer = plot.getRenderer();
    if (param.showItemLabels) {
        renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
        renderer.setBaseItemLabelsVisible(true);
        if (param.itemLabelRotation != 0.0) {
            double ang = -1 * Math.PI / 2 * param.itemLabelRotation;
            ItemLabelPosition pos = renderer.getBasePositiveItemLabelPosition();
            ItemLabelPosition pos2 = new ItemLabelPosition(pos.getItemLabelAnchor(), TextAnchor.CENTER_LEFT, TextAnchor.CENTER_LEFT, ang);
            renderer.setBasePositiveItemLabelPosition(pos2);
        }
    }
    // set up bar painting
    if (param.color != null)
        renderer.setSeriesPaint(0, param.color);
    if (renderer instanceof BarRenderer) {
        BarRenderer barRend = (BarRenderer) renderer;
        // don't draw shadow
        barRend.setShadowVisible(false);
        barRend.setDrawBarOutline(false);
        // use flat filled bar rather than rounded bar with sheen
        barRend.setBarPainter(new StandardBarPainter());
    }
    chart.getCategoryPlot().setRenderer(renderer);
    return chart;
}
Example 5
Project: nmonvisualizer-master  File: LineChartAnnotationDialog.java View source code
@Override
public void actionPerformed(ActionEvent e) {
    String line = lineType.getSelection().getActionCommand();
    String text = annotation.getText();
    if (text != null) {
        text = text.trim();
    }
    if ("Vertical".equals(line)) {
        ValueMarker marker = new DomainValueMarker(getX());
        marker.setLabelOffset(new RectangleInsets(5, 5, 5, 5));
        marker.setLabelTextAnchor(TextAnchor.TOP_RIGHT);
        marker.setLabel(text);
        formatMarker(marker);
        if (marker != null) {
            xyPlot.addDomainMarker(marker);
            firePropertyChange("annotation", null, marker);
        }
    } else if ("Horizontal".equals(line)) {
        ValueMarker marker = new RangeValueMarker(getY());
        marker.setLabelTextAnchor(TextAnchor.BASELINE_LEFT);
        marker.setLabel(text);
        formatMarker(marker);
        if (marker != null) {
            xyPlot.addRangeMarker(marker);
            firePropertyChange("annotation", null, marker);
        }
    } else if ("None".equals(line)) {
        if (!"".equals(text)) {
            XYTextAnnotation annotation = new XYTextAnnotation(text, getX(), getY());
            annotation.setFont(Styles.ANNOTATION_FONT);
            annotation.setPaint(Styles.ANNOTATION_COLOR);
            if (annotation != null) {
                xyPlot.addAnnotation(annotation);
                firePropertyChange("annotation", null, annotation);
            }
        }
    // else no annotation needed if no text
    } else {
        throw new IllegalStateException("unknown annotation line type");
    }
    dispose();
}
Example 6
Project: compomics-utilities-master  File: VennDiagramPanel.java View source code
// </editor-fold>//GEN-END:initComponents
/**
     * Update the plot.
     */
public void updatePlot() {
    plotPanel.removeAll();
    tooltipToDatasetMap = new HashMap<String, String>();
    DefaultXYZDataset xyzDataset = new DefaultXYZDataset();
    JFreeChart chart = ChartFactory.createBubbleChart(null, "X", "Y", xyzDataset, PlotOrientation.VERTICAL, false, true, false);
    XYPlot plot = chart.getXYPlot();
    if (currentVennDiagramType == VennDiagramType.ONE_WAY) {
        plot.getRangeAxis().setRange(0.86, 1.24);
        plot.getDomainAxis().setRange(0.85, 1.25);
    } else if (currentVennDiagramType == VennDiagramType.TWO_WAY) {
        plot.getRangeAxis().setRange(0.86, 1.24);
        plot.getDomainAxis().setRange(0.85, 1.25);
    } else if (currentVennDiagramType == VennDiagramType.THREE_WAY) {
        plot.getRangeAxis().setRange(0.86, 1.24);
        plot.getDomainAxis().setRange(0.85, 1.25);
    } else {
        plot.getRangeAxis().setRange(-0.04, 0.6);
        plot.getDomainAxis().setRange(-0.08, 0.7);
    }
    plot.getRangeAxis().setVisible(false);
    plot.getDomainAxis().setVisible(false);
    double radius = 0.1;
    Ellipse2D ellipse = new Ellipse2D.Double(1 - radius, 1 - radius, radius + radius, radius + radius);
    // @TODO: make it possible set the line color and width?
    XYShapeAnnotation xyShapeAnnotation = new XYShapeAnnotation(ellipse, new BasicStroke(2f), new Color(140, 140, 140, 150), datasetAColor);
    plot.addAnnotation(xyShapeAnnotation);
    if (currentVennDiagramType == VennDiagramType.TWO_WAY || currentVennDiagramType == VennDiagramType.THREE_WAY) {
        ellipse = new Ellipse2D.Double(1 - radius + 0.1, 1 - radius, radius + radius, radius + radius);
        xyShapeAnnotation = new XYShapeAnnotation(ellipse, new BasicStroke(2f), new Color(140, 140, 140, 150), datasetBColor);
        plot.addAnnotation(xyShapeAnnotation);
    }
    if (currentVennDiagramType == VennDiagramType.THREE_WAY) {
        ellipse = new Ellipse2D.Double(1 - radius + 0.05, 1 - radius + 0.1, radius + radius, radius + radius);
        xyShapeAnnotation = new XYShapeAnnotation(ellipse, new BasicStroke(2f), new Color(140, 140, 140, 150), datasetCColor);
        plot.addAnnotation(xyShapeAnnotation);
    }
    XYTextAnnotation anotation;
    if (currentVennDiagramType == VennDiagramType.ONE_WAY) {
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("a").size(), 1.0, 1.0);
        anotation.setToolTipText(groupNames.get("a"));
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "a");
        // legend
        if (showLegend) {
            anotation = new XYTextAnnotation(groupNames.get("a"), legendDatasetAThreeWay.getX(), legendDatasetAThreeWay.getY());
            anotation.setTextAnchor(TextAnchor.BASELINE_LEFT);
            anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeLegend));
            plot.addAnnotation(anotation);
        }
    } else if (currentVennDiagramType == VennDiagramType.TWO_WAY) {
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("a").size(), 0.96, 1.0);
        anotation.setToolTipText(groupNames.get("a"));
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "a");
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("b").size(), 1.14, 1.0);
        anotation.setToolTipText(groupNames.get("b"));
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "b");
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("ab").size(), 1.05, 1.0);
        anotation.setToolTipText("<html>" + groupNames.get("a") + " ∩ " + groupNames.get("b") + "</html>");
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "ab");
        // legend
        if (showLegend) {
            anotation = new XYTextAnnotation(groupNames.get("a"), legendDatasetAThreeWay.getX(), legendDatasetAThreeWay.getY());
            anotation.setTextAnchor(TextAnchor.BASELINE_LEFT);
            anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeLegend));
            plot.addAnnotation(anotation);
            anotation = new XYTextAnnotation(groupNames.get("b"), legendDatasetBThreeWay.getX(), legendDatasetBThreeWay.getY());
            anotation.setTextAnchor(TextAnchor.BASELINE_LEFT);
            anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeLegend));
            plot.addAnnotation(anotation);
        }
    } else if (currentVennDiagramType == VennDiagramType.THREE_WAY) {
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("a").size(), 0.96, 0.97);
        anotation.setToolTipText(groupNames.get("a"));
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "a");
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("b").size(), 1.14, 0.97);
        anotation.setToolTipText(groupNames.get("b"));
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "b");
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("ab").size(), 1.05, 0.97);
        anotation.setToolTipText("<html>" + groupNames.get("a") + " ∩ " + groupNames.get("b") + "</html>");
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "ab");
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("c").size(), 1.05, 1.14);
        anotation.setToolTipText(groupNames.get("c"));
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "c");
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("ac").size(), 0.99, 1.065);
        anotation.setToolTipText("<html>" + groupNames.get("a") + "  ∩ " + groupNames.get("c") + "</html>");
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "ac");
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("bc").size(), 1.11, 1.065);
        anotation.setToolTipText("<html>" + groupNames.get("b") + " ∩ " + groupNames.get("c") + "</html>");
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "bc");
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("abc").size(), 1.05, 1.036);
        anotation.setToolTipText("<html>" + groupNames.get("a") + "  ∩ " + groupNames.get("b") + " ∩ " + groupNames.get("c") + "</html>");
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "abc");
        // legend
        if (showLegend) {
            anotation = new XYTextAnnotation(groupNames.get("a"), legendDatasetAThreeWay.getX(), legendDatasetAThreeWay.getY());
            anotation.setTextAnchor(TextAnchor.BASELINE_LEFT);
            anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeLegend));
            plot.addAnnotation(anotation);
            anotation = new XYTextAnnotation(groupNames.get("b"), legendDatasetBThreeWay.getX(), legendDatasetBThreeWay.getY());
            anotation.setTextAnchor(TextAnchor.BASELINE_LEFT);
            anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeLegend));
            plot.addAnnotation(anotation);
            anotation = new XYTextAnnotation(groupNames.get("c"), legendDatasetCThreeWay.getX(), legendDatasetCThreeWay.getY());
            anotation.setTextAnchor(TextAnchor.BASELINE_LEFT);
            anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeLegend));
            plot.addAnnotation(anotation);
        }
    } else if (currentVennDiagramType == VennDiagramType.FOUR_WAY) {
        XYBoxAnnotation anotation2 = new XYBoxAnnotation(0, 0, 0.2, 0.5, new BasicStroke(2), Color.LIGHT_GRAY, datasetAColor);
        plot.addAnnotation(anotation2);
        anotation2 = new XYBoxAnnotation(0.1, 0, 0.3, 0.4, new BasicStroke(2), Color.LIGHT_GRAY, datasetBColor);
        plot.addAnnotation(anotation2);
        anotation2 = new XYBoxAnnotation(0, 0.1, 0.4, 0.3, new BasicStroke(2), Color.LIGHT_GRAY, datasetCColor);
        plot.addAnnotation(anotation2);
        anotation2 = new XYBoxAnnotation(0, 0, 0.5, 0.2, new BasicStroke(2), Color.LIGHT_GRAY, datasetDColor);
        plot.addAnnotation(anotation2);
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("a").size(), 0.15, 0.45);
        anotation.setToolTipText(groupNames.get("a"));
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "a");
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("ab").size(), 0.15, 0.35);
        anotation.setToolTipText("<html>" + groupNames.get("a") + " ∩ " + groupNames.get("b") + "</html>");
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "ab");
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("abc").size(), 0.15, 0.25);
        anotation.setToolTipText("<html>" + groupNames.get("a") + " ∩ " + groupNames.get("b") + " ∩ " + groupNames.get("c") + "</html>");
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "abc");
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("abcd").size(), 0.15, 0.15);
        anotation.setToolTipText("<html>" + groupNames.get("a") + " ∩ " + groupNames.get("b") + " ∩ " + groupNames.get("c") + " ∩ " + groupNames.get("d") + "</html>");
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "abcd");
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("abd").size(), 0.15, 0.05);
        anotation.setToolTipText("<html>" + groupNames.get("a") + " ∩ " + groupNames.get("b") + " ∩ " + groupNames.get("d") + "</html>");
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "abd");
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("ac").size(), 0.05, 0.25);
        anotation.setToolTipText("<html>" + groupNames.get("a") + " ∩ " + groupNames.get("c") + "</html>");
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "ac");
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("acd").size(), 0.05, 0.15);
        anotation.setToolTipText("<html>" + groupNames.get("a") + " ∩ " + groupNames.get("c") + " ∩ " + groupNames.get("d") + "</html>");
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "acd");
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("ad").size(), 0.05, 0.05);
        anotation.setToolTipText("<html>" + groupNames.get("a") + " ∩ " + groupNames.get("d") + "</html>");
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "ad");
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("b").size(), 0.25, 0.35);
        anotation.setToolTipText("<html>" + groupNames.get("b") + "</html>");
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "b");
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("bc").size(), 0.25, 0.25);
        anotation.setToolTipText("<html>" + groupNames.get("b") + " ∩ " + groupNames.get("c") + "</html>");
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "bc");
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("bcd").size(), 0.25, 0.15);
        anotation.setToolTipText("<html>" + groupNames.get("b") + " ∩ " + groupNames.get("c") + " ∩ " + groupNames.get("d") + "</html>");
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "bcd");
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("bd").size(), 0.25, 0.05);
        anotation.setToolTipText("<html>" + groupNames.get("b") + " ∩ " + groupNames.get("d") + "</html>");
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "bd");
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("c").size(), 0.35, 0.25);
        anotation.setToolTipText("<html>" + groupNames.get("c") + "</html>");
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "c");
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("cd").size(), 0.35, 0.15);
        anotation.setToolTipText("<html>" + groupNames.get("c") + " ∩ " + groupNames.get("d") + "</html>");
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "cd");
        anotation = new XYTextAnnotation("" + vennDiagramResults.get("d").size(), 0.45, 0.15);
        anotation.setToolTipText("<html>" + groupNames.get("d") + "</html>");
        anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues));
        plot.addAnnotation(anotation);
        tooltipToDatasetMap.put(anotation.getToolTipText(), "d");
        // legend
        if (showLegend) {
            anotation = new XYTextAnnotation(groupNames.get("a"), legendDatasetAFourWay.getX(), legendDatasetAFourWay.getY());
            anotation.setTextAnchor(TextAnchor.BASELINE_LEFT);
            anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeLegend));
            plot.addAnnotation(anotation);
            anotation = new XYTextAnnotation(groupNames.get("b"), legendDatasetBFourWay.getX(), legendDatasetBFourWay.getY());
            anotation.setTextAnchor(TextAnchor.BASELINE_LEFT);
            anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeLegend));
            plot.addAnnotation(anotation);
            anotation = new XYTextAnnotation(groupNames.get("c"), legendDatasetCFourWay.getX(), legendDatasetCFourWay.getY());
            anotation.setTextAnchor(TextAnchor.BASELINE_LEFT);
            anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeLegend));
            plot.addAnnotation(anotation);
            anotation = new XYTextAnnotation(groupNames.get("d"), legendDatasetDFourWay.getX(), legendDatasetDFourWay.getY());
            anotation.setTextAnchor(TextAnchor.BASELINE_LEFT);
            anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeLegend));
            plot.addAnnotation(anotation);
        }
    }
    // set up the renderer
    XYBubbleRenderer renderer = new XYBubbleRenderer(XYBubbleRenderer.SCALE_ON_RANGE_AXIS);
    renderer.setBaseToolTipGenerator(new StandardXYZToolTipGenerator());
    plot.setRenderer(renderer);
    // make all datapoints semitransparent
    plot.setForegroundAlpha(0.5f);
    // remove space before/after the domain axis
    plot.getDomainAxis().setUpperMargin(0);
    plot.getDomainAxis().setLowerMargin(0);
    plot.setRangeGridlinePaint(Color.black);
    // hide unwanted chart details
    plot.setDomainGridlinesVisible(false);
    plot.setRangeGridlinesVisible(false);
    chart.getPlot().setOutlineVisible(false);
    // set background color
    chart.getPlot().setBackgroundPaint(Color.WHITE);
    chart.setBackgroundPaint(Color.WHITE);
    chartPanel = new ChartPanel(chart);
    // disable the pop up menu
    chartPanel.setPopupMenu(null);
    chartPanel.setBackground(Color.WHITE);
    // add the plot to the chart
    plotPanel.add(chartPanel);
    plotPanel.revalidate();
    plotPanel.repaint();
    // add chart mouse listener
    chartPanel.addChartMouseListener(new ChartMouseListener() {

        public void chartMouseClicked(ChartMouseEvent cme) {
            mouseClickedInChart(cme);
        }

        public void chartMouseMoved(ChartMouseEvent cme) {
            mouseMovedInChart(cme);
        }
    });
    // add more chart mouse listeners
    chartPanel.addMouseListener(new MouseAdapter() {

        @Override
        public void mousePressed(MouseEvent e) {
            super.mouseClicked(e);
        }
    });
}
Example 7
Project: tdq-studio-se-master  File: TOPChartService.java View source code
// used by HideSeriesChartComposite
@Override
public void createAnnotOnGantt(Object chart, List<Object[]> rowList, int multiDateColumn, int nominal) {
    Map<String, RowColumPair> hightlightSeriesMap = new HashMap<String, RowColumPair>();
    CategoryPlot xyplot = (CategoryPlot) ((JFreeChart) chart).getPlot();
    CategoryTextAnnotation an;
    for (int seriesCount = 0; seriesCount < ((TaskSeriesCollection) xyplot.getDataset()).getSeriesCount(); seriesCount++) {
        int indexOfRow = 0;
        int columnCount = 0;
        for (int itemCount = 0; itemCount < ((TaskSeriesCollection) xyplot.getDataset()).getSeries(seriesCount).getItemCount(); itemCount++, columnCount++) {
            Task task = ((TaskSeriesCollection) xyplot.getDataset()).getSeries(seriesCount).get(itemCount);
            String taskDescription = task.getDescription();
            //$NON-NLS-1$
            String[] taskArray = taskDescription.split("\\|");
            boolean isSameTime = task.getDuration().getStart().getTime() == task.getDuration().getEnd().getTime();
            if (!isSameTime && (rowList.get(indexOfRow))[multiDateColumn - 3] != null && (rowList.get(indexOfRow))[multiDateColumn - 2] != null && !((rowList.get(indexOfRow))[multiDateColumn]).equals(new BigDecimal(0L))) {
                RowColumPair pair = new RowColumPair();
                pair.setRow(seriesCount);
                pair.setColumn(columnCount);
                hightlightSeriesMap.put(String.valueOf(seriesCount) + String.valueOf(columnCount), pair);
                an = new //$NON-NLS-1$
                CategoryTextAnnotation(//$NON-NLS-1$
                "#nulls = " + (rowList.get(indexOfRow))[multiDateColumn], taskDescription, task.getDuration().getStart().getTime());
                an.setTextAnchor(TextAnchor.CENTER_LEFT);
                an.setCategoryAnchor(CategoryAnchor.MIDDLE);
                xyplot.addAnnotation(an);
            }
            if (taskArray.length == nominal) {
                indexOfRow++;
                if (rowList.size() != indexOfRow && ((rowList.get(indexOfRow))[multiDateColumn - 3] == null || (rowList.get(indexOfRow))[multiDateColumn - 2] == null)) {
                    indexOfRow++;
                }
            }
        }
    }
    CustomHideSeriesGanttRender renderer = new CustomHideSeriesGanttRender(hightlightSeriesMap);
    xyplot.setRenderer(renderer);
    renderer.setBaseToolTipGenerator(new CategoryToolTipGenerator() {

        @Override
        public String generateToolTip(CategoryDataset dataset, int row, int column) {
            TaskSeriesCollection taskSeriesColl = (TaskSeriesCollection) dataset;
            List<Task> taskList = new ArrayList<Task>();
            for (int i = 0; i < taskSeriesColl.getSeriesCount(); i++) {
                for (int j = 0; j < taskSeriesColl.getSeries(i).getItemCount(); j++) {
                    taskList.add(taskSeriesColl.getSeries(i).get(j));
                }
            }
            Task task = taskList.get(column);
            // Task task = taskSeriesColl.getSeries(row).get(column);
            String taskDescription = task.getDescription();
            Date startDate = task.getDuration().getStart();
            Date endDate = task.getDuration().getEnd();
            //$NON-NLS-1$ //$NON-NLS-2$
            return taskDescription + ",     " + startDate + "---->" + endDate;
        // return "this is a tooltip";
        }
    });
    xyplot.getDomainAxis().setMaximumCategoryLabelWidthRatio(10.0f);
}