Package org.lorikeet.xamlTranslators

Source Code of org.lorikeet.xamlTranslators.JFrameTranslator

/*
* Lorikeet - XAML parser and rendering translators for Java
* Copyright (C) 2012 Patrick Plenefisch
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
package org.lorikeet.xamlTranslators;

import javax.swing.JFrame;
import javax.swing.UIManager;
import org.lorikeet.LObject;
import org.lorikeet.LWindow;
import org.lorikeet.XamlObject;
import org.lorikeet.xamlTranslators.impl.jframe.JFrameListener;
import org.lorikeet.xamlTranslators.impl.jframe.JXApp;
import org.lorikeet.xamlTranslators.impl.jframe.TheMagicOne;

/**
*
* @author patrick
*/
public class JFrameTranslator extends Translator
{
  XamlObject root;
  LObject loroot;
  JXApp jxapp;

  public JFrameTranslator()
  {
    try
    {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e)
    {
      System.out.println("Error setting native LAF: " + e);
    }
  }

  @Override
  public void Load(XamlObject root, LWindow rootWindow)
  {
    this.root = root;
    //TODO: verify root only has one child
    jxapp = new JXApp();
    loroot = jxapp.parse(root, new TheMagicOne(rootWindow));
  }

  @Override
  public void Show()
  {
    loroot.set("Visible",true);
  }

  @Override
  public void Hide()
  {
    loroot.set("Visible",true);
  }
 
  @Override
  public void Refresh()
  {
    //TOOD: loroot.pack();
  }

  @Override
  public LObject getRoot()
  {
    return loroot;
  }
 
}
TOP

Related Classes of org.lorikeet.xamlTranslators.JFrameTranslator

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.