Package net.laubenberger.tyr

Source Code of net.laubenberger.tyr.Tyr

/*
* Copyright (c) 2010-2012 by Stefan Laubenberger.
*
* Tyr is free software: you can redistribute it and/or modify
* it under the terms of the General Public License v2.0.
*
* Tyr is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See the GNU General Public License for more details:
* <http://www.gnu.org/licenses>
*
* This distribution is available at:
* <http://code.google.com/p/tyr/>
* <http://dev.laubenberger.net/tyr/>
*
* Contact information:
* Stefan Laubenberger
* Bullingerstrasse 53
* CH-8004 Zuerich
*
* <http://www.laubenberger.net>
*
* <laubenberger@gmail.com>
*/
package net.laubenberger.tyr;

import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.UUID;

import javax.swing.SwingUtilities;
import javax.swing.ToolTipManager;

import net.laubenberger.bogatyr.helper.HelperString;
import net.laubenberger.bogatyr.helper.HelperTime;
import net.laubenberger.bogatyr.misc.Constants;
import net.laubenberger.bogatyr.model.application.ModelApplication;
import net.laubenberger.bogatyr.model.application.ModelApplicationImpl;
import net.laubenberger.bogatyr.model.misc.Language;
import net.laubenberger.bogatyr.service.localizer.EncodingControl;
import net.laubenberger.bogatyr.service.localizer.LocalizerFile;
import net.laubenberger.bogatyr.service.property.PropertyImpl;
import net.laubenberger.tyr.controller.ControllerTyrImpl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Tyr main application.
*
* @author Stefan Laubenberger
* @version 0.9.1 (20110531)
* @since 0.0.1
*/
public final class Tyr {
  static final Logger log = LoggerFactory.getLogger(Tyr.class);

  // Properties
  private static final String PROPERTY_LOCALIZER_BASE = "localizer.base"; //$NON-NLS-1$

  // Constants
  private static final String PROPERTY_FILE_NAME = "standard.properties"; //$NON-NLS-1$

  // Members
  static final ModelApplication MODEL;

  static {
    MODEL = new ModelApplicationImpl();
    MODEL.setName("Tyr"); //$NON-NLS-1$
    MODEL.setVersion(new BigDecimal("0.91")); //$NON-NLS-1$
    MODEL.setBuild(247);
    MODEL.setCreated(HelperTime.getDate(2012, 5, 31, 8, 33, 0));
    MODEL.setLanguage(Language.ENGLISH);
    MODEL.setUUID(UUID.fromString("11a525c1-f4ab-4ecc-96a6-f462cccc7505")); //$NON-NLS-1$
    MODEL.addPerson(Constants.BOGATYR.getPersons().get(0)); //hopefully it's me :-)

    final File properties = new File(PROPERTY_FILE_NAME);
    try {
      MODEL.setUrl(new URL("http://dev.laubenberger.net/")); //$NON-NLS-1$
      //      MODEL.setUpdateLocation(new URL("file://User/slaubenberger/Desktop/tyr_update.xml")); //$NON-NLS-1$
      MODEL.setProperty(new PropertyImpl(properties));
    } catch (MalformedURLException ex) {
      // should never happen!
      log.error("URL invalid", ex); //$NON-NLS-1$
    } catch (IOException ex) {
      log.error("Could not process the property file " + HelperString.quote(properties.getAbsolutePath()), ex); //$NON-NLS-1$
      System.exit(10);
    }

    MODEL.setLocalizer(new LocalizerFile(MODEL.getProperty().getValue(PROPERTY_LOCALIZER_BASE), ClassLoader.getSystemClassLoader(), new EncodingControl()));

    // ToolTip settings
    ToolTipManager.sharedInstance().setInitialDelay(1500);
    ToolTipManager.sharedInstance().setDismissDelay(Integer.MAX_VALUE);

  }

  public static void main(final String[] args) {
    final Runnable ctt = new ControllerTyrImpl(MODEL);

    // System.err.println(url);
    SwingUtilities.invokeLater(ctt);
  }
}
TOP

Related Classes of net.laubenberger.tyr.Tyr

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.