Skip to content

Commit

Permalink
Heavy refactoring for multiple controllers
Browse files Browse the repository at this point in the history
This refactors the codebase to use multiple controller instances to
support object searches from different parts of the application.
  • Loading branch information
io7m committed Jun 16, 2024
1 parent 69bf342 commit b1c120c
Show file tree
Hide file tree
Showing 105 changed files with 4,141 additions and 2,208 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import com.io7m.cardant.model.comparisons.CAComparisonExactType.Anything;
import com.io7m.cardant.model.comparisons.CAComparisonExactType.IsEqualTo;
import com.io7m.cardant.model.comparisons.CAComparisonExactType.IsNotEqualTo;
import com.io7m.cardant_gui.ui.internal.CAGMainItemSearchView;
import com.io7m.cardant_gui.ui.internal.CAGItemSearchView;
import com.io7m.cardant_gui.ui.internal.CAGMetaMatchNodeType;
import com.io7m.cardant_gui.ui.internal.CAGMetaMatchTree;
import com.io7m.cardant_gui.ui.internal.CAGStrings;
Expand All @@ -57,7 +57,7 @@ public final class CAGMetaMatchTreeTest
private CAGStrings strings;
private RPServiceDirectory services;
private Parent pane;
private CAGMainItemSearchView controller;
private CAGItemSearchView controller;
private TreeView<CAGMetaMatchNodeType> treeView;
private CAGMetaMatchTree metaTree;

Expand Down
5 changes: 5 additions & 0 deletions com.io7m.cardant_gui.ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
<artifactId>javafx-graphics</artifactId>
</dependency>

<dependency>
<groupId>com.io7m.jaffirm</groupId>
<artifactId>com.io7m.jaffirm.core</artifactId>
</dependency>

<dependency>
<groupId>com.io7m.seltzer</groupId>
<artifactId>com.io7m.seltzer.api</artifactId>
Expand Down
Binary file modified com.io7m.cardant_gui.ui/src/main/images/images.xcf
Binary file not shown.
Binary file modified com.io7m.cardant_gui.ui/src/main/images/images16.xcf
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,39 @@
import com.io7m.cardant_gui.ui.internal.CAGClientServiceType;
import com.io7m.cardant_gui.ui.internal.CAGController;
import com.io7m.cardant_gui.ui.internal.CAGControllerType;
import com.io7m.cardant_gui.ui.internal.CAGEventService;
import com.io7m.cardant_gui.ui.internal.CAGEventServiceType;
import com.io7m.cardant_gui.ui.internal.CAGFileChoosers;
import com.io7m.cardant_gui.ui.internal.CAGFileChoosersType;
import com.io7m.cardant_gui.ui.internal.CAGFileListView;
import com.io7m.cardant_gui.ui.internal.CAGFileSearchView;
import com.io7m.cardant_gui.ui.internal.CAGFileSelectDialogs;
import com.io7m.cardant_gui.ui.internal.CAGFileTransferController;
import com.io7m.cardant_gui.ui.internal.CAGFileTransferControllerType;
import com.io7m.cardant_gui.ui.internal.CAGFileViewDialogs;
import com.io7m.cardant_gui.ui.internal.CAGItemAttachmentAddDialogs;
import com.io7m.cardant_gui.ui.internal.CAGItemDetailsView;
import com.io7m.cardant_gui.ui.internal.CAGItemSearchView;
import com.io7m.cardant_gui.ui.internal.CAGItemSelectDialogs;
import com.io7m.cardant_gui.ui.internal.CAGItemTableView;
import com.io7m.cardant_gui.ui.internal.CAGLocationAttachmentAddDialogs;
import com.io7m.cardant_gui.ui.internal.CAGLocationDetailsView;
import com.io7m.cardant_gui.ui.internal.CAGLocationReparentDialogs;
import com.io7m.cardant_gui.ui.internal.CAGLocationSelectDialogs;
import com.io7m.cardant_gui.ui.internal.CAGLocationTreeView;
import com.io7m.cardant_gui.ui.internal.CAGMainAuditSearchView;
import com.io7m.cardant_gui.ui.internal.CAGMainAuditTableView;
import com.io7m.cardant_gui.ui.internal.CAGMainFileListView;
import com.io7m.cardant_gui.ui.internal.CAGMainFileSearchView;
import com.io7m.cardant_gui.ui.internal.CAGMainItemDetailsView;
import com.io7m.cardant_gui.ui.internal.CAGMainItemSearchView;
import com.io7m.cardant_gui.ui.internal.CAGMainItemTableView;
import com.io7m.cardant_gui.ui.internal.CAGMainLocationDetailsView;
import com.io7m.cardant_gui.ui.internal.CAGMainLocationSearchView;
import com.io7m.cardant_gui.ui.internal.CAGMainLocationTableView;
import com.io7m.cardant_gui.ui.internal.CAGMainStockSearchView;
import com.io7m.cardant_gui.ui.internal.CAGMainStockTableView;
import com.io7m.cardant_gui.ui.internal.CAGMainFilesView;
import com.io7m.cardant_gui.ui.internal.CAGMainItemsView;
import com.io7m.cardant_gui.ui.internal.CAGMainLocationsView;
import com.io7m.cardant_gui.ui.internal.CAGMainStockView;
import com.io7m.cardant_gui.ui.internal.CAGMainTypePackageDetailsView;
import com.io7m.cardant_gui.ui.internal.CAGMainTypePackageSearchView;
import com.io7m.cardant_gui.ui.internal.CAGMainTypePackageTableView;
import com.io7m.cardant_gui.ui.internal.CAGMainView;
import com.io7m.cardant_gui.ui.internal.CAGStatusService;
import com.io7m.cardant_gui.ui.internal.CAGStockSearchView;
import com.io7m.cardant_gui.ui.internal.CAGStockTableView;
import com.io7m.cardant_gui.ui.internal.CAGStringConstants;
import com.io7m.cardant_gui.ui.internal.CAGStrings;
import com.io7m.cardant_gui.ui.internal.CAGStringsType;
Expand All @@ -62,6 +72,8 @@
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Locale;
import java.util.Map;
Expand All @@ -74,6 +86,9 @@

