// ---------------------------------------------------------------------------
// This file has been generated by the Web Dynpro Code Generator
// DON'T MODIFY!!! CHANGES WILL BE LOST WHENEVER THE FILE GETS GENERATED AGAIN
// ---------------------------------------------------------------------------
package uwl.rss.subscriptions.ui.wdp;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import com.sap.tc.logging.Location;
import com.sap.tc.webdynpro.progmodel.api.*;
import com.sap.tc.webdynpro.progmodel.gci.*;
import com.sap.tc.webdynpro.progmodel.context.*;
import com.sap.tc.webdynpro.progmodel.gci.*;
import com.sap.tc.webdynpro.services.exceptions.WDRuntimeException;

public class InternalRssSubscriptionsView
  implements IPrivateRssSubscriptionsView, com.sap.tc.webdynpro.progmodel.gci.IGCIViewDelegate
{

  /**
   * Location for this controller.
   */
  private static final Location logger = Location.getLocation(InternalRssSubscriptionsView.class);

  /**
   * Framework implementation of Controller that delegates to this.
   */
  private final com.sap.tc.webdynpro.progmodel.gci.IGCIView wdAlterEgo;

  /**
   * Delegate that implements application defined logic
   */
  private final uwl.rss.subscriptions.ui.RssSubscriptionsView delegate;


  // ---- Context --------------------------------------------------------------

  IGCINodeInfo infoSubscriptions;
  IGCINodeInfo infoContext;

  {

    infoSubscriptions = GCIContext.createNode("Subscriptions", null, true, false, true, false, true, true, null,
      new IGCIAttributeInfo[] {
        GCIContext.createAttribute("url", "ddic:com.sap.dictionary.string", null, null, false, false),
        GCIContext.createAttribute("title", "ddic:com.sap.dictionary.string", null, null, false, false),
        GCIContext.createAttribute("disabled", "ddic:com.sap.dictionary.boolean", null, null, false, false),
        GCIContext.createAttribute("statusImage", "ddic:com.sap.dictionary.string", null, null, false, false),
        GCIContext.createAttribute("statusText", "ddic:com.sap.dictionary.string", null, null, false, false),
      },
      (IGCINodeInfo[])null // no child nodes
    );

    infoContext = GCIContext.createNode("Context", null, true, true, false, true, false, true, null,
      (IGCIAttributeInfo[])null, // no attributes
      new IGCINodeInfo[] {
        infoSubscriptions,
      }
    );

  }
  
  private IContextNode contextNode;

  private void wdInitContextNode() {
    contextNode = new IContextNode(this, infoContext, (Node)null);
  }

  public IWDNode wdGetRootNode() {
    return contextNode;
  }

  public IContextNode wdGetContext() {
    return contextNode;
  }


  // ---- Actions --------------------------------------------------------------

  /**
   * Returns the action with name <code>Save</code>.
   */
  public IWDAction wdGetSaveAction() {
    return wdAlterEgo.getAction("Save");
  }

  /**
   * Returns the action with name <code>Delete</code>.
   */
  public IWDAction wdGetDeleteAction() {
    return wdAlterEgo.getAction("Delete");
  }

  /**
   * Returns the action with name <code>TestUrl</code>.
   */
  public IWDAction wdGetTestUrlAction() {
    return wdAlterEgo.getAction("TestUrl");
  }

  /**
   * Create a new action for this controller. A unique name for the action is generated automatially.
   * @param eventHandler is the action's eventhandler with proper signature
   * @param text is the text displayed in the UI element triggering this action
   */
  public IWDAction wdCreateAction(WDActionEventHandler eventHandler, String text) {
    return wdAlterEgo.createAction(null, eventHandler, text, null);
  }

  /**
   * Create a new action with the given name for this controller
   * @param eventHandler is the action's eventhandler with proper signature
   * @param name is the action's name
   * @param text is the text displayed in the UI element triggering this action
   */
  public IWDAction wdCreateNamedAction(WDActionEventHandler eventHandler, String name, String text) {
    return wdAlterEgo.createAction(name, eventHandler, text, null);
  }

  // ---- Controller part ------------------------------------------------------

  /**
   * Creates a new instance of this controller.
   */
  public InternalRssSubscriptionsView(com.sap.tc.webdynpro.progmodel.gci.IGCIView alterEgo) {
    this.wdAlterEgo = alterEgo;
    wdInitContextNode();
    this.delegate = new uwl.rss.subscriptions.ui.RssSubscriptionsView((IPrivateRssSubscriptionsView) this);
    wdAlterEgo.createAction("Save", WDActionEventHandler.SAVE, "", "");
    wdAlterEgo.createAction("Delete", WDActionEventHandler.DELETE, "", "");
    wdAlterEgo.createAction("TestUrl", WDActionEventHandler.TEST_URL, "", "");
  }

  /**
   * Returns the public API for this controller instance.
   */
  public com.sap.tc.webdynpro.progmodel.api.IWDViewController wdGetAPI() {
    return (com.sap.tc.webdynpro.progmodel.api.IWDViewController) wdAlterEgo;
  }

  /**
   * Hook method called to initialize view controller.
   */
  public void wdDoInit() {
    logger.pathT("entering: wdDoInit");
    delegate.wdDoInit();
    logger.pathT("exiting: wdDoInit"); 
  }

  /**
   * Hook method called to clean up view controller.
   */
  public void wdDoExit() {
    logger.pathT("entering: wdDoExit");
    delegate.wdDoExit();
    logger.pathT("exiting: wdDoExit"); 
  }

  public Object wdInvokeEventHandler(String handlerName, IWDCustomEvent event)
    throws NoSuchMethodException {
    
    logger.pathT("entering: wdInvokeEventHandler", new Object[] { handlerName } );
    try {
      if("onActionSave".equals(handlerName)) {

        delegate.onActionSave(event );
        return null;
      }
      if("onActionDelete".equals(handlerName)) {

        delegate.onActionDelete(event );
        return null;
      }
      if("onActionTestUrl".equals(handlerName)) {

        delegate.onActionTestUrl(event );
        return null;
      }
      throw new NoSuchMethodException("Eventhandler " + handlerName + " not found for event " + event.getName());
    } finally {
      logger.pathT("exiting: wdInvokeEventHandler"); 
    }
  }

  public void onActionSave(IWDCustomEvent wdEvent ) {
    delegate.onActionSave(wdEvent );
  }

  public void onActionDelete(IWDCustomEvent wdEvent ) {
    delegate.onActionDelete(wdEvent );
  }

  public void onActionTestUrl(IWDCustomEvent wdEvent ) {
    delegate.onActionTestUrl(wdEvent );
  }

  /** outgoing controller usage */
  public uwl.rss.subscriptions.ui.wdp.IPublicRssSubscriptionsInterface wdGetRssSubscriptionsInterfaceController() {
    return
      (uwl.rss.subscriptions.ui.wdp.IPublicRssSubscriptionsInterface)
        wdAlterEgo
          .getComponentGCI()
            .getPublicInterface("RssSubscriptionsInterface");
  }

  /** outgoing controller usage */
  public uwl.rss.subscriptions.ui.wdp.IPublicRssSubscriptionsInterfaceView wdGetRssSubscriptionsInterfaceViewController() {
    return
      (uwl.rss.subscriptions.ui.wdp.IPublicRssSubscriptionsInterfaceView)
        wdAlterEgo
          .getComponentGCI()
            .getPublicInterface("RssSubscriptionsInterfaceView");
  }

  /** outgoing controller usage */
  public uwl.rss.subscriptions.ui.wdp.IPublicRssSubscriptions wdGetRssSubscriptionsController() {
    return
      (uwl.rss.subscriptions.ui.wdp.IPublicRssSubscriptions)
        wdAlterEgo
          .getComponentGCI()
            .getPublicInterface("RssSubscriptions");
  }


  // ---- UI Tree ---------------------------------------------------------

  // create UI tree
  public com.sap.tc.webdynpro.progmodel.api.IWDViewElement wdCreateUITree()
  {

    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTransparentContainer _RootUIElementContainer
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTransparentContainer)
        wdAlterEgo.createElement(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTransparentContainer.class,
          "RootUIElementContainer");  
    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDGridLayout _RootUIElementContainer__Layout
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDGridLayout)
        _RootUIElementContainer.createLayout(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDGridLayout.class);

    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTextView _DefaultTextView
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTextView)
        wdAlterEgo.createElement(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTextView.class,
          "DefaultTextView");  
    _DefaultTextView.setDesign(com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDTextViewDesign.valueOf("header3"));
    _DefaultTextView.setText(wdAlterEgo.getLocalizedText("view.RssSubscriptionsView.DefaultTextView.text"));
    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDGridData _DefaultTextView__LayoutData
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDGridData)
        _DefaultTextView.createLayoutData(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDGridData.class);
    _RootUIElementContainer.addChild(_DefaultTextView);

    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTable _tblRssSubscriptions
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTable)
        wdAlterEgo.createElement(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTable.class,
          "tblRssSubscriptions");  
    _tblRssSubscriptions.setSelectionMode(com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDTableSelectionMode.valueOf("multi"));
    _tblRssSubscriptions.setWidth("75%");
    _tblRssSubscriptions.bindDataSource("Subscriptions");
    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDGridData _tblRssSubscriptions__LayoutData
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDGridData)
        _tblRssSubscriptions.createLayoutData(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDGridData.class);

    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTableColumn _URL
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTableColumn)
        wdAlterEgo.createElement(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTableColumn.class,
          "URL");  
    _URL.setWidth("60%");

    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDCaption _URL_header
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDCaption)
        wdAlterEgo.createElement(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDCaption.class,
          "URL_header");  
    _URL_header.setText(wdAlterEgo.getLocalizedText("view.RssSubscriptionsView.tblRssSubscriptions.Column.URL.Header.text"));
    _URL.setHeader(_URL_header);

    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDInputField _URL_editor
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDInputField)
        wdAlterEgo.createElement(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDInputField.class,
          "URL_editor");  
    _URL_editor.bindValue("Subscriptions.url");
    _URL.setTableCellEditor(_URL_editor);
    _tblRssSubscriptions.addColumn(_URL);

    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTableColumn _Title
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTableColumn)
        wdAlterEgo.createElement(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTableColumn.class,
          "Title");  
    _Title.setWidth("30%");

    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDCaption _Title_header
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDCaption)
        wdAlterEgo.createElement(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDCaption.class,
          "Title_header");  
    _Title_header.setText(wdAlterEgo.getLocalizedText("view.RssSubscriptionsView.tblRssSubscriptions.Column.Title.Header.text"));
    _Title.setHeader(_Title_header);

    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDInputField _Title_editor
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDInputField)
        wdAlterEgo.createElement(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDInputField.class,
          "Title_editor");  
    _Title_editor.bindValue("Subscriptions.title");
    _Title.setTableCellEditor(_Title_editor);
    _tblRssSubscriptions.addColumn(_Title);

    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTableColumn _Disable
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTableColumn)
        wdAlterEgo.createElement(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTableColumn.class,
          "Disable");  
    _Disable.setWidth("5%");

    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDCaption _Disable_header1
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDCaption)
        wdAlterEgo.createElement(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDCaption.class,
          "Disable_header1");  
    _Disable_header1.setText(wdAlterEgo.getLocalizedText("view.RssSubscriptionsView.tblRssSubscriptions.Column.Disable.Header.text"));
    _Disable.setHeader(_Disable_header1);

    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDCheckBox _chkDisable
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDCheckBox)
        wdAlterEgo.createElement(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDCheckBox.class,
          "chkDisable");  
    _chkDisable.bindChecked("Subscriptions.disabled");
    _Disable.setTableCellEditor(_chkDisable);
    _tblRssSubscriptions.addColumn(_Disable);

    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTableColumn _Status
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTableColumn)
        wdAlterEgo.createElement(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTableColumn.class,
          "Status");  
    _Status.setWidth("5%");

    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDCaption _Status_header1
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDCaption)
        wdAlterEgo.createElement(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDCaption.class,
          "Status_header1");  
    _Status_header1.setText(wdAlterEgo.getLocalizedText("view.RssSubscriptionsView.tblRssSubscriptions.Column.Status.Header.text"));
    _Status.setHeader(_Status_header1);

    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDImage _imgStatus
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDImage)
        wdAlterEgo.createElement(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDImage.class,
          "imgStatus");  
    _imgStatus.bindTooltip("Subscriptions.statusText");
    _imgStatus.bindAlt("Subscriptions.statusText");
    _imgStatus.bindSource("Subscriptions.statusImage");
    _Status.setTableCellEditor(_imgStatus);
    _tblRssSubscriptions.addColumn(_Status);
    _RootUIElementContainer.addChild(_tblRssSubscriptions);
    _RootUIElementContainer.addChild(wdCreateUITreeForTransparentContainer1());
    return (_RootUIElementContainer);
  }

  // create UI tree for TransparentContainer1
  private com.sap.tc.webdynpro.progmodel.api.IWDUIElement wdCreateUITreeForTransparentContainer1()
  {

    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTransparentContainer _TransparentContainer1
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTransparentContainer)
        wdAlterEgo.createElement(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTransparentContainer.class,
          "TransparentContainer1");  
    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDGridData _TransparentContainer1__LayoutData
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDGridData)
        _TransparentContainer1.createLayoutData(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDGridData.class);
    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDFlowLayout _TransparentContainer1__Layout
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDFlowLayout)
        _TransparentContainer1.createLayout(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDFlowLayout.class);

    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDButton _btnSave
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDButton)
        wdAlterEgo.createElement(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDButton.class,
          "btnSave");  
    _btnSave.setText(wdAlterEgo.getLocalizedText("view.RssSubscriptionsView.TransparentContainer1.btnSave.text"));
    _btnSave.setImageSource("");
    _btnSave.setOnAction(wdAlterEgo.getAction("Save"));
    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDFlowData _btnSave__LayoutData
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDFlowData)
        _btnSave.createLayoutData(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDFlowData.class);
    _TransparentContainer1.addChild(_btnSave);

    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDButton _btnDelete
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDButton)
        wdAlterEgo.createElement(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDButton.class,
          "btnDelete");  
    _btnDelete.setText(wdAlterEgo.getLocalizedText("view.RssSubscriptionsView.TransparentContainer1.btnDelete.text"));
    _btnDelete.setOnAction(wdAlterEgo.getAction("Delete"));
    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDFlowData _btnDelete__LayoutData
      = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDFlowData)
        _btnDelete.createLayoutData(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDFlowData.class);
    _TransparentContainer1.addChild(_btnDelete);
    return (_TransparentContainer1);
  }
  

  /**
   * Hook method called to modify view before rendering. Access to UI elements
   * is via the given view API only!
   * 
   * @param firstTime indicates whether the hook is called for the first time
   * during the lifetime of this view
   */
  public void wdDoModifyView(IWDView view, boolean firstTime) {
    logger.pathT("entering: doModifyView");
    uwl.rss.subscriptions.ui.RssSubscriptionsView.wdDoModifyView((IPrivateRssSubscriptionsView) this, (IPrivateRssSubscriptionsView.IContextNode) this.wdGetContext(), view, firstTime);
    logger.pathT("exiting: doModifyView"); 
  }


}
