Skip to content

Commit

Permalink
Switching to default behaviour when Nomad is not open - it will just …
Browse files Browse the repository at this point in the history
…navigateToUrl

(reference #53)
  • Loading branch information
piotrzarzycki21 committed Apr 24, 2024
1 parent 7fd4675 commit 20d9150
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ package mediator
import org.puremvc.as3.multicore.interfaces.IMediator;
import org.puremvc.as3.multicore.interfaces.INotification;
import org.puremvc.as3.multicore.patterns.mediator.Mediator;
import model.vo.PopupVO;
import constants.PopupType;

public class MediatorMainContentView extends Mediator implements IMediator
{
Expand Down Expand Up @@ -101,7 +99,6 @@ package mediator
interests.push(ApplicationConstants.NOTE_OPEN_ADD_EDIT_GENESIS_DIR);
interests.push(ApplicationConstants.NOTE_OPEN_ADD_EDIT_BOOKMARK);
interests.push(ApplicationConstants.NOTE_OPEN_SELECTED_BOOKMARK_GROUP);
interests.push(ApplicationConstants.NOTE_FAILED_OPEN_NOMAD_LINK);

return interests;
}
Expand Down Expand Up @@ -164,9 +161,6 @@ package mediator
case ApplicationConstants.NOTE_OPEN_SELECTED_BOOKMARK_GROUP:
selectBookmarkGroup(String(note.getBody()));
break;
case ApplicationConstants.NOTE_FAILED_OPEN_NOMAD_LINK:
sendNotification(ApplicationConstants.COMMAND_SHOW_POPUP, new PopupVO(PopupType.ERROR, this.getMediatorName(), "Nomad Web is not running. " + String(note.getBody())));
break;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@ package mediator.applications

import view.applications.ConfigurationAppDetails;
import view.controls.LinkWithDescriptionAppButton;
import org.apache.royale.net.navigateToURL;
import org.apache.royale.net.URLRequest;

public class MediatorInstalledApps extends Mediator implements IMediator
{
public static const NAME:String = 'MediatorInstalledApp';

private var genesisAppsProxy:ProxyGenesisApps;
private var urlParamsProxy:ProxyUrlParameters;
private var currentNomadURL:String;

public function MediatorInstalledApps(mediatorName:String, component:IInstalledAppView)
{
Expand Down Expand Up @@ -55,15 +58,19 @@ package mediator.applications
override public function listNotificationInterests():Array
{
var interests:Array = super.listNotificationInterests();

interests.push(ApplicationConstants.NOTE_FAILED_OPEN_NOMAD_LINK);

return interests;
}

override public function handleNotification(note:INotification):void
{
switch (note.getName())
{

case ApplicationConstants.NOTE_FAILED_OPEN_NOMAD_LINK:
navigateToURL(new URLRequest(currentNomadURL));
currentNomadURL = null;
break;
}
}

Expand Down Expand Up @@ -225,6 +232,7 @@ package mediator.applications
private function onOpenInNomadLink(event:Event):void
{
var link:LinkWithDescriptionAppButton = event.currentTarget as LinkWithDescriptionAppButton;
currentNomadURL = link.nomadURL;

sendNotification(ApplicationConstants.COMMAND_LAUNCH_NOMAD_LINK, {name: link.appName, link: link.nomadURL});
}
Expand All @@ -235,6 +243,8 @@ package mediator.applications

var confView:ConfigurationAppDetails = event["nativeEvent"].currentTarget.royale_wrapper.parent.parent.parent as ConfigurationAppDetails;
var selectedApp:Object = confView.data;
currentNomadURL = selectedApp.nomadURL;

sendNotification(ApplicationConstants.COMMAND_LAUNCH_NOMAD_LINK, {name: selectedApp.database, link: selectedApp.nomadURL});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ package mediator.bookmarks
import view.applications.ConfigurationAppDetails;
import view.bookmarks.Bookmark;
import view.bookmarks.event.BookmarkEvent;
import org.apache.royale.net.navigateToURL;
import org.apache.royale.net.URLRequest;

public class MediatorBookmarks extends Mediator implements IMediator
{
Expand All @@ -34,6 +36,8 @@ package mediator.bookmarks
private var bookmarksProxy:ProxyBookmarks;
private var urlParamsProxy:ProxyUrlParameters;

private var currentNomadURL:String;

public function MediatorBookmarks(mediatorName:String, component:IBookmarksView)
{
super(mediatorName, component);
Expand Down Expand Up @@ -74,6 +78,7 @@ package mediator.bookmarks

cleanUpBookmarksList();
this.bookmarksProxy = null;
this.currentNomadURL = null;
}


Expand All @@ -83,6 +88,7 @@ package mediator.bookmarks
interests.push(ApplicationConstants.NOTE_OK_POPUP + MediatorPopup.NAME + this.getMediatorName());
interests.push(ApplicationConstants.NOTE_CANCEL_POPUP + MediatorPopup.NAME + this.getMediatorName());
interests.push(ProxyBookmarks.NOTE_BOOKMARK_DELETE_SUCCESS);
interests.push(ApplicationConstants.NOTE_FAILED_OPEN_NOMAD_LINK);

return interests;
}
Expand All @@ -105,6 +111,10 @@ package mediator.bookmarks
case ProxyBookmarks.NOTE_BOOKMARK_DELETE_FAILED:
sendNotification(ApplicationConstants.COMMAND_SHOW_POPUP, new PopupVO(PopupType.ERROR, this.getMediatorName(), String(note.getBody())));
break;
case ApplicationConstants.NOTE_FAILED_OPEN_NOMAD_LINK:
navigateToURL(new URLRequest(currentNomadURL));
currentNomadURL = null;
break;
}
}

Expand Down Expand Up @@ -202,6 +212,7 @@ package mediator.bookmarks

var confView:ConfigurationAppDetails = event["nativeEvent"].currentTarget.royale_wrapper.parent.parent.parent as ConfigurationAppDetails;
var selectedApp:Object = confView.data;
this.currentNomadURL = selectedApp.nomadURL;
sendNotification(ApplicationConstants.COMMAND_LAUNCH_NOMAD_LINK, {name: selectedApp.database, link: selectedApp.nomadURL});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ package mediator.bookmarks
import model.vo.PopupVO;

import org.apache.royale.events.MouseEvent;
import org.apache.royale.net.URLRequest;
import org.apache.royale.net.navigateToURL;
import org.puremvc.as3.multicore.interfaces.IMediator;
import org.puremvc.as3.multicore.interfaces.INotification;
import org.puremvc.as3.multicore.patterns.mediator.Mediator;
Expand Down Expand Up @@ -80,6 +82,7 @@ package mediator.bookmarks
var interests:Array = super.listNotificationInterests();
interests.push(ProxyBrowseMyServer.NOTE_SERVERS_LIST_FETCHED);
interests.push(ProxyBrowseMyServer.NOTE_SERVERS_LIST_FETCH_FAILED);
interests.push(ApplicationConstants.NOTE_FAILED_OPEN_NOMAD_LINK);

return interests;
}
Expand All @@ -95,6 +98,9 @@ package mediator.bookmarks
case ProxyBrowseMyServer.NOTE_SERVERS_LIST_FETCH_FAILED:
sendNotification(ApplicationConstants.COMMAND_SHOW_POPUP, new PopupVO(PopupType.ERROR, this.getMediatorName(), String(note.getBody())));
break;
case ApplicationConstants.NOTE_FAILED_OPEN_NOMAD_LINK:
navigateToURL(new URLRequest(view.selectedItem.nomadURL));
break;
}
}

Expand Down

0 comments on commit 20d9150

Please sign in to comment.