資源簡介
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??SwtUtils\src\images\2.gif
?????文件?????????71??2010-03-18?14:38??SwtUtils\src\images\back.gif
?????文件?????????71??2010-03-18?14:38??SwtUtils\src\images\back_dis.gif
?????文件?????????73??2010-03-18?14:38??SwtUtils\src\images\begin.gif
?????文件?????????73??2010-03-18?14:38??SwtUtils\src\images\begin_dis.gif
?????文件????????351??2010-03-18?14:38??SwtUtils\src\images\delete_obj.gif
?????文件????????831??2010-03-18?14:38??SwtUtils\src\images\Developer_Icons_012.PNG
?????文件????????862??2010-03-18?14:38??SwtUtils\src\images\Developer_Icons_013.PNG
?????文件????????824??2010-03-18?14:38??SwtUtils\src\images\Developer_Icons_037.PNG
?????文件????????863??2010-03-18?14:38??SwtUtils\src\images\Developer_Icons_038.PNG
?????文件????????844??2010-03-18?14:38??SwtUtils\src\images\Developer_Icons_065.PNG
?????文件????????844??2010-03-18?14:38??SwtUtils\src\images\Developer_Icons_114.PNG
?????文件????????814??2010-03-18?14:38??SwtUtils\src\images\Developer_Icons_155.png
?????文件????????824??2010-03-18?14:38??SwtUtils\src\images\doc.bmp
?????文件???????3553??2010-03-18?14:40??SwtUtils\src\images\EditConfigItem.png
?????文件?????????75??2010-03-18?14:38??SwtUtils\src\images\end.gif
?????文件???????3601??2010-03-18?15:01??SwtUtils\src\images\EndTime.png
?????文件?????????75??2010-03-18?14:38??SwtUtils\src\images\end_dis.gif
?????文件???????3631??2010-03-18?14:38??SwtUtils\src\images\filter.png
?????文件?????????72??2010-03-18?14:38??SwtUtils\src\images\forward.gif
?????文件?????????72??2010-03-18?14:38??SwtUtils\src\images\forward_dis.gif
?????文件????????824??2010-03-18?14:38??SwtUtils\src\images\html.bmp
?????文件???????3484??2010-03-18?14:38??SwtUtils\src\images\information.png
?????文件???????3639??2010-03-18?14:40??SwtUtils\src\images\MainSystem1.png
?????文件????????824??2010-03-18?14:38??SwtUtils\src\images\pdf.bmp
?????文件???????3618??2010-03-18?14:38??SwtUtils\src\images\Print.png
?????文件????????769??2010-03-18?14:38??SwtUtils\src\images\select_prev1.jpg
............此處省略318個文件信息
評論
共有 條評論