## 5.10 實例講解
### 5.10.1 體會
也分為三層界面顯示層、數據層、控制層。
+ 數據層比較復雜。每個圖形有不同的數據類型。Dataset類控制。
+ 控制層Plot,餅圖使用PiePlot設置顯示的圖形的面貌的控制,JFreeChart最豐富的功能。
+ 設置片區顏色
+ 設置標簽(文本格式、背景顏色等)
+ 設置是否取出某塊。
+ 設置餅圖是否為圓形
+ 設置餅圖旋轉。
+ 顯示層JFreeChart使用數據、控制直接將數據顯示出來。
### 5.10.2 類PieChartDemo1.java
效果圖如下:

代碼編寫典型的使用了面對對象的方法:

全部代碼如下:
```
package demo;
import java.awt.Dimension;
import java.awt.Font;
import javax.swing.JPanel;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PiePlot;
import org.jfree.chart.title.TextTitle;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.data.general.PieDataset;
import org.jfree.ui.ApplicationFrame;
import org.jfree.ui.RefineryUtilities;
public class PieChartDemo1 extends ApplicationFrame {
/**
*
*/
private static final long serialVersionUID = 2598557557724085474L;
public PieChartDemo1(String string) {
super(string);
JPanel jpanel = createDemoPanel();
jpanel.setPreferredSize(new Dimension(500, 270));
setContentPane(jpanel);
}
private static PieDataset createDataset() {
DefaultPieDataset defaultpiedataset = new DefaultPieDataset();
defaultpiedataset.setValue("One", new Double(43.2));
defaultpiedataset.setValue("Two", new Double(10.0));
defaultpiedataset.setValue("Three", new Double(27.5));
defaultpiedataset.setValue("Four", new Double(17.5));
defaultpiedataset.setValue("Five", new Double(11.0));
defaultpiedataset.setValue("Six", new Double(19.4));
return defaultpiedataset;
}
private static JFreeChart createChart(PieDataset piedataset) {
JFreeChart jfreechart = ChartFactory.createPieChart("Pie Chart Demo 1",
piedataset, true, true, false);
TextTitle texttitle = jfreechart.getTitle();
texttitle.setToolTipText("A title tooltip!");
PiePlot pieplot = (PiePlot) jfreechart.getPlot();
pieplot.setLabelFont(new Font("Arial Black", 0, 20));
pieplot.setNoDataMessage("No data available");
pieplot.setCircular(false);
pieplot.setLabelGap(0.02);
return jfreechart;
}
public static JPanel createDemoPanel() {
JFreeChart jfreechart = createChart(createDataset());
return new ChartPanel(jfreechart);
}
public static void main(String[] strings) {
PieChartDemo1 piechartdemo1 = new PieChartDemo1("Pie Chart Demo 1");
piechartdemo1.pack();
RefineryUtilities.centerFrameOnScreen(piechartdemo1);
piechartdemo1.setVisible(true);
}
}
```
### 5.10.3 類PieChartDemo2.java
功能:
“取出“片區顯示。
效果:

代碼:
```
private static JFreeChart createChart(PieDataset piedataset) {
JFreeChart jfreechart = ChartFactory.createPieChart("PieChart Demo 2", piedataset, true, true, false);
PiePlot pieplot = (PiePlot) jfreechart.getPlot();
pieplot.setSectionPaint("One", new Color(160, 160, 255));
pieplot.setSectionPaint("Two", new Color(128, 128, 223));
pieplot.setSectionPaint("Three", new Color(96, 96, 191));
pieplot.setSectionPaint("Four", new Color(64, 64, 159));
pieplot.setSectionPaint("Five", new Color(32, 32, 127));
pieplot.setSectionPaint("Six", new Color(0, 0, 111));
pieplot.setNoDataMessage("No data available");
pieplot.setExplodePercent("Two", 0.5);
pieplot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({2} percent)"));
pieplot.setLabelBackgroundPaint(new Color(220, 220, 220));
pieplot.setLegendLabelToolTipGenerator(new StandardPieSectionLabelGenerator("Tooltip for legend item {0}"));
return jfreechart;
}
```
程序代碼說明:
+ `setSectionPaint("One", new Color(160, 160, 255))`:設置某個片區的填充顏色。第一個參數為片區的標識,第二個參數為色值。
+ `setNoDataMessage("No data available")`:設置dataset為null時顯示的提示信息。
+ `setLabelGenerator(new StandardPieSectionLabelGenerator("{0}({2} percent)"))`:設置標簽顯示的格式。
+ `setLabelBackgroundPaint(new Color(220, 220, 220))`:設置標簽的背景顏色。
+ `setLegendLabelToolTipGenerator(new StandardPieSectionLabelGenerator("Tooltip for legend item {0}"))`:設置鼠標滑過圖表是顯示鼠標當前片區的提示信息。
+ `pieplot.setExplodePercent("Two", 0.5)`:將第2個片區取出顯示。后面一個參數是取出的距離,是一個比例數。
### 5.10.4 類PieChartDemo3.java
功能:
顯示了dataset為空時,設置的提示信息。
效果:

代碼:
```
private static JFreeChart createChart(PieDataset piedataset) {
JFreeChart jfreechart = ChartFactory.createPieChart("Pie Chart Demo 3",
null, true, true, false);
PiePlot pieplot = (PiePlot) jfreechart.getPlot();
pieplot.setNoDataMessage("沒有有效的數據顯示!");
pieplot.setNoDataMessageFont(new Font("黑體", 2, 20));
pieplot.setNoDataMessagePaint(Color.red);
return jfreechart;
}
```
程序代碼說明:
+ `setNoDataMessage("沒有有效的數據顯示!")`:設置提示信息內容。
+ `setNoDataMessageFont(new Font("Serif", 2, 10))`:設置提示信息的字體和大小。
+ `setNoDataMessagePaint(Color.red)`:設置提示信息字體的顏色。
### 5.10.5 類PieChartDemo4.java
功能:
帶有按鈕的圖表,通過對dataset的排序,可以改變片區的位置。
效果:

代碼:
```
public void actionPerformed(ActionEvent actionevent) {
String string = actionevent.getActionCommand();
if ("BY_KEY".equals(string)) {
if (!ascendingByKey) {
dataset.sortByKeys(SortOrder.ASCENDING);
ascendingByKey = true;
} else {
dataset.sortByKeys(SortOrder.DESCENDING);
ascendingByKey = false;
}
} else if ("BY_VALUE".equals(string)) {
if (!ascendingByValue) {
dataset.sortByValues(SortOrder.ASCENDING);
ascendingByValue = true;
} else {
dataset.sortByValues(SortOrder.DESCENDING);
ascendingByValue = false;
}
} else if ("RANDOM".equals(string)) {
ArrayList arraylist = new ArrayList(dataset.getKeys());
Collections.shuffle(arraylist);
DefaultPieDataset defaultpiedataset = new DefaultPieDataset();
Iterator iterator = arraylist.iterator();
while (iterator.hasNext()) {
Comparable comparable = (Comparable) iterator.next();
defaultpiedataset.setValue(comparable, dataset
.getValue(comparable));
}
PiePlot pieplot = (PiePlot) chart.getPlot();
pieplot.setDataset(defaultpiedataset);
dataset = defaultpiedataset;
}
}
```
程序代碼說明:
+ `dataset.sortByKeys(SortOrder.ASCENDING);`通過片區的關鍵值進行升序排序。
+ `dataset.sortByValues(SortOrder.DESCENDING);`通過片區的值進行降序排序。
### 5.10.6 類PieChartDemo5.java
功能:
右邊兩個餅圖為原形的,而左邊兩個為橢圓形的。
效果:

代碼:
```
public static JPanel createDemoPanel() {
JPanel jpanel = new JPanel(new GridLayout(2, 2));
DefaultPieDataset defaultpiedataset = new DefaultPieDataset();
defaultpiedataset.setValue("Section 1", 23.3);
defaultpiedataset.setValue("Section 2", 56.5);
defaultpiedataset.setValue("Section 3", 43.3);
defaultpiedataset.setValue("Section 4", 11.1);
//
JFreeChart jfreechart = ChartFactory.createPieChart("Chart 1",
defaultpiedataset, false, false, false);
jfreechart.addSubtitle(new TextTitle("setCircular(true);", new Font(
"Dialog", 0, 12)));
PiePlot pieplot = (PiePlot) jfreechart.getPlot();
pieplot.setCircular(true);
//
JFreeChart jfreechart_0_ = ChartFactory.createPieChart("Chart 2",
defaultpiedataset, false, false, false);
jfreechart_0_.addSubtitle(new TextTitle("setCircular(false);",
new Font("Dialog", 0, 12)));
PiePlot pieplot_1_ = (PiePlot) jfreechart_0_.getPlot();
pieplot_1_.setCircular(false);
//
JFreeChart jfreechart_2_ = ChartFactory.createPieChart3D("Chart 3",
defaultpiedataset, false, false, false);
jfreechart_2_.addSubtitle(new TextTitle("setCircular(true);", new Font(
"Dialog", 0, 12)));
PiePlot3D pieplot3d = (PiePlot3D) jfreechart_2_.getPlot();
pieplot3d.setForegroundAlpha(0.6F);
pieplot3d.setCircular(true);
//
JFreeChart jfreechart_3_ = ChartFactory.createPieChart3D("Chart 4",
defaultpiedataset, false, false, false);
jfreechart_3_.addSubtitle(new TextTitle("setCircular(false);",
new Font("Dialog", 0, 12)));
PiePlot3D pieplot3d_4_ = (PiePlot3D) jfreechart_3_.getPlot();
pieplot3d_4_.setForegroundAlpha(0.6F);
pieplot3d_4_.setCircular(false);
jpanel.add(new ChartPanel(jfreechart));
jpanel.add(new ChartPanel(jfreechart_0_));
jpanel.add(new ChartPanel(jfreechart_2_));
jpanel.add(new ChartPanel(jfreechart_3_));
jpanel.setPreferredSize(new Dimension(800, 600));
return jpanel;
}
```
程序代碼說明:
+ `pieplot.setCircular(true)`:設置餅圖為圓形。
+ `jpanel.add`方法可以添加多個圖形的panel
### 5.10.7 類PieChartDemo6.java
功能:
顯示餅圖對零值和null值的處理。
效果:

