/**************************************************************************** ** ** This file is part of yFiles FLEX 1.6. ** ** yWorks proprietary/confidential. Use is subject to license terms. ** ** Unauthorized redistribution of this file or of a byte-code version ** of this file is strictly forbidden. ** ** Copyright (c) 2006 - 2011 by yWorks GmbH, Vor dem Kreuzberg 28, ** 72070 Tuebingen, Germany. All rights reserved. ** ***************************************************************************/ package demo.businessProcessDiagram.bpd { import demo.businessProcessDiagram.model.BPMNElements; import demo.businessProcessDiagram.model.BPRelation; import mx.collections.ArrayCollection; import mx.containers.Accordion; import mx.containers.HBox; import mx.controls.TileList; import mx.events.ListEvent; /** * This Accordion holds BPMNAccordionListItems that can be dragged onto a * BusinessProcessDiagramComponent to create a node representing a business process element. * An ListEvent.ITEM_CLICK event is dispatched when an item is clicked. */ public class BPMNAccordion extends Accordion { public function BPMNAccordion() { super(); initData(); } /** * Adds all horizontal boxes of the accordion. * @return */ protected function initData():void { addHBox("活 動", createActivityDataProvider()); addHBox("分 岐", createGatewayDataProvider()); addHBox("イベント", createEventDataProvider()); addHBox("飾り部品", createArtifactDataProvider()); addHBox("関連付け", createRelationDataProvider()); } /* * Creates on horizontal box of the accordion and configures it. */ private function addHBox(label:String, dataProvider:Object):void { var hbox:HBox = new HBox(); hbox.label = label; hbox.percentHeight = 100; hbox.percentWidth = 100; addChild(hbox); var tileList:TileList = new BPMNTileList(); // use this TileList specialized for BPMNAccordionListItems tileList.dragEnabled = true; //all items are draggable tileList.setStyle("borderThickness", 0); tileList.percentWidth = 100; tileList.percentHeight = 100; tileList.addEventListener(ListEvent.ITEM_CLICK, onItemClick); tileList.name = "TileList"; var itemRenderer:BPMNAccordionListItemRenderer = new BPMNAccordionListItemRenderer(); tileList.itemRenderer = itemRenderer; tileList.dataProvider = dataProvider; hbox.addChild(tileList); } /** * Creates the data provider for activities. * @return The data provider for activities. */ protected function createActivityDataProvider():ArrayCollection { var array:ArrayCollection = new ArrayCollection(); var listItem:BPMNAccordionListItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.TASK); listItem.label = "タスク"; listItem.width = 80; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.TASK_MULTIPLE_INSTANCES); listItem.label = "タスク\n複数業務"; listItem.width = 80; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.TASK_LOOP); listItem.label = "タスク\n繰返し処理"; listItem.width = 80; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.TASK_AD_HOC); listItem.label = "タスク\n特殊業務"; listItem.width = 80; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.SUBPROCESS); listItem.label = "副業務"; listItem.width = 80; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.SUBPROCESS_MULTIPLE_INSTANCES); listItem.label = "副業務\n付随処理"; listItem.width = 80; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.SUBPROCESS_LOOP); listItem.label = "副業務\n繰返し処理"; listItem.width = 80; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.SUBPROCESS_AD_HOC); listItem.label = "副業務\n特殊処理"; listItem.width = 80; array.addItem(listItem); return array; } /** * Creates the data provider for gateways. * @return The data provider for gateways. */ protected function createGatewayDataProvider():ArrayCollection { var array:ArrayCollection = new ArrayCollection(); var listItem:BPMNAccordionListItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.GATEWAY_DATA_BASED_EXCLUSIVE); listItem.label = "データに依存する\n例外処理"; listItem.width = 50; listItem.height = 50; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.GATEWAY_EVENT_BASED_EXCLUSIVE); listItem.label = "操作に依存する\n例外処理"; listItem.width = 50; listItem.height = 50; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.GATEWAY_PARALLEL); listItem.label = "同時進行"; listItem.width = 50; listItem.height = 50; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.GATEWAY_INCLUSIVE); listItem.label = "取込み処理"; listItem.width = 50; listItem.height = 50; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.GATEWAY_COMPLEX); listItem.label = "複雑な処理"; listItem.width = 50; listItem.height = 50; array.addItem(listItem); return array; } /** * Creates the data provider for events. * @return The data provider for events. */ protected function createEventDataProvider():ArrayCollection { var array:ArrayCollection = new ArrayCollection(); var listItem:BPMNAccordionListItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.EVENT_PLAIN_START); listItem.label = "単独の\n開始"; listItem.width = 40; listItem.height = 40; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.EVENT_PLAIN_INTERMEDIATE_CATCHING); listItem.label = "単独の\n中間\nチェック点"; listItem.width = 40; listItem.height = 40; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.EVENT_PLAIN_END); listItem.label = "単独の\n終了"; listItem.width = 40; listItem.height = 40; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.EVENT_MESSAGE_START); listItem.label = "メッセージ\n開始"; listItem.width = 40; listItem.height = 40; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.EVENT_MESSAGE_INTERMEDIATE_CATCHING); listItem.label = "メッセージ\n中間\nチェック点"; listItem.width = 40; listItem.height = 40; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.EVENT_MESSAGE_INTERMEDIATE_THROWING); listItem.label = "メッセージ\n中間\n再試行"; listItem.width = 40; listItem.height = 40; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.EVENT_MESSAGE_END); listItem.label = "メッセージ\n終了"; listItem.width = 40; listItem.height = 40; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.EVENT_TIMER_START); listItem.label = "タイマー\n開始"; listItem.width = 40; listItem.height = 40; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.EVENT_TIMER_INTERMEDIATE_CATCHING); listItem.label = "タイマー\n中間\nチェック点"; listItem.width = 40; listItem.height = 40; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.EVENT_TERMINATE); listItem.label = "中断"; listItem.width = 40; listItem.height = 40; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.EVENT_MULTIPLE_START); listItem.label = "マルチの\n開始"; listItem.width = 40; listItem.height = 40; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.EVENT_MULTIPLE_INTERMEDIATE_CATCHING); listItem.label = "マルチの\n中間\nチェック点"; listItem.width = 40; listItem.height = 40; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.EVENT_MULTIPLE_INTERMEDIATE_THROWING); listItem.label = "マルチの\n中間\n再試行"; listItem.width = 40; listItem.height = 40; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.EVENT_MULTIPLE_END); listItem.label = "マルチの\n終了"; listItem.width = 40; listItem.height = 40; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.EVENT_ERROR_INTERMEDIATE_CATCHING); listItem.label = "エラー\n中間\nチェック点"; listItem.width = 40; listItem.height = 40; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.EVENT_ERROR_END); listItem.label = "エラー\n終了"; listItem.width = 40; listItem.height = 40; array.addItem(listItem); return array; } /** * Creates the data provider for artifacts. * @return The data provider for artifacts. */ protected function createArtifactDataProvider():ArrayCollection { var array:ArrayCollection = new ArrayCollection(); var listItem:BPMNAccordionListItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.ARTIFACT_DATA_OBJECT); listItem.label = "データ項目"; listItem.width = 35; listItem.height = 50; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNNodeStyle(BPMNElements.ARTIFACT_TEXT_ANNOTATION); listItem.label = "注釈テキスト"; listItem.width = 80; listItem.height = 20; array.addItem(listItem); return array; } /** * Creates the data provider for relations. * @return The data provider for relations. */ protected function createRelationDataProvider():ArrayCollection { var array:ArrayCollection = new ArrayCollection(); var listItem:BPMNAccordionListItem = new BPMNAccordionListItem(); listItem.style = new BPMNEdgeStyle(BPRelation.SEQUENCE_FLOW); listItem.label = "流れ フロー"; listItem.width = 80; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNEdgeStyle(BPRelation.DEFAULT_FLOW); listItem.label = "標準 フロー"; listItem.width = 80; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNEdgeStyle(BPRelation.CONDITIONAL_FLOW); listItem.label = "条件付 フロー"; listItem.width = 80; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNEdgeStyle(BPRelation.ASSOCIATION); listItem.label = "関連付け"; listItem.width = 80; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNEdgeStyle(BPRelation.ASSOCIATION_DIRECTED); listItem.label = "直接的\n関連付け"; listItem.width = 80; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNEdgeStyle(BPRelation.ASSOCIATION_BIDIRECTED); listItem.label = "間接的\n関連付け"; listItem.width = 80; array.addItem(listItem); listItem = new BPMNAccordionListItem(); listItem.style = new BPMNEdgeStyle(BPRelation.MESSAGE_FLOW); listItem.label = "メッセージ フロー"; listItem.width = 80; array.addItem(listItem); return array; } /** * Dispatches the given ListEvent. */ protected function onItemClick(evt:ListEvent):void { dispatchEvent(evt); } } }