Need help with add-ons

Hello everyone, i’m new with this framework and i’m trying to make a simple layout example with a few add-ons, the thing is that i don´t know if i can add more than one add-on to the app, i want to use treetable, jfreechartwraper and passwordfield, if it’s possible can sombody help me with that.

The other problem than i’m having, maybe becouse i don´t know how to add the add-ons, is that i want to show a jfreechart in the layout but nothin happens, i added it into a panel, i don´t know if it’s possible to add it into a panel.

The main layout consists of one horizontal split with the treetable as first component and another horizontal split as second component, in the second component of the second split i want to display the jfreechart.

This is the example code i made for the chart.


public class GanttPanel extends Panel implements ChangeListener{
    JScrollBar scroller;
    SlidingGanttCategoryDataset dataset;

    public GanttPanel(){
        //super(new BorderLayout());
        dataset = new SlidingGanttCategoryDataset(createDataset(), 0, 15);
        JFreeChart jfreechart = crearGrafica(dataset);
        ChartPanel chartpanel = new ChartPanel(jfreechart);
        chartpanel.setPreferredSize(new Dimension(700, 450));
        scroller = new JScrollBar(1, 0, 15, 0, 50);
        this.addComponent((Component) chartpanel);
        scroller.getModel().addChangeListener(this);
        //JPanel jpanel = new JPanel(new BorderLayout());
        this.addComponent((Component) scroller);
        //jpanel.setBorder(BorderFactory.createEmptyBorder(66, 2, 2, 2));
        //add(jpanel, "East");
    }

    public static GanttCategoryDataset createDataset(){
        TaskSeries tskProgramado = new TaskSeries("Programada");
        TaskSeries tskActual = new TaskSeries("Actual");
        Day day = new Day();
        Day day1 = new Day();
        for(int i = 0; i < 50; i++)
        {
            int j = (int)(Math.random() * 10D) + 1;
            for(int k = 0; k < j; k++)
                day1 = (Day)day1.next();

            tskProgramado.add(new Task("Task " + i, new Date(day.getMiddleMillisecond()), new Date(day1.getMiddleMillisecond())));
            tskActual.add(new Task("Task " + i, new Date(day.getMiddleMillisecond()), new Date(day1.getMiddleMillisecond())));
            day = (Day)day1.next();
            day1 = (Day)day1.next();
        }
        TaskSeriesCollection taskseriescollection = new TaskSeriesCollection();
        taskseriescollection.add(tskProgramado);
        taskseriescollection.add(tskActual);
        return taskseriescollection;
    }

    private static JFreeChart crearGrafica(SlidingGanttCategoryDataset slidingganttcategorydataset){
        JFreeChart jfreechart = ChartFactory.createGanttChart("NOMBRE PROYECTO", "ACTIVIDAD", "FECHA", slidingganttcategorydataset, true, true, false);
            CategoryPlot categoryplot = (CategoryPlot)jfreechart.getPlot();
            Hour hour = new Hour(1, 14, 5, 2008);
            for(int i = 0; i < 12; i++)
            {
                IntervalMarker intervalmarker = new IntervalMarker(hour.getFirstMillisecond(), hour.getLastMillisecond(), Color.lightGray);
                categoryplot.addRangeMarker(intervalmarker, Layer.BACKGROUND);
                hour = (Hour)hour.next().next();
            }

            categoryplot.getDomainAxis().setMaximumCategoryLabelWidthRatio(10F);
            DateAxis dateaxis = (DateAxis)categoryplot.getRangeAxis();
            dateaxis.setRange(DatasetUtilities.findRangeBounds(slidingganttcategorydataset.getUnderlyingDataset(), true));
            GanttRenderer ganttrenderer = (GanttRenderer)categoryplot.getRenderer();
            ganttrenderer.setDrawBarOutline(false);
            ganttrenderer.setShadowVisible(false);
            return jfreechart;
    }

    public void stateChanged(ChangeEvent e) {
        dataset.setFirstCategoryIndex(scroller.getValue()); //scroll
    }
}

This is how i add it to the layout, i’m not using the jfreechart add-on.


secondsplit.setSecondComponent(pnlGantt);

Thanks to everybody.
Hope my english is not that bad :grin:

You can use as many add-ons in your project as you like. There is no restriction for that; just download add-ons add drop them into WebContent/WEB-INF/lib directory of your project.

The main problem with your code is that it is a mixture of Vaadin ui code with Swing ui code (like JScrollBar, ChangeListener etc.). With Vaadin you should try to find corresponding Vaadin ui components for these Swing components: e.g. there is no ScrollBar component in Vaadin, but you can a Panel to be scrollable with setScrollable(true) method call.