Skip to content

Instantly share code, notes, and snippets.

@jyoung
Created March 13, 2018 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jyoung/a6cbfe707840b8ad3109b99608930913 to your computer and use it in GitHub Desktop.
Save jyoung/a6cbfe707840b8ad3109b99608930913 to your computer and use it in GitHub Desktop.
LANSA Tour Of Heroes Pt 2 Web Page
begin_com role(*EXTENDS #PRIM_WEB) layoutmanager(#MainPanelLayout) theme(#PrimaryTheme)
* =====================================================================================
* STYLES
* =====================================================================================
define_com class(#PRIM_VS.Style) name(#Style1) borderbottom(1) borderbrush(#Brush1) borderleft(1) borderright(1) bordertop(1)
define_com class(#PRIM_VS.SolidBrush) name(#Brush1) color(2:255:30)
* =====================================================================================
* LAYOUTS
* =====================================================================================
define_com class(#PRIM_TBLO) name(#MainPanelLayout)
define_com class(#PRIM_TBLO.Row) name(#LayoutRow1) displayposition(1) parent(#MainPanelLayout)
define_com class(#PRIM_TBLO.Column) name(#LayoutColumn1) displayposition(1) parent(#MainPanelLayout)
define_com class(#PRIM_TBLO.Item) name(#LayoutItem1) alignment(TopLeft) column(#LayoutColumn1) manage(#HeaderPanel) parent(#MainPanelLayout) row(#LayoutRow1) sizing(FitToWidth) flow(Down) marginleft(10)
define_com class(#PRIM_TBLO.Item) name(#LayoutItem2) alignment(TopLeft) column(#LayoutColumn1) manage(#NavigationBarPanel) parent(#MainPanelLayout) row(#LayoutRow1) sizing(FitToWidth) flow(Down) marginleft(10)
define_com class(#PRIM_TBLO.Item) name(#LayoutItem3) alignment(TopLeft) column(#LayoutColumn1) manage(#ViewContainerPanel) parent(#MainPanelLayout) row(#LayoutRow1) sizing(ContentHeightFitToWidth) flow(Down) marginleft(10)
define_com class(#PRIM_TBLO) name(#ViewContainerPanelLayout)
define_com class(#PRIM_TBLO.Column) name(#Column1) displayposition(1) parent(#ViewContainerPanelLayout)
define_com class(#PRIM_TBLO.Row) name(#Row1) displayposition(1) parent(#ViewContainerPanelLayout)
define_com class(#PRIM_TBLO.Item) name(#ViewContainerLayoutItem) alignment(TopLeft) column(#Column1) parent(#ViewContainerPanelLayout) row(#Row1) sizing(None)
* =====================================================================================
* UI COMPONENTS
* =====================================================================================
define_com class(#HeaderPanel) name(#HeaderPanel) parent(#COM_OWNER) tabstop(False) width(1190) left(10)
define_com class(#NavigationBarPanel) name(#NavigationBarPanel) displayposition(2) parent(#COM_OWNER) tabposition(2) tabstop(False) width(1190) top(65) height(50) left(10)
define_com class(#PRIM_PANL) name(#ViewContainerPanel) displayposition(3) parent(#COM_OWNER) tabposition(3) tabstop(False) top(115) width(1190) height(52) style(#Style1) layoutmanager(#ViewContainerPanelLayout)
* =====================================================================================
* VIEW PANELS
* =====================================================================================
define_com class(#DashboardViewPanel2) name(#DashboardPanel) parent(#ViewContainerPanel) visible(False) displayposition(2) tabposition(2)
define_com class(#HeroesViewPanel2) name(#HeroesPanel) parent(#ViewContainerPanel) visible(False)
define_com class(#HeroDetailViewPanel2) name(#HeroDetailPanel) displayposition(3) parent(#ViewContainerPanel) visible(False) tabposition(3)
* =====================================================================================
* COMPONENTS
* =====================================================================================
define_com class(#ApplicationController) scope(*APPLICATION)
define_com class(#PRIM_ALPH) name(#mCurrentViewId)
define_com class(#PRIM_KCOL<#ViewPanel #STD_TEXTS>) name(#mViews) style(Collection)
* =====================================================================================
* ROUTINES
* =====================================================================================
evtroutine handling(#COM_OWNER.CreateInstance)
#mViews<TOHDSHP01> <= #DashboardPanel
#mViews<TOHHROP01> <= #HeroesPanel
#mViews<TOHHROP03> <= #HeroDetailPanel
endroutine
evtroutine handling(#SYS_WEB.URLChanged)
define_com class(#PRIM_ALPH) name(#lViewId)
#lViewId := #ApplicationController.GetURLParameter( VIEW ).UpperCase
#SYS_APPLN.TraceMessageText( ("URL Changed. View: &1").Substitute( #lViewId ) )
if (#lViewId = *BLANKS)
#lViewId := TOHDSHP01
endif
#COM_OWNER.ShowView( #lViewId )
endroutine
evtroutine handling(#NavigationBarPanel.Clicked) view(#pView)
#ApplicationController.NavigateTo( #pView )
endroutine
mthroutine name(ShowView)
define_map for(*INPUT) class(#PRIM_ALPH) name(#pViewId)
define_com class(#PRIM_ALPH) name(#lPreviousViewId)
if (#mViews<#pViewId> *Is *NULL)
#SYS_WEB.Alert( ("Missing &1").Substitute( #pViewId ) )
return
endif
#lPreviousViewId := #mCurrentViewId
#mCurrentViewId := #pViewId
#mViews<#mCurrentViewId>.Activate
if ((#mViews<#lPreviousViewId> *IsNot *NULL) *And (#mViews<#lPreviousViewId> *IsNotEqualTo #mViews<#mCurrentViewId>))
#mViews<#lPreviousViewId>.Deactivate
#COM_OWNER.Transition from(#mViews<#lPreviousViewId>) to(#mViews<#mCurrentViewId>) transitiontype(Fade) duration(100)
else
* no previous view to transition from, so just make the current view visible
#mViews<#mCurrentViewId>.Visible := True
endif
#ViewContainerLayoutItem.Manage <= #mViews<#mCurrentViewId>
#ViewContainerLayoutItem.Sizing := ContentHeightFitToWidth
endroutine
end_com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment