001 /** 002 * Copyright (c) 2003 Daffodil Software Ltd all rights reserved, 003 * Modifications Copyright (c) 2008 Regiscope Digital Imaging Co, LLC, All rights reserved. 004 * This program is free software; you can redistribute it and/or modify 005 * it under the terms of version 2 of the GNU General Public License as 006 * published by the Free Software Foundation. 007 * There are special exceptions to the terms and conditions of the GPL 008 * as it is applied to this software. See the GNU General Public License for more details. 009 * 010 * This program is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU General Public License for more details. 014 * 015 * You should have received a copy of the GNU General Public License 016 * along with this program; if not, write to the Free Software 017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 018 */ 019 020 package org.dbreplicator.repconsole; 021 022 import java.awt.*; 023 import javax.swing.*; 024 import javax.swing.border.*; 025 import org.dbreplicator.replication.RepException; 026 027 /** 028 * This is the starter class for replicator. User should run this class to 029 * start replication server both on publisher and subscriber end. 030 * 031 */ 032 public class StartServer extends JWindow 033 { 034 035 static boolean packFrame = false; 036 037 public StartServer() 038 { 039 super(); 040 ImageIcon img = new ImageIcon( (getClass().getResource( 041 //"/icons/daffodilreplicator.gif"))); 042 "/icons/dbreplicator.gif"))); 043 JPanel pan = new JPanel(); 044 //pan.setBorder(new LineBorder(Color.GRAY)); 045 JLabel b = new JLabel(img); 046 pan.add(b, BorderLayout.CENTER); 047 pan.setBackground(Color.BLACK); 048 049 //pan.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED, 050 // Color.GRAY, Color.GRAY)); 051 setBounds( (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth() - 052 img.getIconWidth()) / 2, 053 (int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight() - 054 //img.getIconHeight()) / 2, img.getIconWidth() + 2, 055 img.getIconHeight()) / 2, img.getIconWidth(), 056 img.getIconHeight() + 10); 057 getContentPane().add(pan, BorderLayout.CENTER); 058 } 059 060 public static void main(String[] args) throws RepException { 061 if(args.length<1){ 062 throw new RepException("REP008",null); 063 } 064 StartServer sw = new StartServer(); 065 sw.Show(); 066 try 067 { 068 Thread.sleep(2000); 069 UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); 070 // StartRepServer frame = new StartRepServer(sw); 071 StartRepServer frame = new StartRepServer(sw,args[0]); 072 if (packFrame) 073 { 074 frame.pack(); 075 } 076 else 077 { 078 frame.validate(); 079 } 080 //Center the window 081 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 082 Dimension frameSize = frame.getSize(); 083 if (frameSize.height > screenSize.height) 084 { 085 frameSize.height = screenSize.height; 086 } 087 if (frameSize.width > screenSize.width) 088 { 089 frameSize.width = screenSize.width; 090 } 091 frame.setResizable(false); 092 frame.setBounds( (screenSize.width - frameSize.width) / 2, 093 (screenSize.height - frameSize.height) / 2, 520, 370); 094 frame.setVisible(true); 095 } 096 catch (Exception ex) 097 { 098 // ex.printStackTrace(); 099 100 } 101 } 102 103 public void Show() 104 { 105 super.show(); 106 } 107 108 public void Dispose() 109 { 110 super.dispose(); 111 } 112 }

