Package com.dragome.debugging.execution

Source Code of com.dragome.debugging.execution.DragomeVisualActivity

/*******************************************************************************
* Copyright (c) 2011-2014 Fernando Petrola
*
* This file is part of Dragome SDK.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
******************************************************************************/
package com.dragome.debugging.execution;

import com.dragome.model.VisualPanelImpl;
import com.dragome.model.interfaces.VisualPanel;
import com.dragome.remote.ServiceFactory;
import com.dragome.render.html.HTMLTemplateHandlingStrategy;
import com.dragome.services.ServiceLocator;
import com.dragome.services.interfaces.ParametersHandler;
import com.dragome.templates.interfaces.Template;

public abstract class DragomeVisualActivity implements VisualActivity
{
  protected TemplateHandlingStrategy templateHandlingStrategy= new HTMLTemplateHandlingStrategy();
  protected ServiceFactory serviceFactory= ServiceLocator.getInstance().getServiceFactory();
  protected ParametersHandler parametersHandler= ServiceLocator.getInstance().getParametersHandler();
  protected VisualPanel mainPanel;
  protected Template mainTemplate;

  public abstract void build();

  public VisualPanel getMainPanel()
  {
    return mainPanel;
  }

  public Template getMainTemplate()
  {
    return mainTemplate;
  }

  public ParametersHandler getParametersHandler()
  {
    return parametersHandler;
  }
  public ServiceFactory getServiceFactory()
  {
    return serviceFactory;
  }
  public TemplateHandlingStrategy getTemplateHandlingStrategy()
  {
    return templateHandlingStrategy;
  }

  public void initialize()
  {
  }

  protected void loadMainTemplate(String templateFilename)
  {
    templateHandlingStrategy.loadMainTemplate(templateFilename);
    //  templateHandlingStrategy.hideContainer();
    templateHandlingStrategy.setupContainer();
    updateMainPanel();
  }

  public void onCreate()
  {
    initialize();
    updateMainPanel();
    build();
    showTemplate();
  }

  public void onDestroy()
  {
  }

  public void onPause()
  {
  }

  public void onRestart()
  {
  }

  public void onResume()
  {
  }

  public void onStart()
  {
  }

  public void onStop()
  {
  }

  public void openPage(DragomeVisualActivity cardDetailsPage)
  {
    cardDetailsPage.onCreate();
  }

  protected void showTemplate()
  {
    templateHandlingStrategy.showContainer();
  }

  protected void hideTemplate()
  {
    templateHandlingStrategy.hideContainer();
  }

  protected void updateMainPanel()
  {
    mainTemplate= templateHandlingStrategy.getMainTemplate();
    mainPanel= new VisualPanelImpl(mainTemplate);
  }
}
TOP

Related Classes of com.dragome.debugging.execution.DragomeVisualActivity

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.