Package org.zkoss.zats.mimic.impl
Class DefaultDesktopAgent
- java.lang.Object
-
- org.zkoss.zats.mimic.impl.DefaultDesktopAgent
-
- All Implemented Interfaces:
Agent,DesktopAgent,DesktopCtrl,QueryAgent
public class DefaultDesktopAgent extends Object implements DesktopAgent, DesktopCtrl
Default implementation fof DesktopAgent.- Author:
- dennis
-
-
Constructor Summary
Constructors Constructor Description DefaultDesktopAgent(Client client, org.zkoss.zk.ui.Desktop desktop)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendZkLog(String message)Append a debug message of AuLog to current desktop.<T> Tas(Class<T> clazz)Try to get a instance of target class for this query agent, the target class is usually aOperationAgentor a nativeComponent
if it cannot get a instance of target class, it will throwAgentException.voiddestroy()destroy this desktop.booleanequals(Object obj)ObjectgetAttribute(String name)get attribute by specify name.ClientgetClient()get client this agent belonged to.ObjectgetDelegatee()get the delegatee objectorg.zkoss.zk.ui.DesktopgetDesktop()Get the attachedDesktopinstance.ResourcegetDownloadable()Get the current downloadable resource.StringgetId()get ID.List<PageAgent>getPages()get pages in this desktopStringgetType()List<String>getZkLog()Gets theClients.logresults.inthashCode()<T> booleanis(Class<T> clazz)Can get a instance of target class for this query agent.ComponentAgentquery(String selector)to find the first component agent with the selector in this query agent.List<ComponentAgent>queryAll(String selector)to find the component agents with the selector in this query agent.voidsetDownloadable(Resource downloadable)setting current downloadable file.StringtoString()
-
-
-
Constructor Detail
-
DefaultDesktopAgent
public DefaultDesktopAgent(Client client, org.zkoss.zk.ui.Desktop desktop)
-
-
Method Detail
-
getId
public String getId()
Description copied from interface:DesktopAgentget ID. of this the desktop.- Specified by:
getIdin interfaceDesktopAgent- Returns:
- ID or null if it hasn't.
-
getType
public String getType()
-
getAttribute
public Object getAttribute(String name)
Description copied from interface:DesktopAgentget attribute by specify name.- Specified by:
getAttributein interfaceDesktopAgent- Parameters:
name- attribute name.- Returns:
- attribute value or null if not found or otherwise.
-
getClient
public Client getClient()
Description copied from interface:Agentget client this agent belonged to.
-
getPages
public List<PageAgent> getPages()
Description copied from interface:DesktopAgentget pages in this desktop- Specified by:
getPagesin interfaceDesktopAgent
-
getDesktop
public org.zkoss.zk.ui.Desktop getDesktop()
Description copied from interface:DesktopAgentGet the attachedDesktopinstance.- Specified by:
getDesktopin interfaceDesktopAgent- Returns:
- the attached
Desktopinstance.
-
getDelegatee
public Object getDelegatee()
Description copied from interface:Agentget the delegatee object- Specified by:
getDelegateein interfaceAgent
-
query
public ComponentAgent query(String selector)
Description copied from interface:QueryAgentto find the first component agent with the selector in this query agent.- Specified by:
queryin interfaceQueryAgent- Parameters:
selector- the selector- Returns:
- the first component agent, null if not found
-
queryAll
public List<ComponentAgent> queryAll(String selector)
Description copied from interface:QueryAgentto find the component agents with the selector in this query agent.- Specified by:
queryAllin interfaceQueryAgent- Parameters:
selector- the selector- Returns:
- the component agents
-
destroy
public void destroy()
Description copied from interface:DesktopAgentdestroy this desktop.- Specified by:
destroyin interfaceDesktopAgent
-
as
public <T> T as(Class<T> clazz)
Description copied from interface:QueryAgentTry to get a instance of target class for this query agent, the target class is usually aOperationAgentor a nativeComponent
if it cannot get a instance of target class, it will throwAgentException.- Specified by:
asin interfaceQueryAgent- Parameters:
clazz- class of specify operation.- Returns:
- operation object.
-
is
public <T> boolean is(Class<T> clazz)
Description copied from interface:QueryAgentCan get a instance of target class for this query agent.- Specified by:
isin interfaceQueryAgent- Parameters:
clazz- the class cast to.- Returns:
- true if can get a instance of target class
-
setDownloadable
public void setDownloadable(Resource downloadable)
Description copied from interface:DesktopCtrlsetting current downloadable file.- Specified by:
setDownloadablein interfaceDesktopCtrl- Parameters:
downloadable- a downloadable resouce or null indicated there is no downloadable currently.
-
getDownloadable
public Resource getDownloadable()
Description copied from interface:DesktopAgentGet the current downloadable resource.- Specified by:
getDownloadablein interfaceDesktopAgent- Returns:
- downloadable resource or null if there is no such resource.
-
getZkLog
public List<String> getZkLog()
Description copied from interface:DesktopAgentGets theClients.logresults.- Specified by:
getZkLogin interfaceDesktopAgent- Returns:
- Messages. An empty list if no message.
-
appendZkLog
public void appendZkLog(String message)
Description copied from interface:DesktopCtrlAppend a debug message of AuLog to current desktop.- Specified by:
appendZkLogin interfaceDesktopCtrl- Parameters:
message- a message.
-
-