各種 OS の差異を吸収するために仮想的なマシンを想定して OS によらない統一的な機能や UI を提供する・・というのは Java を語る上での決まり文句みたいなものですが、ドルフィンの一つのバージョンを実際に MacOS, Windows や Linux の全てでビルドしたことはなかったので、ここで鑑賞してみましょう。
/**
*
* @author Junzo SATO
*/
public class Panel2 extends JPanel implements Printable {
private String patientName;
private boolean printName;
private int height;
/** Creates a new instance of Panel2 */
public Panel2() {
}
public final class SchemaHolder extends AbstractComponentHolder implements ComponentHolder {
private SchemaModel schema;
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// Junzo SATO
// to restrict the size of the component,
// setBounds and setSize are overridden.
private final int fixedSize = 192;//160;/////////////////////////////////////////
private final int fixedWidth = fixedSize;
private final int fixedHeight = fixedSize;
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
private boolean selected;
private Position start;
private Position end;
private final KartePane kartePane;
public SchemaHolder(KartePane kartePane, SchemaModel schema) {
this.kartePane = kartePane;
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// Junzo SATO
// for simplicity, the acpect ratio of the fixed rect is set to 1.
this.setDoubleBuffered(false);
this.setOpaque(true);
this.setBackground(Color.white);
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
this.schema = schema;
//this.setImageIcon(schema.getIcon());
setIcon(adjustImageSize(schema.getIcon(), new Dimension(fixedWidth, fixedHeight)));
}
KarteViewer.java (client project)
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// Junzo SATO
public void printPanel2(final PageFormat format) {
String name = getContext().getPatient().getFullName();
boolean printName = true;
if (pPane==null) {
printName = printName && Project.getBoolean("plain.print.patinet.name");
}
panel2.printPanel(format, 1, false, name, getActualHeight()+60, printName);
}
KarteEditor.java (client project)
/**
* Courtesy of Junzo SATO
*/
private byte[] getJPEGByte(Image image) {
byte[] ret = null;
try {
JPanel myPanel = getUI();
Dimension d = new Dimension(image.getWidth(myPanel), image.getHeight(myPanel));
BufferedImage bf = new BufferedImage(d.width, d.height, BufferedImage.TYPE_INT_RGB);
Graphics g = bf.getGraphics();
g.setColor(Color.white);
g.drawImage(image, 0, 0, d.width, d.height, myPanel);
ByteArrayOutputStream bo = new ByteArrayOutputStream();
ImageIO.write(bf, "jpeg", bo);
ret = bo.toByteArray();
} catch (IOException e) {
e.printStackTrace(System.err);
}
return ret;
}
// Module
ModuleModel soa = null;
ModuleModel p = null; // 20131206 add funabashi
if (model.getModules()!=null && model.getModules().size()>0) {
この箇所は OpenDolphin のデータ構造を決めているかなり基本的な部分です。
Junzo SATO 氏のコードにしても funabashi 氏のコードにしてもデータ構造のかなり基本的な部分に関与する部分で、基本設計のかなりの部分がこれまで公的には開発者としてアナウンスされていない人の手によるものであることが推測されます。
Kushiro 氏のコード
この方のコードもけっこうある。
一例を挙げておく。
DoseaseView.java (client project)
/**
*
* @author kushiro
*/
public class DiseaseView extends javax.swing.JPanel implements IDiseaseView {
/** Creates new form Baka */
public DiseaseView() {
initComponents();
}
/*
* Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Oracle or the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package open.dolphin.helper;
import javax.swing.*;
import javax.swing.SpringLayout;
import java.awt.*;
/**
* A 1.4 file that provides utility methods for
* creating form- or grid-style layouts with SpringLayout.
* These utilities are used by several programs, such as
* SpringBox and SpringCompactGrid.
*/
public class SpringUtilities {
/**
* A debugging utility that prints to stdout the component's
* minimum, preferred, and maximum sizes.
*/
public static void printSizes(Component c) {
System.out.println("minimumSize = " + c.getMinimumSize());
System.out.println("preferredSize = " + c.getPreferredSize());
System.out.println("maximumSize = " + c.getMaximumSize());
}
上で「サーバー-クライアント間の通信は API を介して行われている」と書いたが、オープンソースである以上、通信を行う際の URI は特定されており、この点がサイバー攻撃の格好の対象になってしまう。
ローカルで使っている分にはこれは致命的な欠点にはならないが、商用利用されているクラウド型ではサーバの位置(URL)が特定されてしまうと、不特定多数からの攻撃をピンポイントで受けるリスクが生じる。
(商用利用のサーバの URL が公開されていないのはおそらくこれが理由)