+ * Only height resizing is currently implemented. Usage:
DragResizer.makeResizable(myAnchorPane);+ * + * @author atill + * + */ +public class DragResizer { + + /** + * The margin around the control that a user can click in to start resizing + * the region. + */ + private static final int RESIZE_MARGIN = 5; + + private final Region region; + + private double y; + + private boolean initMinHeight; + + private boolean dragging; + + private DragResizer(Region aRegion) { + region = aRegion; + } + + public static void makeResizable(Region region) { + final DragResizer resizer = new DragResizer(region); + + region.setOnMousePressed(new EventHandler
Stage
value
+ * @param inParentWindow a Node
value
* @param inNewWindowEvent a NewWindowEvent
value
* @param inViewProperties a Properties
value
*/
- public PermissionView(Stage inParentWindow,
+ public PermissionView(Node inParentWindow,
NewWindowEvent inEvent,
Properties inViewProperties)
{
@@ -77,11 +77,11 @@ public PermissionView(Stage inParentWindow,
/**
* Validate and start the object.
*/
- @Autowired
+ @PostConstruct
public void start()
{
adminClientService = serviceManager.getService(AdminClientService.class);
- VBox layout = new VBox(5);
+ mainLayout = new VBox(5);
initializeTable();
buttonLayout = new HBox(5);
addPermissionButton = new Button("Add Permission");
@@ -90,9 +90,16 @@ public void start()
addPermissionButton.setDisable(!userHasCreatePermissionPermission);
addPermissionButton.setOnAction(event -> doAddOrUpdatePermission(new SimplePermission(),true));
buttonLayout.getChildren().add(addPermissionButton);
- layout.getChildren().addAll(permissionsTable,
+ mainLayout.getChildren().addAll(permissionsTable,
buttonLayout);
- mainScene = new Scene(layout);
+ }
+ /* (non-Javadoc)
+ * @see org.marketcetera.ui.view.ContentView#getNode()
+ */
+ @Override
+ public Node getNode()
+ {
+ return mainLayout;
}
/**
* Update the users displayed in the table.
@@ -351,14 +358,6 @@ public String getViewName()
{
return NAME;
}
- /* (non-Javadoc)
- * @see org.marketcetera.ui.view.ContentView#getScene()
- */
- @Override
- public Scene getScene()
- {
- return mainScene;
- }
/**
* update user context menu item
*/
@@ -396,9 +395,9 @@ public Scene getScene()
*/
private ContextMenu permissionsTableContextMenu;
/**
- * main scene of the view
+ * main layout
*/
- private Scene mainScene;
+ private VBox mainLayout;
/**
* global name of this view
*/
diff --git a/photon/src/main/java/org/marketcetera/ui/admin/view/RoleView.java b/photon/src/main/java/org/marketcetera/ui/admin/view/RoleView.java
index 2df96f30bf..35996f27c6 100644
--- a/photon/src/main/java/org/marketcetera/ui/admin/view/RoleView.java
+++ b/photon/src/main/java/org/marketcetera/ui/admin/view/RoleView.java
@@ -6,6 +6,8 @@
import java.util.function.Consumer;
import java.util.function.Function;
+import javax.annotation.PostConstruct;
+
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.CompareToBuilder;
import org.marketcetera.admin.AdminPermissions;
@@ -20,7 +22,6 @@
import org.marketcetera.ui.service.admin.AdminClientService;
import org.marketcetera.ui.view.AbstractContentView;
import org.marketcetera.util.log.SLF4JLoggerProxy;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@@ -31,7 +32,7 @@
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
-import javafx.scene.Scene;
+import javafx.scene.Node;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
@@ -52,7 +53,6 @@
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
-import javafx.stage.Stage;
import javafx.util.Callback;
/* $License$ */
@@ -72,11 +72,11 @@ public class RoleView
/**
* Create a new RoleView instance.
*
- * @param inParentWindow a Stage
value
+ * @param inParentWindow a Node
value
* @param inNewWindowEvent a NewWindowEvent
value
* @param inViewProperties a Properties
value
*/
- public RoleView(Stage inParentWindow,
+ public RoleView(Node inParentWindow,
NewWindowEvent inEvent,
Properties inViewProperties)
{
@@ -92,22 +92,14 @@ public String getViewName()
{
return NAME;
}
- /* (non-Javadoc)
- * @see org.marketcetera.ui.view.ContentView#getScene()
- */
- @Override
- public Scene getScene()
- {
- return mainScene;
- }
/**
* Validate and start the object.
*/
- @Autowired
+ @PostConstruct
public void start()
{
adminClientService = serviceManager.getService(AdminClientService.class);
- VBox layout = new VBox(5);
+ mainLayout = new VBox(5);
initializeTable();
buttonLayout = new HBox(5);
addRoleButton = new Button("Add Role");
@@ -116,9 +108,16 @@ public void start()
addRoleButton.setDisable(!userHasCreateRolePermission);
addRoleButton.setOnAction(event -> doAddOrUpdateRole(new SimpleRole(),true));
buttonLayout.getChildren().add(addRoleButton);
- layout.getChildren().addAll(rolesTable,
+ mainLayout.getChildren().addAll(rolesTable,
buttonLayout);
- mainScene = new Scene(layout);
+ }
+ /* (non-Javadoc)
+ * @see org.marketcetera.ui.view.ContentView#getNode()
+ */
+ @Override
+ public Node getNode()
+ {
+ return mainLayout;
}
/**
* Update the users displayed in the table.
@@ -506,9 +505,9 @@ public void updateItem(Permission person, boolean empty) {
*/
private ContextMenu rolesTableContextMenu;
/**
- * main scene of the view
+ * main layout of the view
*/
- private Scene mainScene;
+ private VBox mainLayout;
/**
* global name of this view
*/
diff --git a/photon/src/main/java/org/marketcetera/ui/admin/view/UserView.java b/photon/src/main/java/org/marketcetera/ui/admin/view/UserView.java
index cfb23d8048..56528856fe 100644
--- a/photon/src/main/java/org/marketcetera/ui/admin/view/UserView.java
+++ b/photon/src/main/java/org/marketcetera/ui/admin/view/UserView.java
@@ -5,6 +5,8 @@
import java.util.function.Consumer;
import java.util.function.Function;
+import javax.annotation.PostConstruct;
+
import org.apache.commons.lang3.StringUtils;
import org.marketcetera.admin.AdminPermissions;
import org.marketcetera.admin.impl.SimpleUser;
@@ -16,7 +18,6 @@
import org.marketcetera.ui.service.admin.AdminClientService;
import org.marketcetera.ui.view.AbstractContentView;
import org.marketcetera.util.log.SLF4JLoggerProxy;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@@ -25,7 +26,7 @@
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.value.ChangeListener;
import javafx.geometry.Insets;
-import javafx.scene.Scene;
+import javafx.scene.Node;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
@@ -46,7 +47,6 @@
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
-import javafx.stage.Stage;
/* $License$ */
@@ -63,28 +63,36 @@ public class UserView
extends AbstractContentView
{
/**
- * Create a new FillsView instance.
+ * Create a new UserView instance.
*
- * @param inParentWindow a Stage
value
+ * @param inParentWindow a Node
value
* @param inNewWindowEvent a NewWindowEvent
value
* @param inViewProperties a Properties
value
*/
- public UserView(Stage inParentWindow,
- NewWindowEvent inEvent,
- Properties inViewProperties)
+ public UserView(Node inParentWindow,
+ NewWindowEvent inEvent,
+ Properties inViewProperties)
{
super(inParentWindow,
inEvent,
inViewProperties);
}
+ /* (non-Javadoc)
+ * @see org.marketcetera.ui.view.ContentView#getNode()
+ */
+ @Override
+ public Node getNode()
+ {
+ return mainLayout;
+ }
/**
* Validate and start the object.
*/
- @Autowired
+ @PostConstruct
public void start()
{
adminClientService = serviceManager.getService(AdminClientService.class);
- VBox layout = new VBox(5);
+ mainLayout = new VBox(5);
initializeTable();
buttonLayout = new HBox(5);
addUserButton = new Button("Add User");
@@ -93,9 +101,8 @@ public void start()
addUserButton.setDisable(!userHasCreateUserPermission);
addUserButton.setOnAction(event -> doAddOrUpdateUser(new SimpleUser(),true));
buttonLayout.getChildren().add(addUserButton);
- layout.getChildren().addAll(usersTable,
+ mainLayout.getChildren().addAll(usersTable,
buttonLayout);
- mainScene = new Scene(layout);
}
/**
* Update the users displayed in the table.
@@ -574,14 +581,6 @@ public String getViewName()
{
return NAME;
}
- /* (non-Javadoc)
- * @see org.marketcetera.ui.view.ContentView#getScene()
- */
- @Override
- public Scene getScene()
- {
- return mainScene;
- }
/**
* update user context menu item
*/
@@ -635,9 +634,9 @@ public Scene getScene()
*/
private ContextMenu usersTableContextMenu;
/**
- * main scene of the view
+ * main node of the view
*/
- private Scene mainScene;
+ private VBox mainLayout;
/**
* global name of this view
*/
diff --git a/photon/src/main/java/org/marketcetera/ui/events/NewWindowEvent.java b/photon/src/main/java/org/marketcetera/ui/events/NewWindowEvent.java
index ef8745404e..1e96e885b5 100644
--- a/photon/src/main/java/org/marketcetera/ui/events/NewWindowEvent.java
+++ b/photon/src/main/java/org/marketcetera/ui/events/NewWindowEvent.java
@@ -65,8 +65,8 @@ default Properties getProperties()
*/
default PairWindow
value
+ * @param inParent a Node
value
* @param inNewWindowEvent a NewWindowEvent
value
* @param inProperties a Properties
value
*/
- public FixSessionView(Stage inParent,
- NewWindowEvent inEvent,
- Properties inProperties)
+ public FixSessionView(Node inParent,
+ NewWindowEvent inEvent,
+ Properties inProperties)
{
super(inParent,
inEvent,
@@ -454,7 +451,7 @@ private void updateFixSession(DisplayFixSession inFixSession,
final String acceptorString = "Acceptor";
final String initiatorString = "Initiator";
final String incomingFixSessionName = inFixSession.getSource().getFixSession().getName();
- Wizard wizard = new Wizard(App.getPrimaryStage());
+ Wizard wizard = new Wizard(PhotonApp.getPrimaryStage());
wizard.setTitle((inIsNew ? "Add" : "Edit") + " Session");
final ComboBoxWindow
value
+ * @param inParent a Node
value
* @param inNewWindowEvent a NewWindowEvent
value
* @param inProperties a Properties
value
*/
- public MarketDataDetailView(Stage inParent,
+ public MarketDataDetailView(Node inParent,
NewWindowEvent inEvent,
Properties inProperties)
{
@@ -429,7 +426,6 @@ private void initializeChart()
private TableViewWindow
value
+ * @param inParent a Node
value
* @param inNewWindowEvent a NewWindowEvent
value
* @param inProperties a Properties
value
*/
- public MarketDataListView(Stage inParent,
+ public MarketDataListView(Node inParent,
NewWindowEvent inEvent,
Properties inProperties)
{
super(inParent,
inEvent,
inProperties);
- System.out.println("COCO: view properties: " + inProperties);
}
private void updateViewProperties()
{
@@ -168,7 +164,6 @@ private void updateViewProperties()
getViewProperties().setProperty(symbolsKey,
String.valueOf(symbolsByRequestId.values()));
}
- System.out.println("COCO: view properties are now: " + getViewProperties());
}
private void initializeAddSymbol()
{
@@ -458,7 +453,6 @@ private MarketDataRowListener(MarketDataItem inMarketDataItem)
private TableViewWindow
value
+ * @param inWindow a WindowLayout
value
* @return a boolean
value
*/
- private boolean isWindowOutsideDesktop(Window inWindow)
+ private boolean isWindowOutsideDesktop(WindowLayout inWindow)
{
- DesktopParameters params = SessionUser.getCurrent().getAttribute(DesktopParameters.class);
- return (getWindowBottom(inWindow) > params.getBottom()) || (getWindowLeft(inWindow) < params.getLeft()) || (getWindowTop(inWindow) < params.getTop()) || (getWindowRight(inWindow) > params.getRight());
+ double windowTop = inWindow.getY();
+ double windowLeft = inWindow.getX();
+ double windowHeight = inWindow.getHeight();
+ double windowWidth = inWindow.getWidth();
+ double windowBottom = windowTop + windowHeight;
+ double windowRight = windowLeft + windowWidth;
+ double workspaceWidth = getWorkspaceWidth();
+ double workspaceBottom = getWorkspaceBottom();
+ double workspaceLeft = getWorkspaceLeft();
+ double workspaceTop = getWorkspaceTop();
+ double workspaceRight = workspaceWidth;
+ boolean outsideDesktop = windowBottom > workspaceBottom || windowLeft < workspaceLeft || windowTop < workspaceTop || windowRight > workspaceRight;
+ return outsideDesktop;
}
/**
- * Get the window top edge coordinate in pixels.
+ * Get the window height in pixels.
*
- * @param inWindow a Window
value
+ * @param inWindow a WindowLayout
value
* @return a double
value
*/
- private double getWindowTop(Window inWindow)
+ private double getWindowHeight(WindowLayout inWindow)
{
- return inWindow.getY();
+ return inWindow.getHeight();
}
/**
- * Get the window left edge coordinate in pixels.
+ * Get the window width in pixels.
*
- * @param inWindow a Window
value
+ * @param inWindow a WindowLayout
value
* @return a double
value
*/
- private double getWindowLeft(Window inWindow)
+ private double getWindowWidth(WindowLayout inWindow)
{
- return inWindow.getX();
+ return inWindow.getWidth();
}
/**
- * Get the window bottom edge coordinate in pixels.
+ * Get the window registry for the current user.
*
- * @param inWindow a Window
value
- * @return a double
value
+ * @return a WindowRegistry
value
*/
- private double getWindowBottom(Window inWindow)
+ private WindowRegistry getCurrentUserRegistry()
{
- return getWindowTop(inWindow) + getWindowHeight(inWindow);
+ WindowRegistry registry = SessionUser.getCurrent().getAttribute(WindowRegistry.class);
+ if(registry == null) {
+ registry = new WindowRegistry();
+ SessionUser.getCurrent().setAttribute(WindowRegistry.class,
+ registry);
+ }
+ return registry;
}
/**
- * Get the window right edge coordinate in pixels.
+ * Get the main workspace width.
*
- * @param inWindow a Window
value
* @return a double
value
*/
- private double getWindowRight(Window inWindow)
+ private double getWorkspaceWidth()
{
- return getWindowLeft(inWindow) + getWindowWidth(inWindow);
+ return PhotonApp.getWorkspace().getLayoutBounds().getWidth();
}
/**
- * Get the window height in pixels.
+ * Get the main workspace height.
*
- * @param inWindow a Window
value
* @return a double
value
*/
- private double getWindowHeight(Window inWindow)
+ private double getWorkspaceHeight()
{
- return inWindow.getHeight();
+ return PhotonApp.getWorkspace().getLayoutBounds().getHeight();
}
/**
- * Get the window width in pixels.
+ * Get the main workspace left.
*
- * @param inWindow a Window
value
* @return a double
value
*/
- private double getWindowWidth(Window inWindow)
+ private double getWorkspaceLeft()
{
- return inWindow.getWidth();
+ return 0.0;
}
/**
- * Get the window registry for the current user.
+ * Get the main workspace top.
*
- * @return a WindowRegistry
value
+ * @return a double
value
*/
- private WindowRegistry getCurrentUserRegistry()
+ private double getWorkspaceTop()
{
- WindowRegistry registry = SessionUser.getCurrent().getAttribute(WindowRegistry.class);
- if(registry == null) {
- registry = new WindowRegistry();
- SessionUser.getCurrent().setAttribute(WindowRegistry.class,
- registry);
- registry.scheduleWindowPositionMonitor();
- }
- return registry;
+ return 0.0;
}
- private static double getDoubleValue(Properties inProperties,
- String inPropertyName)
+ /**
+ * Get the main workspace right.
+ *
+ * @return a double
value
+ */
+ private double getWorkspaceRight()
{
- return getDoubleValue(inProperties,
- inPropertyName,
- 0.0);
+ return getWorkspaceLeft() + getWorkspaceWidth();
}
- private static double getDoubleValue(Properties inProperties,
- String inPropertyName,
- double inDefaultValue)
+ /**
+ * Get the main workspace bottom.
+ *
+ * @return a double
value
+ */
+ private double getWorkspaceBottom()
{
- String rawValue = StringUtils.trimToNull(inProperties.getProperty(inPropertyName));
- double value = inDefaultValue;
- if(rawValue != null) {
- try {
- value = Double.parseDouble(rawValue);
- } catch (NumberFormatException ignored) {}
- }
- return value;
+ return getWorkspaceTop() + getWorkspaceHeight();
}
/**
* Event used to open a new window on restart.
@@ -346,6 +323,14 @@ private static double getDoubleValue(Properties inProperties,
private class RestartNewWindowEvent
implements NewWindowEvent
{
+ /* (non-Javadoc)
+ * @see org.marketcetera.ui.events.NewWindowEvent#getProperties()
+ */
+ @Override
+ public Properties getProperties()
+ {
+ return properties;
+ }
/* (non-Javadoc)
* @see org.marketcetera.ui.events.NewWindowEvent#getWindowIcon()
*/
@@ -377,14 +362,19 @@ public Class extends ContentViewFactory> getViewFactoryType()
* Create a new RestartNewWindowEvent instance.
*
* @param inContentViewFactory a ContentViewFactory
value
- * @param inWindowTitle a String
value
+ * @param inProperties a Properties
value
*/
private RestartNewWindowEvent(ContentViewFactory inContentViewFactory,
- String inWindowTitle)
+ Properties inProperties)
{
contentViewFactory = inContentViewFactory;
- windowTitle = inWindowTitle;
+ properties = inProperties;
+ windowTitle = properties.getProperty(windowTitleProp);
}
+ /**
+ * window properties value
+ */
+ private final Properties properties;
/**
* content view factory value
*/
@@ -395,188 +385,463 @@ private RestartNewWindowEvent(ContentViewFactory inContentViewFactory,
private final String windowTitle;
}
/**
- * Holds meta-data for windows.
+ * Holds the information needed for each window being displayed.
*
* @author Colin DuPlantis
* @version $Id$
* @since $Release$
*/
- private class WindowMetaData
+ @SuppressWarnings("unused")
+ private class WindowLayout
{
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString()
- {
- return properties.toString();
- }
/**
- * Create a new WindowMetaData instance.
+ * Create a new WindowLayout instance.
*
- * This constructor is invoked for a new window.
- *
* @param inEvent a This constructor is invoked to recreate a previously-created window.
- *
- * @param inProperties a If the window is already within the acceptable bounds of the desktop viewable area, it will not be repositioned.
*
- * @param inWindow a NewWindowEvent
value
- * @param inWindow a Stage
value
- * @param inContentViewFactory a ContentViewFactory
value
+ * @param inViewFactory a ContentViewFactory
value
*/
- private WindowMetaData(NewWindowEvent inEvent,
- Stage inWindow,
- ContentViewFactory inContentViewFactory)
+ private WindowLayout(NewWindowEvent inEvent,
+ ContentViewFactory inViewFactory)
{
+ newWindowEventProperty.set(inEvent);
+ viewFactoryProperty.set(inViewFactory);
properties = inEvent.getProperties();
- window = inWindow;
- setWindowStaticProperties(inContentViewFactory,
- UUID.randomUUID().toString());
- updateProperties();
+ uuidProperty.set(UUID.randomUUID().toString());
+ setWindowStaticProperties();
+ windowLayout = new VBox();
+ windowTitleLayout = new HBox();
+ titleLayout = new HBox();
+ closeButtonLayout = new HBox();
+ contentLayout = new VBox();
+ windowLayout.getChildren().addAll(windowTitleLayout,
+ contentLayout);
+ windowTitleLayout.getChildren().addAll(titleLayout,
+ closeButtonLayout);
+ windowTitle = new Label();
+ windowTitle.textProperty().bind(windowTitleProperty);
+ closeLabel = new Label("X");
+ titleLayout.getChildren().addAll(windowTitle);
+ closeButtonLayout.getChildren().addAll(closeLabel);
+ windowTitleLayout.getStyleClass().add("title-bar");
+ HBox.setHgrow(windowTitleLayout,
+ Priority.ALWAYS);
+ HBox.setHgrow(titleLayout,
+ Priority.ALWAYS);
+ HBox.setHgrow(closeButtonLayout,
+ Priority.NEVER);
+ windowTitleLayout.setAlignment(Pos.CENTER);
+ closeButtonLayout.setAlignment(Pos.BASELINE_RIGHT);
+ closeButtonLayout.setPrefWidth(20);
+ contentLayout.setAlignment(Pos.CENTER);
+ VBox.setVgrow(contentLayout,
+ Priority.ALWAYS);
+ DragResizeMod.makeResizable(windowLayout,
+ new OnDragResizeEventListener() {
+ @Override
+ public void onDrag(Node inNode,
+ double inX,
+ double inY,
+ double inH,
+ double inW)
+ {
+ setX(inX);
+ setY(inY);
+ WindowRegistry windowRegistry = getCurrentUserRegistry();
+ windowRegistry.verifyWindowLocation(WindowLayout.this);
+ windowRegistry.updateDisplayLayout();
+ }
+ @Override
+ public void onResize(Node inNode,
+ double inX,
+ double inY,
+ double inH,
+ double inW)
+ {
+ setHeight(inH);
+ setWidth(inW);
+ WindowRegistry windowRegistry = getCurrentUserRegistry();
+ windowRegistry.verifyWindowLocation(WindowLayout.this);
+ windowRegistry.updateDisplayLayout();
+ }
+ });
+ windowLayout.getStyleClass().add("view");
+ windowLayout.getStylesheets().clear();
+ windowLayout.getStylesheets().add("dark-mode.css");
+// DropShadow dropShadow = new DropShadow(BlurType.THREE_PASS_BOX,new Color(0,0,0,0.8),10,0,0,0);
+// windowLayout.setEffect(dropShadow);
+// windowLayout.setPickOnBounds(false);
+ setupWindowListeners();
+ PairProperties
value
- * @param inWindow a Stage
value
+ * @param inViewOrder a double
value
*/
- private WindowMetaData(Properties inProperties,
- Stage inWindow)
+ private void setViewOrder(double inViewOrder)
{
- // TODO need to do a permissions re-check, perhaps
- window = inWindow;
- properties = inProperties;
- try {
- ContentViewFactory contentViewFactory = (ContentViewFactory)applicationContext.getBean(Class.forName(inProperties.getProperty(windowContentViewFactoryProp)));
- ContentView contentView = contentViewFactory.create(window,
- new RestartNewWindowEvent(contentViewFactory,
- properties.getProperty(windowTitleProp)),
- properties);
- styleService.addStyle(contentView);
- Scene scene = contentView.getScene();
- scene.getStylesheets().clear();
- scene.getStylesheets().add("dark-mode.css");
- window.setScene(scene);
- } catch (ClassNotFoundException e) {
- throw new RuntimeException(e);
- }
- // update window from properties, effectively restoring it to its previous state
- updateWindow();
+ viewOrderProperty.set(inViewOrder);
+ Platform.runLater(() -> windowLayout.setViewOrder(inViewOrder));
}
/**
- * Get the storable value for this window.
+ * Set the content view value.
*
- * @return a String
value
+ * @param inContentView a ContentView
value
*/
- private String getStorableValue()
+ private void setContentView(ContentView inContentView)
{
- return Util.propertiesToString(properties);
+ contentViewProperty.set(inContentView);
}
/**
- * Get the properties value.
+ * Request the focus for this window.
+ */
+ private void requestFocus()
+ {
+ Platform.runLater(() -> windowLayout.requestFocus());
+ }
+ /**
+ * Get the window properties.
*
* @return a Properties
value
*/
private Properties getProperties()
{
- return properties;
+ return windowProperties;
}
/**
- * Get the window value.
+ * Set the root content.
*
- * @return a Stage
value
+ * @param inNode a Node
value
*/
- private Stage getWindow()
+ private void setRoot(Node inNode)
{
- return window;
+ contentLayout.getChildren().add(inNode);
}
/**
- * Update the window telemetry from the underlying window object.
+ * Set the draggable value for the window.
+ *
+ * @param inDraggable a boolean
value
*/
- private void updateProperties()
+ private void setDraggable(boolean inDraggable)
{
- properties.setProperty(windowPosXProp,
- String.valueOf(window.getX()));
- properties.setProperty(windowPosYProp,
- String.valueOf(window.getY()));
- properties.setProperty(windowHeightProp,
- String.valueOf(window.getHeight()));
- properties.setProperty(windowWidthProp,
- String.valueOf(window.getWidth()));
- properties.setProperty(windowModeProp,
- String.valueOf(window.isMaximized()));
- if(window.getTitle() != null) {
- properties.setProperty(windowTitleProp,
- window.getTitle());
- }
- properties.setProperty(windowModalProp,
- String.valueOf(window.getModality()));
- // TODO not sure what to do about dragging yet
-// properties.setProperty(windowDraggableProp,
-// String.valueOf(window.isDraggable()));
- properties.setProperty(windowResizableProp,
- String.valueOf(window.isResizable()));
-// properties.setProperty(windowScrollLeftProp,
-// String.valueOf(window.getScrollLeft()));
-// properties.setProperty(windowScrollTopProp,
-// String.valueOf(window.getScrollTop()));
- properties.setProperty(windowFocusProp,
- String.valueOf(hasFocus()));
- Object windowId = window.getProperties().getOrDefault(windowStyleId,
- null);
- if(windowId == null) {
- properties.remove(windowStyleId);
- } else {
- properties.setProperty(windowStyleId,
- String.valueOf(windowId));
- }
+ draggableProperty.set(inDraggable);
}
/**
- * Update the window object with the stored telemetry.
+ * Set the height value for the window.
+ *
+ * @param inHeight a double
value
*/
- private void updateWindow()
+ private void setHeight(double inHeight)
{
- window.setWidth(Double.parseDouble(properties.getProperty(windowWidthProp)));
- window.setHeight(Double.parseDouble(properties.getProperty(windowHeightProp)));
-// window.initModality(Modality.valueOf(properties.getProperty(windowModalProp)));
- window.initModality(Modality.NONE);
- Boolean isMaximized = Boolean.parseBoolean(properties.getProperty(windowModeProp));
- window.setMaximized(isMaximized);
- // TODO not sure about these yet
-// window.setScrollLeft(Integer.parseInt(properties.getProperty(windowScrollLeftProp)));
-// window.setScrollTop(Integer.parseInt(properties.getProperty(windowScrollTopProp)));
-// window.setDraggable(Boolean.parseBoolean(properties.getProperty(windowDraggableProp)));
- window.setResizable(Boolean.parseBoolean(properties.getProperty(windowResizableProp)));
- window.setTitle(properties.getProperty(windowTitleProp));
- window.setX(getDoubleValue(properties,
- windowPosXProp));
- window.setY(getDoubleValue(properties,
- windowPosYProp));
- window.getProperties().put(windowStyleId,
- properties.getProperty(windowStyleId));
-// setHasFocus(Boolean.parseBoolean(properties.getProperty(windowFocusProp)));
-// if(hasFocus) {
-// window.requestFocus();
-// }
+ heightProperty.set(inHeight);
+ windowLayout.setPrefHeight(inHeight);
+ windowLayout.setMinHeight(inHeight);
}
/**
- * Set the immutable properties of this window to the underlying properties storage.
+ * Set the width value for the window.
*
- * @param inContentViewFactory a ContentViewFactory
value
- * @param inUuid a String
value
+ * @param inWidth a double
value
*/
- private void setWindowStaticProperties(ContentViewFactory inContentViewFactory,
- String inUuid)
+ private void setWidth(double inWidth)
{
- properties.setProperty(windowContentViewFactoryProp,
- inContentViewFactory.getClass().getCanonicalName());
- properties.setProperty(windowUuidProp,
- inUuid);
+ widthProperty.set(inWidth);
+ windowLayout.setPrefWidth(inWidth);
+ windowLayout.setMinWidth(inWidth);
+ }
+ /**
+ * Set the resizable value for the window.
+ *
+ * @param inResizable a boolean
value
+ */
+ public void setResizable(boolean inResizable)
+ {
+ resizableProperty.set(inResizable);
}
/**
- * Close this window and remove it from active use.
+ * Set the window title property for the window.
+ *
+ * @param inWindowTitle a String
value
+ */
+ private void setTitle(String inWindowTitle)
+ {
+ windowTitleProperty.set(inWindowTitle);
+ }
+ /**
+ * Get the main layout node for the window.
+ *
+ * @return a Node
value
+ */
+ private Node getMainLayout()
+ {
+ return windowLayout;
+ }
+ /**
+ * Get the window X position value.
+ *
+ * @return a double
value
+ */
+ private double getX()
+ {
+ return xProperty.get();
+ }
+ /**
+ * Get the window Y position value.
+ *
+ * @return a double
value
+ */
+ private double getY()
+ {
+ return yProperty.get();
+ }
+ /**
+ * Get the window height value.
+ *
+ * @return a double
value
+ */
+ private double getHeight()
+ {
+ return heightProperty.get();
+ }
+ /**
+ * Get the window width value.
+ *
+ * @return a double
value
+ */
+ private double getWidth()
+ {
+ return widthProperty.get();
+ }
+ /**
+ * Get the window maximized value.
+ *
+ * @return a boolean
value
+ */
+ private boolean isMaximized()
+ {
+ return maximizedProperty.get();
+ }
+ /**
+ * Get the window title value.
+ *
+ * @return a String
value
+ */
+ private String getTitle()
+ {
+ return windowTitleProperty.get();
+ }
+ /**
+ * Get the window modality value.
+ *
+ * @return a Modality
value
+ */
+ private Modality getModality()
+ {
+ return modalityProperty.get();
+ }
+ /**
+ * Get the window draggable value.
+ *
+ * @return a boolean
value
+ */
+ private boolean isDraggable()
+ {
+ return draggableProperty.get();
+ }
+ /**
+ * Get the window resizable value.
+ *
+ * @return a boolean
value
+ */
+ private boolean isResizable()
+ {
+ return resizableProperty.get();
+ }
+ /**
+ * Get the window scroll left value.
+ *
+ * @return a double
value
+ */
+ private double getScrollLeft()
+ {
+ return scrollLeftProperty.get();
+ }
+ /**
+ * Set the window modality value.
+ *
+ * @param inModality a Modality
value
+ */
+ private void setModality(Modality inModality)
+ {
+ modalityProperty.set(inModality);
+ }
+ /**
+ * Set the window maximized value.
+ *
+ * @param inMaximized a boolean
value
+ */
+ private void setMaximized(boolean inMaximized)
+ {
+ maximizedProperty.set(inMaximized);
+ }
+ /**
+ * Set the window scroll left value.
+ *
+ * @param inScrollLeft a double
value
+ */
+ private void setScrollLeft(double inScrollLeft)
+ {
+ scrollLeftProperty.set(inScrollLeft);
+ }
+ /**
+ * Set the window scroll top value.
+ *
+ * @param inScrollTop a double
value
+ */
+ private void setScrollTop(double inScrollTop)
+ {
+ scrollTopProperty.set(inScrollTop);
+ }
+ /**
+ * Set the window X position value.
+ *
+ * @param inX a double
value
+ */
+ private void setX(double inX)
+ {
+ xProperty.set(inX);
+ getMainLayout().translateXProperty().set(inX);
+ }
+ /**
+ * Set the window Y position value.
+ *
+ * @param inY a double
value
+ */
+ private void setY(double inY)
+ {
+ yProperty.set(inY);
+ getMainLayout().translateYProperty().set(inY);
+ }
+ /**
+ * Close the window.
*/
private void close()
{
- ((Stage)getWindow().getScene().getWindow()).close();
+ WindowRegistry windowRegistry = getCurrentUserRegistry();
+ if(!windowRegistry.isLoggingOut()) {
+ windowRegistry.removeWindow(this);
+ windowRegistry.updateDisplayLayout();
+ }
+ Platform.runLater(() -> PhotonApp.getWorkspace().getChildren().remove(getMainLayout()));
+ }
+ /**
+ * Show the window.
+ */
+ private void show()
+ {
+ getMainLayout().translateXProperty().set(getX());
+ getMainLayout().translateYProperty().set(getY());
+ setViewOrder(-1);
+ Platform.runLater(() -> {
+ windowLayout.autosize();
+ PhotonApp.getWorkspace().getChildren().add(getMainLayout());
+ requestFocus();
+ });
}
/**
* Get the window uuid value.
@@ -585,45 +850,127 @@ private void close()
*/
private String getUuid()
{
- if(uuid == null) {
- uuid = properties.getProperty(windowUuidProp);
- }
- return uuid;
+ return uuidProperty.get();
}
/**
- * Get the hasFocus value.
+ * Get a storable implementation of the window properties.
*
- * @return a boolean
value
+ * @return a String
value
*/
- private boolean hasFocus()
+ private String getStorableValue()
{
- return hasFocus;
+ return Util.propertiesToString(properties);
}
/**
- * Sets the hasFocus value.
- *
- * @param inHasFocus a boolean
value
+ * Set the immutable properties of this window to the underlying properties storage.
*/
- private void setHasFocus(boolean inHasFocus)
+ private void setWindowStaticProperties()
{
- hasFocus = inHasFocus;
+ properties.setProperty(windowContentViewFactoryProp,
+ viewFactoryProperty.get().getClass().getCanonicalName());
+ properties.setProperty(windowUuidProp,
+ uuidProperty.get());
}
/**
- * indicates if this window has focus or not
+ * holds the Content View of the window
*/
- private transient boolean hasFocus;
+ private final ObjectPropertyWindowWrapper
value
+ * @param inWindowLayout a WindowLayout
value
*/
- private void addWindow(WindowMetaData inWindowMetaData)
+ private void addWindow(WindowLayout inWindowMetaData)
{
synchronized(activeWindows) {
activeWindows.add(inWindowMetaData);
@@ -653,8 +1000,8 @@ private void addWindow(WindowMetaData inWindowMetaData)
private void closeAllWindows(boolean inUpdateDisplay)
{
synchronized(activeWindows) {
- SetWindowMetaData
value
- */
- private void addWindowListeners(WindowMetaData inWindowWrapper)
- {
- WindowRegistry windowRegistry = this;
- Stage newWindow = inWindowWrapper.getWindow();
- newWindow.addEventHandler(MouseEvent.MOUSE_CLICKED,
- new EventHandlerStage
value
+ * @param inWindow a WindowLayout
value
*/
- private void verifyWindowLocation(Stage inWindow)
+ private void verifyWindowLocation(WindowLayout inWindow)
{
synchronized(activeWindows) {
if(isWindowOutsideDesktop(inWindow)) {
@@ -954,15 +1175,25 @@ private void verifyWindowLocation(Stage inWindow)
*
* Window
value
+ * @param inWindow a WindowLayout
value
*/
- private void returnWindowToDesktop(Window inWindow)
+ private void returnWindowToDesktop(WindowLayout inWindow)
{
+ double windowTop = inWindow.getY();
+ double windowLeft = inWindow.getX();
+ double windowHeight = inWindow.getHeight();
+ double windowWidth = inWindow.getWidth();
+ double windowBottom = windowTop + windowHeight;
+ double windowRight = windowLeft + windowWidth;
+ double workspaceWidth = getWorkspaceWidth();
+ double workspaceHeight = getWorkspaceHeight();
+ double workspaceBottom = workspaceHeight;
+ double workspaceLeft = getWorkspaceLeft();
+ double workspaceTop = getWorkspaceTop();
+ double workspaceRight = workspaceWidth;
int pad = desktopViewableAreaPad;
- DesktopParameters params = SessionUser.getCurrent().getAttribute(DesktopParameters.class);
// the order here is important: first, resize the window, if necessary
- double maxWidth = params.getRight()-params.getLeft();
- double windowWidth = getWindowWidth(inWindow);
+ double maxWidth = workspaceRight;
if(windowWidth > maxWidth) {
inWindow.setWidth(maxWidth - (pad*2));
}
@@ -970,47 +1201,42 @@ private void returnWindowToDesktop(Window inWindow)
windowWidth = 100;
inWindow.setWidth(windowWidth);
}
- double maxHeight = params.getBottom() - params.getTop();
- double windowHeight = getWindowHeight(inWindow);
+ double maxHeight = workspaceBottom;
if(windowHeight > maxHeight) {
inWindow.setHeight(maxHeight - (pad*2));
}
// window is now no larger than desktop
// check bottom
- double windowBottom = getWindowBottom(inWindow);
- if(windowBottom > params.getBottom()) {
- double newWindowTop = params.getBottom() - getWindowHeight(inWindow) - pad;
+ if(windowBottom > workspaceBottom) {
+ double newWindowTop = workspaceBottom - getWindowHeight(inWindow) - pad;
inWindow.setY(newWindowTop);
}
// check top
- double windowTop = getWindowTop(inWindow);
- if(windowTop < params.getTop()+pad) {
- double newWindowTop = params.getTop() + pad;
+ if(windowTop < workspaceTop+pad) {
+ double newWindowTop = workspaceTop + pad;
inWindow.setY(newWindowTop);
}
// window is now within the desktop Y range
// check left
- double windowLeft = getWindowLeft(inWindow);
- if(windowLeft < params.getLeft()) {
- double newWindowLeft = params.getLeft() + pad;
+ if(windowLeft < workspaceLeft) {
+ double newWindowLeft = workspaceLeft + pad;
inWindow.setX(newWindowLeft);
}
// check right
- double windowRight = getWindowRight(inWindow);
- if(windowRight > params.getRight()) {
- double newWindowLeft = params.getRight() - getWindowWidth(inWindow) - pad;
+ if(windowRight > workspaceRight) {
+ double newWindowLeft = workspaceRight - getWindowWidth(inWindow) - pad;
inWindow.setX(newWindowLeft);
}
}
/**
* Remove the given window from this registry.
*
- * @param inWindowMetaData a WindowMetaData
value
+ * @param inWindowLayout a WindowLayout
value
*/
- private void removeWindow(WindowMetaData inWindowMetaData)
+ private void removeWindow(WindowLayout inWindowLayout)
{
synchronized(activeWindows) {
- activeWindows.remove(inWindowMetaData);
+ activeWindows.remove(inWindowLayout);
}
}
/**
@@ -1028,10 +1254,6 @@ private void logout()
*/
private void terminateRegistry()
{
- synchronized(windowPositionExaminerThreadPool) {
- cancelWindowPositionMonitor();
- windowPositionExaminerThreadPool.shutdownNow();
- }
closeAllWindows(false);
}
/**
@@ -1044,60 +1266,20 @@ private void verifyAllWindowPositions()
@Override
public void run()
{
- for(WindowMetaData windowMetaData : activeWindows) {
+ for(WindowLayout window : activeWindows) {
try {
- if(WindowManagerService.this.isWindowOutsideDesktop(windowMetaData.getWindow())) {
- returnWindowToDesktop(windowMetaData.getWindow());
+ if(WindowManagerService.this.isWindowOutsideDesktop(window)) {
+ returnWindowToDesktop(window);
}
} catch (Exception e) {
SLF4JLoggerProxy.warn(WindowManagerService.this,
ExceptionUtils.getRootCauseMessage(e));
}
-// if(windowMetaData.hasFocus()) { // && windowMetaData.getWindow().isAttached()) {
-// windowMetaData.getWindow().focus();
-// }
}
}}
);
}
}
- /**
- * Cancel the current window position monitor job, if necessary.
- */
- private void cancelWindowPositionMonitor()
- {
- synchronized(windowPositionExaminerThreadPool) {
- if(windowPositionMonitorToken != null) {
- try {
- windowPositionMonitorToken.cancel(true);
- } catch (Exception ignored) {}
- windowPositionMonitorToken = null;
- }
- }
- }
- /**
- * Schedule the window position monitor job.
- */
- private void scheduleWindowPositionMonitor()
- {
- synchronized(windowPositionExaminerThreadPool) {
- cancelWindowPositionMonitor();
- windowPositionMonitorToken = windowPositionExaminerThreadPool.scheduleAtFixedRate(new Runnable() {
- @Override
- public void run()
- {
- try {
- verifyAllWindowPositions();
- } catch (Exception e) {
- SLF4JLoggerProxy.warn(WindowManagerService.this,
- ExceptionUtils.getRootCauseMessage(e));
- }
- }},
- desktopWindowPositionMonitorInterval,
- desktopWindowPositionMonitorInterval,
- TimeUnit.MILLISECONDS);
- }
- }
/**
* Get the isLoggingOut value.
*
@@ -1116,7 +1298,7 @@ private Properties getDisplayLayout()
{
synchronized(activeWindows) {
Properties displayLayout = new Properties();
- for(WindowMetaData activeWindow : activeWindows) {
+ for(WindowLayout activeWindow : activeWindows) {
String windowKey = activeWindow.getUuid();
String windowValue = activeWindow.getStorableValue();
displayLayout.setProperty(windowKey,
@@ -1132,20 +1314,12 @@ private Properties getDisplayLayout()
/**
* holds all active windows
*/
- private final SetWindow
value
+ * @param inParent a Node
value
* @param inNewWindowEvent a NewWindowEvent
value
* @param inProperties a Properties
value
*/
- public StrategyView(Stage inParent,
+ public StrategyView(Node inParent,
NewWindowEvent inEvent,
Properties inProperties)
{
@@ -310,7 +308,7 @@ private void loadStrategy()
strategyFileChooser.setTitle("Choose the Strategy JAR File");
strategyFileChooser.getExtensionFilters().add(new ExtensionFilter("JAR Files",
"*.jar"));
- File result = strategyFileChooser.showOpenDialog(getParentWindow());
+ File result = strategyFileChooser.showOpenDialog(PhotonApp.getPrimaryStage());
if(result != null) {
if(!(result.exists() && result.canRead())) {
webMessageService.post(new NotificationEvent("Load Strategy",
@@ -368,7 +366,7 @@ private void loadStrategy()
nameConfirmationDialogPane.getButtonTypes().setAll(okButtonType,
cancelButton);
nameConfirmationDialog.getDialogPane().lookupButton(okButtonType).disableProperty().bind(disableOkButton);
- PhotonServices.style(nameConfirmationDialogPane.getScene());
+ PhotonServices.styleDialog(nameConfirmationDialog);
nameConfirmationDialog.initModality(Modality.APPLICATION_MODAL);
nameConfirmationDialog.setResultConverter(dialogButton -> {
if(dialogButton == okButtonType) {
@@ -389,7 +387,7 @@ private void loadStrategy()
owner.getName());
strategyTable.getItems().add(newItem);
try {
- getScene().setCursor(Cursor.WAIT);
+ getNode().setCursor(Cursor.WAIT);
// TODO transfer file - this will block? need to use a callback instead?
SimpleFileUploadRequest uploadRequest = new SimpleFileUploadRequest(name,
nonce,
@@ -455,7 +453,7 @@ public void onError(Throwable inThrowable)
"File '" + result.getAbsolutePath() + "' could not be read",
AlertType.WARNING));
} finally {
- getScene().setCursor(Cursor.DEFAULT);
+ getNode().setCursor(Cursor.DEFAULT);
}
}
}
@@ -774,10 +772,6 @@ private void startStrategy(DisplayStrategyInstance inSelectedStrategy)
private TableViewStage
value
+ * @param inParentWindow a Node
value
* @param inNewWindowEvent a NewWindowEvent
value
* @param inViewProperties a Properties
value
*/
- public FixMessageDetailsView(Stage inParent,
+ public FixMessageDetailsView(Node inParent,
NewWindowEvent inEvent,
Properties inViewProperties)
{
@@ -225,7 +223,6 @@ public String getValue()
private final String type;
private final String value;
}
- private Scene mainScene;
private VBox mainLayout;
private TableViewNode
value
* @param inNewWindowEvent a NewWindowEvent
value
* @param inViewProperties a Properties
value
*/
- protected AbstractDeletableFixMessageView(Stage inParentWindow,
+ protected AbstractDeletableFixMessageView(Node inParentWindow,
NewWindowEvent inEvent,
Properties inViewProperties)
{
diff --git a/photon/src/main/java/org/marketcetera/ui/trade/view/AbstractFixMessageView.java b/photon/src/main/java/org/marketcetera/ui/trade/view/AbstractFixMessageView.java
index 19f0707161..955ea7ddbc 100644
--- a/photon/src/main/java/org/marketcetera/ui/trade/view/AbstractFixMessageView.java
+++ b/photon/src/main/java/org/marketcetera/ui/trade/view/AbstractFixMessageView.java
@@ -41,7 +41,6 @@
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.Node;
-import javafx.scene.Scene;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.Label;
@@ -57,8 +56,6 @@
import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
import javafx.scene.layout.VBox;
-import javafx.stage.Stage;
-import javafx.stage.WindowEvent;
/* $License$ */
@@ -92,7 +89,6 @@ public void start()
selectionModel.setSelectionMode(SelectionMode.SINGLE);
initializeColumns(reportsTableView);
initializeContextMenu(reportsTableView);
- mainScene = new Scene(mainLayout);
pagination = new Pagination();
pagination.setPageCount(10);
pagination.setCurrentPageIndex(1);
@@ -113,6 +109,14 @@ public void changed(ObservableValue extends Number> inObservable,
pageSize = 10;
updateReports();
}
+ /* (non-Javadoc)
+ * @see org.marketcetera.ui.view.ContentView#getNode()
+ */
+ @Override
+ public Node getNode()
+ {
+ return mainLayout;
+ }
/* (non-Javadoc)
* @see org.marketcetera.trade.TradeMessageListener#receiveTradeMessage(org.marketcetera.trade.TradeMessage)
*/
@@ -125,18 +129,10 @@ public void receiveTradeMessage(TradeMessage inTradeMessage)
updateReports();
}
/* (non-Javadoc)
- * @see org.marketcetera.ui.view.ContentView#getScene()
- */
- @Override
- public Scene getScene()
- {
- return mainScene;
- }
- /* (non-Javadoc)
- * @see org.marketcetera.ui.view.ContentView#onClose(javafx.stage.WindowEvent)
+ * @see org.marketcetera.ui.view.ContentView#onClose()
*/
@Override
- public void onClose(WindowEvent inEvent)
+ public void onClose()
{
tradeClientService.removeTradeMessageListener(this);
}
@@ -489,11 +485,11 @@ protected Node getPlaceholder()
/**
* Create a new AbstractFixMessageView instance.
*
- * @param inParentWindow a Stage
value
+ * @param inParentWindow a Node
value
* @param inNewWindowEvent a NewWindowEvent
value
* @param inViewProperties a Properties
value
*/
- protected AbstractFixMessageView(Stage inParentWindow,
+ protected AbstractFixMessageView(Node inParentWindow,
NewWindowEvent inEvent,
Properties inViewProperties)
{
@@ -502,7 +498,6 @@ protected AbstractFixMessageView(Stage inParentWindow,
inViewProperties);
}
protected static final DateTimeFormatter isoDateFormatter = TimeFactoryImpl.FULL_MILLISECONDS;
- protected Scene mainScene;
protected TradeClientService tradeClientService;
protected int currentPage;
protected int pageSize;
diff --git a/photon/src/main/java/org/marketcetera/ui/trade/view/AbstractTradeViewFactory.java b/photon/src/main/java/org/marketcetera/ui/trade/view/AbstractTradeViewFactory.java
index 312dd31e79..ac783b3316 100644
--- a/photon/src/main/java/org/marketcetera/ui/trade/view/AbstractTradeViewFactory.java
+++ b/photon/src/main/java/org/marketcetera/ui/trade/view/AbstractTradeViewFactory.java
@@ -53,8 +53,8 @@ public void run()
*/
protected PairStage
value
+ * @param inParentWindow a Node
value
* @param inNewWindowEvent a NewWindowEvent
value
* @param inViewProperties a Properties
value
*/
- public AveragePriceView(Stage inParentWindow,
+ public AveragePriceView(Node inParentWindow,
NewWindowEvent inEvent,
Properties inViewProperties)
{
diff --git a/photon/src/main/java/org/marketcetera/ui/trade/view/fills/FillsView.java b/photon/src/main/java/org/marketcetera/ui/trade/view/fills/FillsView.java
index e84abf9951..37d819640c 100644
--- a/photon/src/main/java/org/marketcetera/ui/trade/view/fills/FillsView.java
+++ b/photon/src/main/java/org/marketcetera/ui/trade/view/fills/FillsView.java
@@ -11,7 +11,7 @@
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-import javafx.stage.Stage;
+import javafx.scene.Node;
/* $License$ */
@@ -30,11 +30,11 @@ public class FillsView
/**
* Create a new FillsView instance.
*
- * @param inParentWindow a Stage
value
+ * @param inParentWindow a Node
value
* @param inNewWindowEvent a NewWindowEvent
value
* @param inViewProperties a Properties
value
*/
- public FillsView(Stage inParentWindow,
+ public FillsView(Node inParentWindow,
NewWindowEvent inEvent,
Properties inViewProperties)
{
diff --git a/photon/src/main/java/org/marketcetera/ui/trade/view/openorders/OpenOrderView.java b/photon/src/main/java/org/marketcetera/ui/trade/view/openorders/OpenOrderView.java
index cd0d9d08a1..811532f02e 100644
--- a/photon/src/main/java/org/marketcetera/ui/trade/view/openorders/OpenOrderView.java
+++ b/photon/src/main/java/org/marketcetera/ui/trade/view/openorders/OpenOrderView.java
@@ -18,7 +18,6 @@
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
-import javafx.stage.Stage;
/* $License$ */
@@ -47,11 +46,11 @@ public String getViewName()
/**
* Create a new OpenOrderView instance.
*
- * @param inParentWindow a Stage
value
+ * @param inParentWindow a Node
value
* @param inNewWindowEvent a NewWindowEvent
value
* @param inViewProperties a Properties
value
*/
- public OpenOrderView(Stage inParentWindow,
+ public OpenOrderView(Node inParentWindow,
NewWindowEvent inEvent,
Properties inViewProperties)
{
diff --git a/photon/src/main/java/org/marketcetera/ui/trade/view/orderticket/OrderTicketView.java b/photon/src/main/java/org/marketcetera/ui/trade/view/orderticket/OrderTicketView.java
index 0870cbc62c..9ed72062cb 100644
--- a/photon/src/main/java/org/marketcetera/ui/trade/view/orderticket/OrderTicketView.java
+++ b/photon/src/main/java/org/marketcetera/ui/trade/view/orderticket/OrderTicketView.java
@@ -63,7 +63,7 @@
import javafx.beans.value.ObservableValue;
import javafx.event.EventHandler;
import javafx.geometry.Orientation;
-import javafx.scene.Scene;
+import javafx.scene.Node;
import javafx.scene.control.Accordion;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
@@ -88,8 +88,6 @@
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
-import javafx.stage.Stage;
-import javafx.stage.WindowEvent;
/* $License$ */
@@ -106,13 +104,14 @@ public class OrderTicketView
extends AbstractContentView
implements ContentView,BrokerStatusListener
{
+
/* (non-Javadoc)
- * @see org.marketcetera.ui.view.ContentView#getScene()
+ * @see org.marketcetera.ui.view.ContentView#getNode()
*/
@Override
- public Scene getScene()
+ public Node getNode()
{
- return scene;
+ return rootLayout;
}
/* (non-Javadoc)
* @see org.marketcetera.brokers.BrokerStatusListener#receiveBrokerStatus(org.marketcetera.fix.ActiveFixSession)
@@ -161,10 +160,10 @@ public void run()
}
}
/* (non-Javadoc)
- * @see org.marketcetera.ui.view.ContentView#onClose(javafx.stage.WindowEvent)
+ * @see org.marketcetera.ui.view.ContentView#onClose()
*/
@Override
- public void onClose(WindowEvent inEvent)
+ public void onClose()
{
try {
serviceManager.getService(AdminClientService.class).removeBrokerStatusListener(this);
@@ -190,7 +189,6 @@ public void start()
hashCode());
rootLayout = new VBox();
orderTicketLayout = new GridPane();
- scene = new Scene(rootLayout);
// create controls and layouts
brokerLabel = new Label("Broker");
brokerComboBox = new ComboBox<>();
@@ -614,7 +612,7 @@ public void handle(MouseEvent inEvent)
KeyCombination sendKeyCombination = new KeyCodeCombination(KeyCode.ENTER);
Mnemonic sendMnemonic = new Mnemonic(sendButton,
sendKeyCombination);
- scene.addMnemonic(sendMnemonic);
+ // TODO add mnemonic?
sendClearLayout.getChildren().addAll(sendButton,
clearButton);
sendButton.setOnMouseClicked(inEvent -> {
@@ -706,7 +704,8 @@ public void handle(MouseEvent inEvent)
// Type.TRAY_NOTIFICATION);
if(replaceExecutionReportOption.isPresent()) {
// close containing ticket
- getParentWindow().close();
+ // TODO need to trigger a close action
+ getParentWindow().setVisible(false);
} else {
// partially clear ticket
resetTicket(false);
@@ -739,11 +738,11 @@ public void handle(MouseEvent inEvent)
/**
* Create a new OrderTicketView instance.
*
- * @param inParent a Window
value
+ * @param inParent a Node
value
* @param inNewWindowEvent a NewWindowEvent
value
* @param inProperties a Properties
value
*/
- public OrderTicketView(Stage inParent,
+ public OrderTicketView(Node inParent,
NewWindowEvent inEvent,
Properties inProperties)
{
@@ -931,10 +930,6 @@ public StringProperty valueProperty()
* root container for the scene
*/
private GridPane orderTicketLayout;
- /**
- * main scene object
- */
- private Scene scene;
/**
* provides access to style services
*/
diff --git a/photon/src/main/java/org/marketcetera/ui/trade/view/reports/ReportsView.java b/photon/src/main/java/org/marketcetera/ui/trade/view/reports/ReportsView.java
index 70f36997af..39d93f1294 100644
--- a/photon/src/main/java/org/marketcetera/ui/trade/view/reports/ReportsView.java
+++ b/photon/src/main/java/org/marketcetera/ui/trade/view/reports/ReportsView.java
@@ -19,6 +19,7 @@
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
+import javafx.scene.Node;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.ButtonBar;
@@ -29,7 +30,6 @@
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
-import javafx.stage.Stage;
/* $License$ */
@@ -49,11 +49,11 @@ public class ReportsView
/**
* Create a new ReportsView instance.
*
- * @param inParentWindow a Stage
value
+ * @param inParentWindow a Node
value
* @param inNewWindowEvent a NewWindowEvent
value
* @param inViewProperties a Properties
value
*/
- public ReportsView(Stage inParentWindow,
+ public ReportsView(Node inParentWindow,
NewWindowEvent inEvent,
Properties inViewProperties)
{
diff --git a/photon/src/main/java/org/marketcetera/ui/view/AbstractContentView.java b/photon/src/main/java/org/marketcetera/ui/view/AbstractContentView.java
index cc55e8e8ae..0625447f7f 100644
--- a/photon/src/main/java/org/marketcetera/ui/view/AbstractContentView.java
+++ b/photon/src/main/java/org/marketcetera/ui/view/AbstractContentView.java
@@ -11,7 +11,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
-import javafx.stage.Stage;
+import javafx.scene.Node;
/* $License$ */
@@ -37,9 +37,9 @@ protected Properties getViewProperties()
/**
* Get the parentWindow value.
*
- * @return a Stage
value
+ * @return a Node
value
*/
- protected Stage getParentWindow()
+ protected Node getParentWindow()
{
return parentWindow;
}
@@ -55,11 +55,11 @@ protected NewWindowEvent getNewWindowEvent()
/**
* Create a new AbstractContentView instance.
*
- * @param inParentWindow a Stage
value
+ * @param inParentWindow a Node
value
* @param inNewWindowEvent a NewWindowEvent
value
* @param inViewProperties a Properties
value
*/
- protected AbstractContentView(Stage inParentWindow,
+ protected AbstractContentView(Node inParentWindow,
NewWindowEvent inEvent,
Properties inViewProperties)
{
@@ -104,7 +104,7 @@ protected AbstractContentView(Stage inParentWindow,
/**
* parent window that owns the view
*/
- private final Stage parentWindow;
+ private final Node parentWindow;
/**
* properties used to seed the view
*/
diff --git a/photon/src/main/java/org/marketcetera/ui/view/AbstractContentViewFactory.java b/photon/src/main/java/org/marketcetera/ui/view/AbstractContentViewFactory.java
index f8c1f160fc..f4cf999ace 100644
--- a/photon/src/main/java/org/marketcetera/ui/view/AbstractContentViewFactory.java
+++ b/photon/src/main/java/org/marketcetera/ui/view/AbstractContentViewFactory.java
@@ -7,7 +7,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
-import javafx.stage.Window;
+import javafx.scene.Node;
/* $License$ */
@@ -25,7 +25,7 @@ public abstract class AbstractContentViewFactory
* @see org.marketcetera.web.view.ContentViewFactory#create(com.vaadin.ui.Window, org.marketcetera.web.events.NewWindowEvent, java.util.Properties)
*/
@Override
- public ContentView create(Window inParent,
+ public ContentView create(Node inParent,
NewWindowEvent inEvent,
Properties inViewProperties)
{
diff --git a/photon/src/main/java/org/marketcetera/ui/view/ContentView.java b/photon/src/main/java/org/marketcetera/ui/view/ContentView.java
index 4a47d9445d..328b038b72 100644
--- a/photon/src/main/java/org/marketcetera/ui/view/ContentView.java
+++ b/photon/src/main/java/org/marketcetera/ui/view/ContentView.java
@@ -1,7 +1,6 @@
package org.marketcetera.ui.view;
-import javafx.scene.Scene;
-import javafx.stage.WindowEvent;
+import javafx.scene.Node;
/* $License$ */
@@ -15,11 +14,11 @@
public interface ContentView
{
/**
- * Get the scene which contains the content.
+ * Contains the root content of the view.
*
- * @return a Scene
value
+ * @return a Node
value
*/
- Scene getScene();
+ Node getNode();
/**
* Get the Vaadin name of the view.
*
@@ -28,8 +27,6 @@ public interface ContentView
String getViewName();
/**
* Invoked when the content view is closed.
- *
- * @param inEvent a WindowEvent
value
*/
- default void onClose(WindowEvent inEvent) {}
+ default void onClose() {}
}
diff --git a/photon/src/main/java/org/marketcetera/ui/view/ContentViewFactory.java b/photon/src/main/java/org/marketcetera/ui/view/ContentViewFactory.java
index b69b04dbbc..3dd34d283f 100644
--- a/photon/src/main/java/org/marketcetera/ui/view/ContentViewFactory.java
+++ b/photon/src/main/java/org/marketcetera/ui/view/ContentViewFactory.java
@@ -4,7 +4,7 @@
import org.marketcetera.ui.events.NewWindowEvent;
-import javafx.stage.Window;
+import javafx.scene.Node;
/* $License$ */
@@ -20,12 +20,12 @@ public interface ContentViewFactory
/**
* Create a new content view.
*
- * @param inParent a Window
value
+ * @param inParent a Node
value
* @param inEvent a NewWindowEvent
value
* @param inViewProperties a Properties
value
* @return a T
value
*/
- ContentView create(Window inParent,
+ ContentView create(Node inParent,
NewWindowEvent inEvent,
Properties inViewProperties);
}
diff --git a/photon/src/main/resources/dark-mode.css b/photon/src/main/resources/dark-mode.css
index 58978555f5..4d5fc720ea 100644
--- a/photon/src/main/resources/dark-mode.css
+++ b/photon/src/main/resources/dark-mode.css
@@ -7,6 +7,23 @@
-fx-font-size: 12px;
}
+.view {
+ -fx-background-color: derive(-fx-base,45%);
+ background-color: derive(-fx-base,45%);
+ -fx-padding: 5 5 5 5;
+ padding: 5 5 5 5;
+ -fx-border-style: solid;
+ border-style: solid;
+ -fx-border-width: 1px;
+ border-width: 1px;
+ -fx-background-radius: 5px;
+ -fx-border-radius: 5px;
+ border-radius: 5px;
+ -fx-border-color: black;
+ border-color: black;
+/* this is cool but seems to prevent resizing -fx-effect: dropshadow(three-pass-box, rgba(0, 0, 0, 0.8), 10, 0, 0, 0); */
+}
+
.label{
-fx-text-fill: lightgray;
}
@@ -87,3 +104,13 @@
-fx-text-fill: #000;
-fx-alignment: top-left;
}
+
+.title-bar {
+ -fx-padding: 10px;
+ -fx-background-color: #676666;
+ }
+
+.title-bar Label {
+ -fx-text-fill: white;
+}
+
diff --git a/photon/src/main/resources/log4j2.xml b/photon/src/main/resources/log4j2.xml
index 8c046732fb..40eaaafb99 100644
--- a/photon/src/main/resources/log4j2.xml
+++ b/photon/src/main/resources/log4j2.xml
@@ -11,6 +11,5 @@