zoukankan      html  css  js  c++  java
  • Pluggable JXTaskPane

    http://blogs.oracle.com/geertjan/entry/pluggable_jxtaskpane

    ——————————————————————————————————————————————————————————————

    Pluggable JXTaskPane

    By Geertjan on May 21, 2010

    Some of the students on the recent NetBeans Platform Certified Training at the TU Braunschweig are creating an application in the medical domain. I was shown their application, which included a JXTaskPane from the SwingX project.

    Each task in the task pane represents a different department at the hospital. E.g., one task for "Anamnesis" and another task for "Radiology", each with their own labels, icons, and actions. So then, I stated, it would be completely logical for each task to be provided by a different module since each module could then more easily be created by different departments, the application could be created for different users, and the users themselves could potentially have a choice in the features available in their local distribution. Today I experimented with this scenario. And, as you can see, my medical application has one module that displays tasks, with supporting modules coming from each department in the hospital (currently two only for demo purposes):

    To the end user, there's no difference, of course, since the UI is the same regardless of whether the application is modular or not:

    In the TaskDisplayer module, I have a TopComponent with the following added to the constructor:

    //Read the "tasks" folder in the layer file via the NetBeans Filesystems API: FileObject tasksFolder = FileUtil.getConfigFile("tasks"); //Get all the children, which represent tasks: FileObject[] tasks = tasksFolder.getChildren();  //Create a JXTaskPaneContainer: JXTaskPaneContainer taskpanecontainer = new JXTaskPaneContainer();  //Create the JXPanel: JXPanel panel = new JXPanel(); panel.setLayout(new BorderLayout());  //Iterate through the tasks in the order //specified by the "position" attribute: for (FileObject task : FileUtil.getOrder(Arrays.asList(tasks), true)) {      String name = task.getName();     String room = task.getAttribute("location").toString();      //Create a new JXTaskPane     //for each task:     JXTaskPane taskpane = new JXTaskPane();     taskpane.setTitle(name + " (" + room + ")");      //Add Actions registered in the layer:     List<? extends Action> actions = Utilities.actionsForPath("Actions/" + name);     for (Action action : actions) {         taskpane.add(action);     }      //Add the JXTaskPane to the JXTaskPaneContainer:     taskpanecontainer.add(taskpane);  }  //Add the JXTaskPaneContainer to the JXTaskPanel: panel.setAlpha(0.7f); panel.add(taskpanecontainer, BorderLayout.CENTER); panel.setPreferredSize(new Dimension(250, 200));  //Add the JXTaskPanel to the TopComponent: add(panel, BorderLayout.CENTER);

    And then, in each module for the departments, I have content like this in the layer file, which is what is read by the code above:

    <folder name="tasks">     <folder name="Radiology">         <attr name="location" stringvalue="Sector 3B"/>         <attr name="position" intvalue="200"/>     </folder> </folder>  <folder name="Actions">     <folder name="Radiology">         <file name="org-medical-task-radiology-AnalyzeAction.instance">             <attr name="delegate" newvalue="org.medical.task.radiology.AnalyzeAction"/>             <attr name="displayName" bundlevalue="org.medical.task.radiology.Bundle#CTL_AnalyzeAction"/>             <attr name="instanceCreate" methodvalue="org.openide.awt.Actions.alwaysEnabled"/>             <attr name="noIconInMenu" boolvalue="false"/>             <attr name="position" intvalue="200"/>         </file>         <file name="org-medical-task-radiology-ScanAction.instance">             <attr name="delegate" newvalue="org.medical.task.radiology.ScanAction"/>             <attr name="displayName" bundlevalue="org.medical.task.radiology.Bundle#CTL_ScanAction"/>             <attr name="instanceCreate" methodvalue="org.openide.awt.Actions.alwaysEnabled"/>             <attr name="noIconInMenu" boolvalue="false"/>             <attr name="position" intvalue="100"/>         </file>     </folder> </folder>

    Finally, it would even be possible to make supplemental tasks available depending on the actions selected in the tasks above. I.e., the "Radiology" task would only be added once "Assess Symptoms" has been completed in the "Anamnesis" task. To really optimize performance, you could load a module on demand, i.e., only load the "Radiology" module at the time that that module becomes relevant.

    And, to make the solution even better, each task could be created from a Node, meaning that each task would then have its own context (i.e., its own Lookup), so that it could be context sensitive, i.e, depending on the current patient (a Patient POJO in the Lookup), different capabilities could be made available.

    In other news. For more on NetBeans Platform in the medical domain, read Interview: NetBeans Platform Helps Advance Biomechanics Research, which was published today.

    ——————————————————————————————————
    傲轩游戏网
  • 相关阅读:
    Message "'OFFSET' 附近有语法错误。 在 FETCH 语句中选项 NEXT 的用法无效。" 解决办法 EntityFrameworkCore
    关于.Net Core 部署在Linux下连接SqlServer数据库超时解决办法
    EntityFrameworkCore Db First 生成Model时出错 PowerShell 版本过低
    八大排序算法详解(动图演示 思路分析 实例代码java 复杂度分析 适用场景)
    Loadrunner12 使用谷歌浏览器录制脚本时打不开网页-解决办法
    Loadrunner12 在谷歌浏览器录制https协议的脚本时,提示不是私密链接-解决办法
    loadrunner回放https请求时报connect 时发生ssl协议错误--解决办法
    百度2020春招 笔试算法题第一题 需要买多少瓶果汁
    美团2020春招 笔试算法题 双行道
    美团2020春招 笔试算法题 最好一样
  • 原文地址:https://www.cnblogs.com/cuizhf/p/2234349.html
Copyright © 2011-2022 走看看