01: package org.netbeans.modules.vmd.midp.flow;
02:
03: import org.netbeans.modules.vmd.api.flow.FlowPinOrderPresenter;
04: import org.netbeans.modules.vmd.api.flow.visual.FlowPinDescriptor;
05: import org.openide.util.NbBundle;
06:
07: import java.util.ArrayList;
08: import java.util.Collections;
09: import java.util.Comparator;
10: import java.util.List;
11:
12: /**
13: * @author David Kaspar
14: */
15: public class FlowAlertViaPinOrderPresenter extends
16: FlowPinOrderPresenter {
17:
18: public static final String CATEGORY_ID = "AlertVia"; // NOI18N
19:
20: public String getCategoryID() {
21: return FlowAlertViaPinOrderPresenter.CATEGORY_ID;
22: }
23:
24: public String getCategoryDisplayName() {
25: return NbBundle.getMessage(FlowAlertViaPinOrderPresenter.class,
26: "DISP_FlowCategory_Vias"); // NOI18N
27: }
28:
29: public List<FlowPinDescriptor> sortCategory(
30: ArrayList<FlowPinDescriptor> descriptors) {
31: Collections.sort(descriptors,
32: new Comparator<FlowPinDescriptor>() {
33: public int compare(FlowPinDescriptor d1,
34: FlowPinDescriptor d2) {
35: long diff = d1.getRepresentedComponent()
36: .getComponentID()
37: - d2.getRepresentedComponent()
38: .getComponentID();
39: if (diff != 0)
40: return (int) diff;
41: return d1.getDescriptorID().compareTo(
42: d2.getDescriptorID());
43: }
44: });
45: return descriptors;
46: }
47:
48: }
|