public final class CAGApplication extends Application
{
private static final Logger LOG =
LoggerFactory.getLogger(CAGApplication.class);

private final ApplicationDirectoriesType directories;

/**
Expand Down Expand Up @@ -129,25 +144,45 @@ public void start(
CAGFileViewDialogs.class,
new CAGFileViewDialogs(services)
);
services.register(
CAGItemAttachmentAddDialogs.class,
new CAGItemAttachmentAddDialogs(services)
);
services.register(
CAGLocationAttachmentAddDialogs.class,
new CAGLocationAttachmentAddDialogs(services)
);
services.register(
CAGLocationSelectDialogs.class,
new CAGLocationSelectDialogs(services)
);
services.register(
CAGItemAttachmentAddDialogs.class,
new CAGItemAttachmentAddDialogs(services)
);
services.register(
CAGLocationReparentDialogs.class,
new CAGLocationReparentDialogs(services)
);
services.register(
CAGFileSelectDialogs.class,
new CAGFileSelectDialogs(services)
);
services.register(
CAGItemSelectDialogs.class,
new CAGItemSelectDialogs(services)
);

final var status = new CAGStatusService();
services.register(CAGStatusService.class, status);

final var clientService = new CAGClientService(status, strings);
final var events = CAGEventService.create();
services.register(CAGEventServiceType.class, events);

final var clientService = new CAGClientService(status, events, strings);
services.register(CAGClientServiceType.class, clientService);

services.register(
CAGFileTransferControllerType.class,
CAGFileTransferController.create(clientService)
);

final var controller = CAGController.create(clientService);
services.register(CAGControllerType.class, controller);

Expand All @@ -167,69 +202,83 @@ public void start(
() -> new CAGMainView(services)
),
Map.entry(
CAGMainItemDetailsView.class,
() -> new CAGMainItemDetailsView(services)
CAGMainItemsView.class,
() -> new CAGMainItemsView(services)
),
Map.entry(
CAGMainItemSearchView.class,
() -> new CAGMainItemSearchView(services)
CAGItemSearchView.class,
() -> new CAGItemSearchView(services)
),
Map.entry(
CAGMainStockSearchView.class,
() -> new CAGMainStockSearchView(services)
CAGItemTableView.class,
() -> new CAGItemTableView(services)
),
Map.entry(
CAGMainStockTableView.class,
() -> new CAGMainStockTableView(services)
CAGItemDetailsView.class,
() -> new CAGItemDetailsView(services)
),
Map.entry(
CAGMainItemTableView.class,
() -> new CAGMainItemTableView(services)
CAGMainLocationsView.class,
() -> new CAGMainLocationsView(services)
),
Map.entry(
CAGMainFileSearchView.class,
() -> new CAGMainFileSearchView(services)
CAGFileSearchView.class,
() -> new CAGFileSearchView(services)
),
Map.entry(
CAGMainFileListView.class,
() -> new CAGMainFileListView(services)
CAGMainFilesView.class,
() -> new CAGMainFilesView(services)
),
Map.entry(
CAGMainAuditSearchView.class,
() -> new CAGMainAuditSearchView(services)
CAGMainStockView.class,
() -> new CAGMainStockView(services)
),
Map.entry(
CAGMainAuditTableView.class,
() -> new CAGMainAuditTableView(services)
CAGMainTypePackageSearchView.class,
() -> new CAGMainTypePackageSearchView(services)
),
Map.entry(
CAGMainTypePackageTableView.class,
() -> new CAGMainTypePackageTableView(services)
),
Map.entry(
CAGMainTypePackageDetailsView.class,
() -> new CAGMainTypePackageDetailsView(services)
),
Map.entry(
CAGMainTypePackageSearchView.class,
() -> new CAGMainTypePackageSearchView(services)
CAGMainAuditSearchView.class,
() -> new CAGMainAuditSearchView(services)
),
Map.entry(
CAGMainTypePackageTableView.class,
() -> new CAGMainTypePackageTableView(services)
CAGMainAuditTableView.class,
() -> new CAGMainAuditTableView(services)
),
Map.entry(
CAGMainLocationDetailsView.class,
() -> new CAGMainLocationDetailsView(services)
CAGFileListView.class,
() -> new CAGFileListView(services)
),
Map.entry(
CAGMainLocationSearchView.class,
() -> new CAGMainLocationSearchView(services)
CAGStockSearchView.class,
() -> new CAGStockSearchView(services)
),
Map.entry(
CAGMainLocationTableView.class,
() -> new CAGMainLocationTableView(services)
CAGStockTableView.class,
() -> new CAGStockTableView(services)
),
Map.entry(
CAGLocationTreeView.class,
() -> new CAGLocationTreeView(services)
),
Map.entry(
CAGLocationDetailsView.class,
() -> new CAGLocationDetailsView(services)
)
);

loader.setControllerFactory(
clazz -> {
LOG.debug("Resolving controller {}", clazz);

final var supplier = controllers.get(clazz);
if (supplier == null) {
throw new IllegalStateException(
Expand Down
Loading

0 comments on commit b1c120c

Please sign in to comment.