-------------------------------------------------------------------------------- -- Title: LWBrowserPage.lua -- Description: Like a square peg in a round hole -- Author: Raphaël Szwarc http://alt.textdrive.com/lua/ -- Creation Date: February 1, 2005 -- Legal: Copyright (C) 2005 Raphaël Szwarc -------------------------------------------------------------------------------- -- import dependencies local LWComponent = require( "LWComponent" ) local LFSFile = require( "LFSFile" ) local LUList = require( "LUList" ) local LUMap = require( "LUMap" ) -- define the class local super = LWComponent local self = super() -- method to access this component object function self:object() return self:bindings():get( "object" ) end -- method to access this component objects function self:objects() local someObjects = LUList() local aPath = self:object():path() local someNames = self:object():list() for anIndex, aName in someNames:iterator() do local aFile = LFSFile( aPath, aName ) someObjects:add( aFile ) end return someObjects end -- method to access this component table function self:table() local someBindings = LUMap() someBindings:put( "objects", self:objects() ) someBindings:put( "keysDescription", "name|size" ) local aComponent = LWTable( self:context(), self, someBindings ) return aComponent end -- method for string representation function self:toString() local aTemplate = self:template() aTemplate:put( "table", self:table() ) return aTemplate:toString() end return self