代碼:
```
public static JPanel createDemoPanel() {
JPanel jpanel = new JPanel(new GridLayout(2, 2));
JFreeChart jfreechart = createChart("Pie Chart 1", createDataset());
Font font = new Font("Dialog", 0, 12);
jfreechart.addSubtitle(new TextTitle(
"Ignore nulls: false; Ignore zeros: false;", font));
JFreeChart jfreechart_0_ = createChart("Pie Chart 2", createDataset());
jfreechart_0_.addSubtitle(new TextTitle(
"Ignore nulls: true; Ignore zeros: false;", font));
PiePlot pieplot = (PiePlot) jfreechart_0_.getPlot();
pieplot.setIgnoreNullValues(true);
pieplot.setIgnoreZeroValues(false);
JFreeChart jfreechart_1_ = createChart("Pie Chart 3", createDataset());
jfreechart_1_.addSubtitle(new TextTitle(
"Ignore nulls: false; Ignore zeros: true;", font));
PiePlot pieplot_2_ = (PiePlot) jfreechart_1_.getPlot();
pieplot_2_.setIgnoreNullValues(false);
pieplot_2_.setIgnoreZeroValues(true);
JFreeChart jfreechart_3_ = createChart("Pie Chart 4", createDataset());
jfreechart_3_.addSubtitle(new TextTitle(
"Ignore nulls: true; Ignore zeros: true;", font));
PiePlot pieplot_4_ = (PiePlot) jfreechart_3_.getPlot();
pieplot_4_.setIgnoreNullValues(true);
pieplot_4_.setIgnoreZeroValues(true);
jpanel.add(new ChartPanel(jfreechart));
jpanel.add(new ChartPanel(jfreechart_0_));
jpanel.add(new ChartPanel(jfreechart_1_));
jpanel.add(new ChartPanel(jfreechart_3_));
return jpanel;
}
```
程序代碼說明:
+ `pieplot.setIgnoreNullValues(true)`:設置餅圖忽略null值,即是null值將不顯示。
+ `pieplot.setIgnoreZeroValues(false);`設置餅圖不忽略零值。即圖表中顯示出零值。
### 5.10.8 類PieChartDemo7.java
功能:
圖表能夠旋轉,標簽也隨之移動。
效果:

代碼:
```
public static JPanel createDemoPanel() {
PieDataset piedataset = createDataset(14);
JFreeChart jfreechart = ChartFactory.createPieChart("Pie Chart Demo 7",
piedataset, false, true, false);
jfreechart.setBackgroundPaint(new Color(222, 222, 255));
PiePlot pieplot = (PiePlot) jfreechart.getPlot();
pieplot.setBackgroundPaint(Color.white);
pieplot.setCircular(true);
pieplot.setLabelGenerator(new StandardPieSectionLabelGenerator(
"{0} = {2}", NumberFormat.getNumberInstance(), NumberFormat
.getPercentInstance()));
pieplot.setNoDataMessage("No data available");
ChartPanel chartpanel = new ChartPanel(jfreechart);
chartpanel.setPreferredSize(new Dimension(500, 270));
Rotator rotator = new Rotator(pieplot);
rotator.start();
return chartpanel;
}
```
程序代碼說明:
+ 使用Rotator對象,旋轉餅圖。代碼如上。
### 5.10.9 類PieChartDemo8.java
功能:
編寫自定義標簽產生器,將Two標簽不顯示。
效果:

代碼:
```
private static JFreeChart createChart(PieDataset piedataset) {
JFreeChart jfreechart = ChartFactory.createPieChart("Pie Chart Demo 8",
piedataset, false, true, false);
PiePlot pieplot = (PiePlot) jfreechart.getPlot();
pieplot.setLabelGenerator(new CustomLabelGenerator());
return jfreechart;
}
static class CustomLabelGenerator implements PieSectionLabelGenerator {
public String generateSectionLabel(PieDataset piedataset,
Comparable comparable) {
String string = null;
if (piedataset != null && !comparable.equals("Two"))
string = comparable.toString();
return string;
}
public AttributedString generateAttributedSectionLabel(
PieDataset piedataset, Comparable comparable) {
Object object = null;
String string = comparable.toString();
String string_0_ = (string + " : " + String.valueOf(piedataset
.getValue(comparable)));
AttributedString attributedstring = new AttributedString(string_0_);
attributedstring.addAttribute(TextAttribute.WEIGHT,
TextAttribute.WEIGHT_BOLD, 0, string.length() - 1);
return attributedstring;
}
}
```
程序代碼說明:
+ 自定義`CustomLabelGenerator`,必須實現接口`PieSectionLabelGenerator`。
### 5.10.10 類PieChart3DDemo1.java
功能:
3D效果的餅圖。
效果:

代碼:
```
private static JFreeChart createChart(PieDataset piedataset) {
JFreeChart jfreechart = ChartFactory.createPieChart3D(
"Pie Chart 3D Demo 1", piedataset, true, true, false);
PiePlot3D pieplot3d = (PiePlot3D) jfreechart.getPlot();
pieplot3d.setStartAngle(180.0);
pieplot3d.setDirection(Rotation.CLOCKWISE);
pieplot3d.setForegroundAlpha(0.5F);
pieplot3d.setNoDataMessage("No data to display");
return jfreechart;
}
```
程序代碼說明:
+ 使用`ChartFactory`的方法`createPieChart3D`創建3D效果的餅圖。
+ `setStartAngle(180.0)`:設置旋轉角度。
+ `setDirection(Rotation.CLOCKWISE)`:設置旋轉方向,`Rotation.CLOCKWISE`為順時針。
+ `setForegroundAlpha(0.5F)`:設置圖表透明圖0.0~1.0范圍。0.0為完全透明,1.0為完全不透明。
### 5.10.11 類MultiplePieChartDemo1.java
功能:
使用CategoryDataset數據集,在一個圖表上產生多個餅圖。
效果:

