ガント・チャート

ガント・チャート Bean を使用する基本ステップについては、「アクティビティー・チャート (SDK)」のサンプルで例示します。対応するソース・コードは、次のファイルにあります。
ガント・チャート・サンプルのほとんどのコードは、アプリケーションのメニューとステータス・バーを処理するためのものです。
チャートの構成および表示に必要なコードの一部の概要を以下に示します。
...
import ilog.views.gantt.*;
import ilog.views.gantt.model.*;
 ...
public class GanttExample extends JApplet
{
  protected IlvGanttChart gantt;
   ...
  public init(Container container)
   {
    super.init(container);
    // Creates the Gantt chart
    gantt = new IlvGanttChart();
    // Creates the Gantt data model
    IlvGanttModel model = createGanttModel();
    // Sets the data model of the Gantt chart
    gantt.setGanttModel(model);
     ...
    // Add the Gantt chart to the panel
    container.add(gantt, BorderLayout.CENTER);
     ...
  }
   ...
  protected IlvGanttModel createGanttModel()
   {
    IlvGanttModel model = new IlvDefaultGanttModel();
    populateGanttModel(model);
    return model;
   }

   protected void populateGanttModel(IlvGanttModel model)
   {
    ... /* Add activities to the data model here */
   }
   ...
  // Initialize example when run as an applet.
  public void init()
  {
    init(getContentPane());
  }

  public static void main (String[] args)
  {
    JFrame frame = new JFrame("Gantt Chart Example");
    GanttExample ganttChart = new GanttExample();
    ganttChart.init(frame.getContentPane());

    // Exit when the main frame is closed.
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    frame.addWindowListener(new WindowAdapter()
    {
      public void windowClosed(WindowEvent e)
      {
        System.exit(0);
      }
    });
     
    // Pack the main frame and make it visible.
    frame.pack();
    frame.setVisible(true);
  }
  ...
}
サンプルを実行するには、以下の手順に従います。
  1. Ant ユーティリティーが正しく設定されていることを確認します。 設定されていない場合は、JViews Gantt 用に Ant を設定する方法について、 「サンプルの開始」を読んでください。
  2. サンプルがインストールされているディレクトリーに移動し、以下を入力します。
    ant run