SWT表格分页


http://download.csdn.net/download/ssj234/2265036 SWT表格实现分页功能
资源截图
代码片段和文件信息
package com.ssj.grid;

import java.awt.Color;
import java.awt.Font;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

import org.eclipse.jface.action.Action;
import org.eclipse.nebula.jface.gridviewer.GridTableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Shell;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.AxisLocation;
import org.jfree.chart.labels.CategoryToolTipGenerator;
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.renderer.category.BarRenderer3D;
import org.jfree.data.category.CategoryDataset;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.experimental.chart.swt.ChartComposite;

import com.ssj.util.MpStaticName;



public class ChartAction extends Action {
GridTableViewer tv;
int chartType=0;
String titleNamebottomNameunit=MpStaticName.count;
public ChartAction(GridTableViewer tvint chartType){
setText(MpStaticName.chart);
this.tv=tv;
this.chartType=chartType;
}


public void run() {

Collection list=(Collection) tv.getInput();
if(list==null||list.size()==0){
return;
}
DefaultCategoryDataset  dataset =new DefaultCategoryDataset();//建立数据集

for(Iterator it=list.iterator();it.hasNext();){

// dataset.addValue(spe.getAmount()spe.getId().getMpMaintainItem().getMaintainItemName()spe.getId().getMtSpeciality().getSpecialityName());
}


 JFreeChart chart=ChartFactory.createBarChart3D(titleName bottomName unit dataset PlotOrientation.VERTICAL true true false);
 
 CategoryPlot plot = chart.getCategoryPlot();
 plot.setForegroundAlpha(0.8f);
 
 BarRenderer3D renderer =   new BarRenderer3D();
 renderer.setbaseOutlinePaint(Color.BLACK);
 renderer.setItemMargin(0.3);
 renderer.setItemLabelGenerator(new StandardCategoryItemLabelGenerator());
        renderer.setItemLabelsVisible(true);
        renderer.setbaseToolTipGenerator(ca);
        plot.setRenderer(renderer);
        plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
       
        chart.getLegend().setItemFont(new Font(“宋体“ Font.PLAIN 12));  
        Shell shell =new Shell();
        shell.setText(MpStaticName.chartShelltitle);
//         shell.setAlpha(200);
        shell.setLayout(new FillLayout());
        
       ChartComposite comp=new ChartComposite(shell
        SWT.NONEcharttrue);
      
       comp.pack();
       
       shell.open();

super.run();
}
 CategoryToolTipGenerator ca=new CategoryToolTipGenerator(){

public String generateToolTip(CategoryDataset dataSet int one int two) {
DefaultCategoryDataset d=(DefaultCategoryDataset) dataSet;

return d.getColumnKey(two).toString();
}
     

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1932  2010-03-18 13:56  SwtUtils.classpath

     文件        323  2010-03-18 15:56  SwtUtils.fatjar

     文件        384  2010-03-18 13:50  SwtUtils.project

     文件        254  2010-03-18 15:04  SwtUtilssrcimages2.gif

     文件         71  2010-03-18 14:38  SwtUtilssrcimagesack.gif

     文件         71  2010-03-18 14:38  SwtUtilssrcimagesack_dis.gif

     文件         73  2010-03-18 14:38  SwtUtilssrcimagesegin.gif

     文件         73  2010-03-18 14:38  SwtUtilssrcimagesegin_dis.gif

     文件        351  2010-03-18 14:38  SwtUtilssrcimagesdelete_obj.gif

     文件        831  2010-03-18 14:38  SwtUtilssrcimagesDeveloper_Icons_012.PNG

     文件        862  2010-03-18 14:38  SwtUtilssrcimagesDeveloper_Icons_013.PNG

     文件        824  2010-03-18 14:38  SwtUtilssrcimagesDeveloper_Icons_037.PNG

     文件        863  2010-03-18 14:38  SwtUtilssrcimagesDeveloper_Icons_038.PNG

     文件        844  2010-03-18 14:38  SwtUtilssrcimagesDeveloper_Icons_065.PNG

     文件        844  2010-03-18 14:38  SwtUtilssrcimagesDeveloper_Icons_114.PNG

     文件        814  2010-03-18 14:38  SwtUtilssrcimagesDeveloper_Icons_155.png

     文件        824  2010-03-18 14:38  SwtUtilssrcimagesdoc.bmp

     文件       3553  2010-03-18 14:40  SwtUtilssrcimagesEditConfigItem.png

     文件         75  2010-03-18 14:38  SwtUtilssrcimagesend.gif

     文件       3601  2010-03-18 15:01  SwtUtilssrcimagesEndTime.png

     文件         75  2010-03-18 14:38  SwtUtilssrcimagesend_dis.gif

     文件       3631  2010-03-18 14:38  SwtUtilssrcimagesfilter.png

     文件         72  2010-03-18 14:38  SwtUtilssrcimagesforward.gif

     文件         72  2010-03-18 14:38  SwtUtilssrcimagesforward_dis.gif

     文件        824  2010-03-18 14:38  SwtUtilssrcimageshtml.bmp

     文件       3484  2010-03-18 14:38  SwtUtilssrcimagesinformation.png

     文件       3639  2010-03-18 14:40  SwtUtilssrcimagesMainSystem1.png

     文件        824  2010-03-18 14:38  SwtUtilssrcimagespdf.bmp

     文件       3618  2010-03-18 14:38  SwtUtilssrcimagesPrint.png

     文件        769  2010-03-18 14:38  SwtUtilssrcimagesselect_prev1.jpg

............此处省略318个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)