代碼:
```
private static CategoryDataset createDataset() {
double[][] ds = { { 3.0, 4.0, 3.0, 5.0 }, { 5.0, 7.0, 6.0, 8.0 },
{ 5.0, 7.0, Double.NaN, 3.0 }, { 1.0, 2.0, 3.0, 4.0 },
{ 2.0, 3.0, 2.0, 3.0 } };
CategoryDataset categorydataset = DatasetUtilities
.createCategoryDataset("Region ", "Sales/Q", ds);
return categorydataset;
}
```
程序代碼說明:
+ 創建`CategoryDataset`的方法。
```
private static JFreeChart createChart(CategoryDataset categorydataset) {
JFreeChart jfreechart = ChartFactory.createMultiplePieChart(
"Multiple Pie Chart", categorydataset, TableOrder.BY_ROW, true, true, false);
MultiplePiePlot multiplepieplot = (MultiplePiePlot) jfreechart .getPlot();
JFreeChart jfreechart_0_ = multiplepieplot.getPieChart();
PiePlot pieplot = (PiePlot) jfreechart_0_.getPlot();
pieplot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}"));
pieplot.setLabelFont(new Font("SansSerif", 0, 8));
pieplot.setInteriorGap(0.3);
return jfreechart;
}
```
程序代碼說明:
+ 使用`ChartFactory`的方法`createMultiplePieChart()`創建多個餅圖的圖表。
+ `multiplepieplot.getPieChart()`:獲得單個餅圖的圖表。
- Spring 中文文檔 3.1
- 第一部分 Spring framework 概述
- 第 1 章 Spring Framework 介紹
- 1.1 依賴注入和控制反轉
- 1.2 模塊
- 1.3 使用方案
- 第二部分 Spring 3 的新特性
- 第 2 章 Spring 3.0 的新特性和增強
- 2.1 Java 5
- 2.2 改進的文檔
- 2.3 新的文章和教程
- 2.4 新的模塊組織方式和系統構建方式
- 2.5 新特性概述
- 第 3 章 Spring 3.1 的新特性和增強
- 3.1 新特性概述
- 第三部分 核心技術
- 第 4 章 IoC 容器
- 4.1 Spring IoC 容器和 bean 的介紹
- 4.2 容器概述
- 4.3 Bean 概述
- 4.4 依賴
- 4.5 Bean 的范圍
- 4.6 自定義 bean 的性質
- 4.7 Bean 定義的繼承
- 4.8 容器擴展點
- 4.9 基于注解的容器配置
- 4.10 類路徑掃描和管理的組件
- 4.11 使用 JSR 330 標準注解
- 4.12 基于 Java 的容器配置
- Hibernate 中文文檔 3.2
- 前言
- 1. 翻譯說明
- 2. 版權聲明
- 第 1 章 Hibernate入門
- 1.1. 前言
- 1.2. 第一部分 - 第一個Hibernate應用程序
- 1.2.1. 第一個class
- 1.2.2. 映射文件
- 1.2.3. Hibernate配置
- 1.2.4. 用Ant構建
- 1.2.5. 啟動和輔助類
- 1.2.6. 加載并存儲對象
- 1.3. 第二部分 - 關聯映射
- 1.3.1. 映射Person類
- 1.3.2. 單向Set-based的關聯
- 1.3.3. 使關聯工作
- 1.3.4. 值類型的集合
- 1.3.5. 雙向關聯
- 1.3.6. 使雙向連起來
- 1.4. 第三部分 - EventManager web應用程序
- 1.4.1. 編寫基本的servlet
- 1.4.2. 處理與渲染
- 1.4.3. 部署與測試
- 1.5. 總結
- 第 2 章 體系結構(Architecture)
- 2.1. 概況(Overview)
- 2.2. 實例狀態
- 2.3. JMX整合
- 2.4. 對JCA的支持
- 2.5. 上下文相關的(Contextual)Session
- 第 3 章 配置
- 3.1. 可編程的配置方式
- 3.2. 獲得SessionFactory
- 3.3. JDBC連接
- 3.4. 可選的配置屬性
- 3.4.1. SQL方言
- 3.4.2. 外連接抓取(Outer Join Fetching)
- 3.4.3. 二進制流 (Binary Streams)
- 3.4.4. 二級緩存與查詢緩存
- 3.4.5. 查詢語言中的替換
- 3.4.6. Hibernate的統計(statistics)機制
- 3.5. 日志
- 3.6. 實現NamingStrategy
- 3.7. XML配置文件
- 3.8. J2EE應用程序服務器的集成
- 3.8.1. 事務策略配置
- 3.8.2. JNDI綁定的SessionFactory
- 3.8.3. 在JTA環境下使用Current Session context (當前session上下文)管理
- 3.8.4. JMX部署
- 第 4 章 持久化類(Persistent Classes)
- 4.1. 一個簡單的POJO例子
- 4.1.1. 實現一個默認的(即無參數的)構造方法(constructor)
- 4.1.2. 提供一個標識屬性(identifier property)(可選)
- 4.1.3. 使用非final的類 (可選)
- 4.1.4. 為持久化字段聲明訪問器(accessors)和是否可變的標志(mutators)(可選)
- 4.2. 實現繼承(Inheritance)
- 4.3. 實現equals()和hashCode()
- 4.4. 動態模型(Dynamic models)
- 4.5. 元組片斷映射(Tuplizers)
- 第 5 章 對象/關系數據庫映射基礎(Basic O/R Mapping)
- 5.1. 映射定義(Mapping declaration)
- 5.1.1. Doctype
- 5.1.1.1. EntityResolver
- 5.1.2. hibernate-mapping
- 5.1.3. class
- 5.1.4. id
- 5.1.4.1. Generator
- 5.1.4.2. 高/低位算法(Hi/Lo Algorithm)
- 5.1.4.3. UUID算法(UUID Algorithm )
- 5.1.4.4. 標識字段和序列(Identity columns and Sequences)
- 5.1.4.5. 程序分配的標識符(Assigned Identifiers)
- 5.1.4.6. 觸發器實現的主鍵生成器(Primary keys assigned by triggers)
- 5.1.5. composite-id
- 5.1.6. 鑒別器(discriminator)
- 5.1.7. 版本(version)(可選)
- 5.1.8. timestamp (可選)
- 5.1.9. property
- 5.1.10. 多對一(many-to-one)
- 5.1.11. 一對一
- 5.1.12. 自然ID(natural-id)
- 5.1.13. 組件(component), 動態組件(dynamic-component)
- 5.1.14. properties
- 5.1.15. 子類(subclass)
- 5.1.16. 連接的子類(joined-subclass)
- 5.1.17. 聯合子類(union-subclass)
- 5.1.18. 連接(join)
- 5.1.19. 鍵(key)
- 5.1.20. 字段和規則元素(column and formula elements)
- 5.1.21. 引用(import)
- 5.1.22. any
- 5.2. Hibernate 的類型
- 5.2.1. 實體(Entities)和值(values)
- 5.2.2. 基本值類型
- 5.2.3. 自定義值類型
- 5.3. 多次映射同一個類
- 5.4. SQL中引號包圍的標識符
- 5.5. 其他元數據(Metadata)
- 5.5.1. 使用 XDoclet 標記
- 5.5.2. 使用 JDK 5.0 的注解(Annotation)
- 5.6. 數據庫生成屬性(Generated Properties)
- 5.7. 輔助數據庫對象(Auxiliary Database Objects)
- 第 6 章 集合類(Collections)映射
- 6.1. 持久化集合類(Persistent collections)
- 6.2. 集合映射( Collection mappings )
- 6.2.1. 集合外鍵(Collection foreign keys)
- 6.2.2. 集合元素(Collection elements)
- 6.2.3. 索引集合類(Indexed collections)
- 6.2.4. 值集合于多對多關聯(Collections of values and many-to-many associations)
- 6.2.5. 一對多關聯(One-to-many Associations)
- 6.3. 高級集合映射(Advanced collection mappings)
- 6.3.1. 有序集合(Sorted collections)
- 6.3.2. 雙向關聯(Bidirectional associations)
- 6.3.3. 雙向關聯,涉及有序集合類
- 6.3.4. 三重關聯(Ternary associations)
- 6.3.5. 使用<idbag>
- 6.4. 集合例子(Collection example)
- 第 7 章 關聯關系映射
- 7.1. 介紹
- 7.2. 單向關聯(Unidirectional associations)
- 7.2.1. 多對一(many to one)
- 7.2.2. 一對一(one to one)
- 7.2.3. 一對多(one to many)
- 7.3. 使用連接表的單向關聯(Unidirectional associations with join tables)
- 7.3.1. 一對多(one to many)
- 7.3.2. 多對一(many to one)
- 7.3.3. 一對一(one to one)
- 7.3.4. 多對多(many to many)
- 7.4. 雙向關聯(Bidirectional associations)
- 7.4.1. 一對多(one to many) / 多對一(many to one)
- 7.4.2. 一對一(one to one)
- 7.5. 使用連接表的雙向關聯(Bidirectional associations with join tables)
- 7.5.1. 一對多(one to many) /多對一( many to one)
- 7.5.2. 一對一(one to one)
- 7.5.3. 多對多(many to many)
- 7.6. 更復雜的關聯映射
- 第 8 章 組件(Component)映射
- 8.1. 依賴對象(Dependent objects)
- 8.2. 在集合中出現的依賴對象 (Collections of dependent objects)
- 8.3. 組件作為Map的索引(Components as Map indices )
- 8.4. 組件作為聯合標識符(Components as composite identifiers)
- 8.5. 動態組件 (Dynamic components)
- 第 9 章 繼承映射(Inheritance Mappings)
- 9.1. 三種策略
- 9.1.1. 每個類分層結構一張表(Table per class hierarchy)
- 9.1.2. 每個子類一張表(Table per subclass)
- 9.1.3. 每個子類一張表(Table per subclass),使用辨別標志(Discriminator)
- 9.1.4. 混合使用“每個類分層結構一張表”和“每個子類一張表”
- 9.1.5. 每個具體類一張表(Table per concrete class)
- 9.1.6. Table per concrete class, using implicit polymorphism
- 9.1.7. 隱式多態和其他繼承映射混合使用
- 9.2. 限制
- 第 10 章 與對象共事
- 10.1. Hibernate對象狀態(object states)
- 10.2. 使對象持久化
- 10.3. 裝載對象
- 10.4. 查詢
- 10.4.1. 執行查詢
- 10.4.1.1. 迭代式獲取結果(Iterating results)
- 10.4.1.2. 返回元組(tuples)的查詢
- 10.4.1.3. 標量(Scalar)結果
- 10.4.1.4. 綁定參數
- 10.4.1.5. 分頁
- 10.4.1.6. 可滾動遍歷(Scrollable iteration)
- 10.4.1.7. 外置命名查詢(Externalizing named queries)
- 10.4.2. 過濾集合
- 10.4.3. 條件查詢(Criteria queries)
- 10.4.4. 使用原生SQL的查詢
- 10.5. 修改持久對象
- 10.6. 修改脫管(Detached)對象
- 10.7. 自動狀態檢測
- 10.8. 刪除持久對象
- 10.9. 在兩個不同數據庫間復制對象
- 10.10. Session刷出(flush)
- 10.11. 傳播性持久化(transitive persistence)
- 10.12. 使用元數據
- 第 11 章 事務和并發
- 11.1. Session和事務范圍(transaction scope)
- 11.1.1. 操作單元(Unit of work)
- 11.1.2. 長對話
- 11.1.3. 關注對象標識(Considering object identity)
- 11.1.4. 常見問題
- 11.2. 數據庫事務聲明
- 11.2.1. 非托管環境
- 11.2.2. 使用JTA
- 11.2.3. 異常處理
- 11.2.4. 事務超時
- 11.3. 樂觀并發控制(Optimistic concurrency control)
- 11.3.1. 應用程序級別的版本檢查(Application version checking)
- 11.3.2. 擴展周期的session和自動版本化
- 11.3.3. 脫管對象(deatched object)和自動版本化
- 11.3.4. 定制自動版本化行為
- 11.4. 悲觀鎖定(Pessimistic Locking)
- 11.5. 連接釋放模式(Connection Release Modes)
- 第 12 章 攔截器與事件(Interceptors and events)
- 12.1. 攔截器(Interceptors)
- 12.2. 事件系統(Event system)
- 12.3. Hibernate的聲明式安全機制
- 第 13 章 批量處理(Batch processing)
- 13.1. 批量插入(Batch inserts)
- 13.2. 批量更新(Batch updates)
- 13.3. StatelessSession (無狀態session)接口
- 13.4. DML(數據操作語言)風格的操作(DML-style operations)
- 第 14 章 HQL: Hibernate查詢語言
- 14.1. 大小寫敏感性問題
- 14.2. from子句
- 14.3. 關聯(Association)與連接(Join)
- 14.4. join 語法的形式
- 14.5. select子句
- 14.6. 聚集函數
- 14.7. 多態查詢
- 14.8. where子句
- 14.9. 表達式
- 14.10. order by子句
- 14.11. group by子句
- 14.12. 子查詢
- 14.13. HQL示例
- 14.14. 批量的UPDATE和DELETE
- 14.15. 小技巧 & 小竅門
- 第 15 章 條件查詢(Criteria Queries)
- 15.1. 創建一個Criteria 實例
- 15.2. 限制結果集內容
- 15.3. 結果集排序
- 15.4. 關聯
- 15.5. 動態關聯抓取
- 15.6. 查詢示例
- 15.7. 投影(Projections)、聚合(aggregation)和分組(grouping)
- 15.8. 離線(detached)查詢和子查詢
- 15.9. 根據自然標識查詢(Queries by natural identifier)
- 第 16 章 Native SQL查詢
- 16.1. 使用SQLQuery
- 16.1.1. 標量查詢(Scalar queries)
- 16.1.2. 實體查詢(Entity queries)
- 16.1.3. 處理關聯和集合類(Handling associations and collections)
- 16.1.4. 返回多個實體(Returning multiple entities)
- 16.1.4.1. 別名和屬性引用(Alias and property references)
- 16.1.5. 返回非受管實體(Returning non-managed entities)
- 16.1.6. 處理繼承(Handling inheritance)
- 16.1.7. 參數(Parameters)
- 16.2. 命名SQL查詢
- 16.2.1. 使用return-property來明確地指定字段/別名
- 16.2.2. 使用存儲過程來查詢
- 16.2.2.1. 使用存儲過程的規則和限制
- 16.3. 定制SQL用來create,update和delete
- 16.4. 定制裝載SQL
- 第 17 章 過濾數據
- 17.1. Hibernate 過濾器(filters)
- 第 18 章 XML映射
- 18.1. 用XML數據進行工作
- 18.1.1. 指定同時映射XML和類
- 18.1.2. 只定義XML映射
- 18.2. XML映射元數據
- 18.3. 操作XML數據
- 第 19 章 提升性能
- 19.1. 抓取策略(Fetching strategies)
- 19.1.1. 操作延遲加載的關聯
- 19.1.2. 調整抓取策略(Tuning fetch strategies)
- 19.1.3. 單端關聯代理(Single-ended association proxies)
- 19.1.4. 實例化集合和代理(Initializing collections and proxies)
- 19.1.5. 使用批量抓取(Using batch fetching)
- 19.1.6. 使用子查詢抓取(Using subselect fetching)
- 19.1.7. 使用延遲屬性抓取(Using lazy property fetching)
- 19.2. 二級緩存(The Second Level Cache)
- 19.2.1. 緩存映射(Cache mappings)
- 19.2.2. 策略:只讀緩存(Strategy: read only)
- 19.2.3. 策略:讀/寫緩存(Strategy: read/write)
- 19.2.4. 策略:非嚴格讀/寫緩存(Strategy: nonstrict read/write)
- 19.2.5. 策略:事務緩存(transactional)
- 19.3. 管理緩存(Managing the caches)
- 19.4. 查詢緩存(The Query Cache)
- 19.5. 理解集合性能(Understanding Collection performance)
- 19.5.1. 分類(Taxonomy)
- 19.5.2. Lists, maps 和sets用于更新效率最高
- 19.5.3. Bag和list是反向集合類中效率最高的
- 19.5.4. 一次性刪除(One shot delete)
- 19.6. 監測性能(Monitoring performance)
- 19.6.1. 監測SessionFactory
- 19.6.2. 數據記錄(Metrics)
- 第 20 章 工具箱指南
- 20.1. Schema自動生成(Automatic schema generation)
- 20.1.1. 對schema定制化(Customizing the schema)
- 20.1.2. 運行該工具
- 20.1.3. 屬性(Properties)
- 20.1.4. 使用Ant(Using Ant)
- 20.1.5. 對schema的增量更新(Incremental schema updates)
- 20.1.6. 用Ant來增量更新schema(Using Ant for incremental schema updates)
- 20.1.7. Schema 校驗
- 20.1.8. 使用Ant進行schema校驗
- 第 21 章 示例:父子關系(Parent Child Relationships)
- 21.1. 關于collections需要注意的一點
- 21.2. 雙向的一對多關系(Bidirectional one-to-many)
- 21.3. 級聯生命周期(Cascading lifecycle)
- 21.4. 級聯與未保存值(Cascades and unsaved-value)
- 21.5. 結論
- 第 22 章 示例:Weblog 應用程序
- 22.1. 持久化類
- 22.2. Hibernate 映射
- 22.3. Hibernate 代碼
- 第 23 章 示例:復雜映射實例
- 23.1. Employer(雇主)/Employee(雇員)
- 23.2. Author(作家)/Work(作品)
- 23.3. Customer(客戶)/Order(訂單)/Product(產品)
- 23.4. 雜例
- 23.4.1. "Typed" one-to-one association
- 23.4.2. Composite key example
- 23.4.3. 共有組合鍵屬性的多對多(Many-to-many with shared composite key attribute)
- 23.4.4. Content based discrimination
- 23.4.5. Associations on alternate keys
- 第 24 章 最佳實踐(Best Practices)
- HttpClient 教程
- 前言
- 第一章 基礎
- 第二章 連接管理
- 第三章 HTTP狀態管理
- 第四章 HTTP認證
- 第五章 HTTP客戶端服務
- 第六章 高級主題
- Mybatis 中文文檔 3.4
- 參考文檔
- 簡介
- 入門
- XML 映射配置文件
- Mapper XML 文件
- 動態 SQL
- Java API
- SQL語句構建器類
- Logging
- 項目文檔
- 項目總體信息
- 訪問
- 提醒方法
- 項目依賴
- Dependency Information
- Overview
- 問題跟蹤
- 項目授權
- 項目郵件列表
- Project Plugin Management
- Project Build Plugins
- Project Report Plugins
- 團隊
- Web訪問
- 匿名訪問
- 開發者訪問
- 通過防火墻訪問
- 項目概要
- 生成報表
- MyBatis Generator 用戶手冊
- MyBatis Generator介紹
- MyBatis Generator新增功能
- MyBatis Generator 快速入門指南
- 運行 MyBatis Generator
- 從命令行運行 MyBatis Generator
- 使用Ant運行 MyBatis Generator
- 通過Maven運行 MyBatis Generator
- 使用Java運行 MyBatis Generator
- 運行 MyBatis Generator 后的任務
- Migrating from Ibator
- Migrating from Abator
- MyBatis Generator XML 配置參考
- <classPathEntry> 元素
- <columnOverride> 元素
- <columnRenamingRule> 元素
- <commentGenerator> 元素
- <context> 元素
- <generatedKey> 元素
- <generatorConfiguration> 元素
- <ignoreColumn> 元素
- <javaClientGenerator> 元素
- The <javaModelGenerator> Element
- The <javaTypeResolver> Element
- <jdbcConnection> 元素
- <plugin> 元素
- <properties> 元素
- <property> 元素
- <sqlMapGenerator> 元素
- <table> 元素
- 使用生成的對象
- JAVA實體對象
- SQL映射文件
- Java客戶端對象
- Example類使用說明
- 擴展Example類
- 使用注意事項
- DB2 使用注意事項
- MySql 使用注意事項
- Oracle 使用注意事項
- PostgreSQL 使用注意事項
- 參考資料
- 從源碼構建
- 擴展MyBatis Generator
- 開發插件
- 日志信息
- 提供的插件
- 設計理念
- Velocity 中文文檔
- 1. 關于
- 2. 什么是Velocity?
- 3. Velocity 可以做什么?
- 3.1. Mud Store 示例
- 4. Velocity模板語言(VTL): 介紹
- 5. Hello Velocity World!
- 6. 注釋
- 7. 引用
- 7.1. 變量Variables
- 7.2. 屬性
- 7.3. 方法
- 8. 形式引用符Formal Reference Notation
- 9. 安靜引用符Quiet Reference Notation
- 11. Case Substitution
- 12. 指令
- 12.1. #set
- 12.2. 字面字符串
- 12.3. 條件
- 12.3.1 If / ElseIf / Else
- 12.3.2 關系和邏輯操作符
- 12.4. 循環
- 12.4.1. Foreach 循環
- 12.5. 包含
- 12.6. 解析
- 12.7. 停止
- 12.10. 宏
- 12.10.1. Velocimacro 參數
- 12.10.2. Velocimacro 屬性
- 12.10.3. Velocimacro Trivia
- 13. Getting literal
- 13.1. 貨幣字符
- 13.2. 轉義 有效的 VTL 指令
- 13.3. 轉義 無效的 VTL 指令
- 14. VTL 格式化問題
- 15. 其它特征和雜項
- 15.1. 數學特征
- 15.2. 范圍操作符
- 15.3. 進階:轉義和!
- 15.4. Velocimacro 雜記
- 15.5. 字符串聯
- Google Guava官方教程(中文版)
- 1-基本工具
- 1.1-使用和避免null
- 1.2-前置條件
- 1.3-常見Object方法
- 1.4-排序: Guava強大的”流暢風格比較器”
- 1.5-Throwables:簡化異常和錯誤的傳播與檢查
- 2-集合
- 2.1-不可變集合
- 2.2-新集合類型
- 2.3-強大的集合工具類:java.util.Collections中未包含的集合工具
- 2.4-集合擴展工具類
- 3-緩存
- 4-函數式編程
- 5-并發
- 5.1-google Guava包的ListenableFuture解析
- 5.2-Google-Guava Concurrent包里的Service框架淺析
- 6-字符串處理:分割,連接,填充
- 7-原生類型
- 8-區間
- 9-I/O
- 10-散列
- 11-事件總線
- 12-數學運算
- 13-反射
- JFreeChart 開發者指南
- 1 簡介
- 1.1 什么是JFreeChart
- 1.2 使用文檔
- 1.3 感謝
- 1.4 建議
- 2 圖表實例
- 2.1 介紹
- 2.2 餅圖(Pie Charts)
- 2.3 直方條形圖(Bar Charts)
- 2.4 折線圖(Line Charts)
- 2.5 XY(散點圖)
- 2.6 時序圖
- 2.7 柱狀圖
- 2.8 面積圖
- 2.9 差異圖
- 2.10 梯形圖
- 2.11 甘特圖
- 2.12 多軸圖
- 2.13 復合/覆蓋圖
- 2.14 開發遠景
- 3 下載和安裝JFreeChart 1.0.6
- 3.1 簡介
- 3.2 下載
- 3.3 解包
- 3.4 運行演示實例
- 3.5 編譯源代碼
- 3.6 產生javadoc文檔
- 4 使用JFreeChart1.0.6
- 4.1 概述
- 4.2 創建第一個圖表
- 5 餅圖(Pie Charts)
- 5.1 簡介
- 5.2 創建一個簡單的餅圖(Pie Charts)
- 5.3 片區顏色
- 5.4 片區外廓
- 5.5 空置、零值和負值
- 5.6 片區和圖例標簽
- 5.7 “取出”某個片區
- 5.8 3D餅圖
- 5.9 多餅圖
- 5.10 實例講解
- 6 直方條形圖(Bar Charts)
- 6.1 簡介
- 6.2 創建一個直方條形圖
- 6.3 ChartFactory類
- 6.4 直方條形圖的簡單定制
- 6.5 定制外觀
- 6.6 示例代碼解讀
- 7 折線圖
- 7.1 簡介
- 7.2 使用categoryDataset數據集創建折線圖
- 7.3 使用XYDataset數據集創建折線圖
- 8 時序圖
- 8.1 簡介
- 8.2 創建時序圖
- 9 定制圖表(Customising Charts)
- 9.1 簡介
- 9.2 圖表屬性
- 9.3 圖區屬性
- 9.4 軸屬性
- 9.5 心得體會
- 10 動態圖(Dynamic Charts)
- 10.1 簡介
- 10.2 知識背景
- 10.3 實例應用
- 11 圖表工具條(Tooltips)
- 11.1 概述
- 11.2 創建圖表工具條
- 11.3 收集圖表工具條
- 11.4 顯示圖表工具條
- 11.5 隱藏圖表工具條
- 11.6 定制圖表工具條
- 12 圖表條目標簽(Item Label)
- 12.1 簡介
- 12.2 顯示條目標簽
- 12.3 條目標簽外觀
- 12.4 條目標簽位置
- 12.5 定制條目標簽文本
- 12.6 實例1
- 12.7 實例2
- 13 多軸和數據源圖表(Multi Axis and Dataset)
- 13.1 簡介
- 13.2 實例
- 13.3 建議和技巧
- 14 組合圖表(Combined Charts)
- 14.1 簡介
- 14.2 組合X種類圖區
- 14.3 組合Y種類圖區
- 14.4 組合X-XY圖區
- 14.5 組合Y-XY圖區
- 15 數據源和JDBC(Dataset And JDBC)
- 15.1 簡介
- 15.2 關于JDBC
- 15.3 樣本數據
- 15.4 PostgreSQL
- 15.5 JDBC驅動
- 15.6 應用演示
- 16 導出圖表為PDF格式
- 16.1 簡介
- 16.2 什么是Acrobat PDF
- 16.3 IText
- 16.4 Graphics2D
- 16.5 開始導出
- 16.6 實例應用
- 16.7 查看PDF 文件
- 16.8 Unicode字符問題
- 17 導出圖表為SVG格式
- 17.1 簡介
- 17.2 背景
- 17.3 實例代碼
- 18 Applet
- 18.1 簡介
- 18.2 問題
- 18.3 實例應用
- 19 Servlets
- 19.1 介紹
- 19.2 編寫一個簡單的Servlet應用
- 19.3 編譯實例Servlet
- 19.4 部署實例Servlet
- 19.5 在HMTL頁面種嵌入圖表
- 19.6 支持文件
- 19.7 部署Servlets
- 20 JFreeChart相關技術
- 20.1 簡介
- 20.2 X11/Headless Java
- 20.3 JSP
- 20.4 加載圖片
- 21 包
- 21.1 概述