Skip to content

Commit

Permalink
Add option on using logic of nomadhelper when user clicking on collap…
Browse files Browse the repository at this point in the history
…sible button in Installed section

(reference #53)
  • Loading branch information
piotrzarzycki21 committed Apr 23, 2024
1 parent ddec6b9 commit ff996d4
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ package mediator.applications
view.seeMoreDetails["text"] = "App details";
view.appDescription = "No description";
cleanUpInstalledAppLinks();

this.genesisAppsProxy = null;
}

Expand Down Expand Up @@ -141,7 +141,13 @@ package mediator.applications
var linkWithDescription:LinkWithDescriptionAppButton = new LinkWithDescriptionAppButton();
linkWithDescription.description = link.description;
linkWithDescription.linkLabel = urlOpenDefault;
linkWithDescription.nomadURL = link.nomadURL;
linkWithDescription.appName = link.name;
linkWithDescription.addEventListener("showClick", onShowHideDbConfigClick);
if (link.defaultAction == "nomad")
{
linkWithDescription.addEventListener("linkClick", onOpenInNomadLink);
}

dbContainer.addElement(linkWithDescription);

Expand All @@ -161,7 +167,7 @@ package mediator.applications

view.installedAppLinks.addElement(dbContainer);

configurationDetails.openInNomad.addEventListener(MouseEvent.CLICK, onOpenNomadWeb);
configurationDetails.openInNomad.addEventListener(MouseEvent.CLICK, onOpenInNomadConfig);
}
}
}
Expand All @@ -187,12 +193,13 @@ package mediator.applications
if (internalItem)
{
internalItem.removeEventListener("showClick", onShowHideDbConfigClick);
internalItem.removeEventListener("linkClick", onOpenInNomadLink);
}

var confItem:Object = linkItem as ConfigurationAppDetails;
if (confItem)
{
confItem.openInNomad.removeEventListener(MouseEvent.CLICK, onOpenNomadWeb);
confItem.openInNomad.removeEventListener(MouseEvent.CLICK, onOpenInNomadConfig);
}
}

Expand All @@ -215,7 +222,14 @@ package mediator.applications
}
}

private function onOpenNomadWeb(event:Event):void
private function onOpenInNomadLink(event:Event):void
{
var link:LinkWithDescriptionAppButton = event.currentTarget as LinkWithDescriptionAppButton;

sendNotification(ApplicationConstants.COMMAND_LAUNCH_NOMAD_LINK, {name: link.appName, link: link.nomadURL});
}

private function onOpenInNomadConfig(event:Event):void
{
event.preventDefault();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,22 @@
</j:beads>
<fx:Metadata>
[Event(name="showClick", type="org.apache.royale.events.Event")]
[Event(name="linkClick", type="org.apache.royale.event.Event")]
</fx:Metadata>
<fx:Script>
<![CDATA[
import org.apache.royale.events.MouseEvent;
[Bindable]
public var description:String;
[Bindable]
public var linkLabel:String;
public var nomadURL:String;
public var appName:String;
private var _show:Boolean;
public function get show():Boolean
Expand All @@ -38,11 +45,19 @@
}
this.dispatchEvent(new Event("showClick"));
}
private function onLinkClick(event:MouseEvent):void
{
event.preventDefault();
this.dispatchEvent(new Event("linkClick"));
}
]]>
</fx:Script>
<j:HGroup gap="1" itemsVerticalAlign="itemsCenter" className="bookmarkTitleContainer"
minHeight="40" width="220">
<j:Label localId="defaultOpenUrl" html="{linkLabel}" multiline="true" percentWidth="85" className="cursorPointer noLinkWhiteLabelStyle">
<j:Label localId="defaultOpenUrl" html="{linkLabel}" multiline="true" percentWidth="85" className="cursorPointer noLinkWhiteLabelStyle"
click="onLinkClick(event)">
<j:style>
<js:SimpleCSSStyles padding="5"/>
</j:style>
Expand Down

0 comments on commit ff996d4

Please sign in to comment.