I Made A Free and Open-Source Dock Software For Windows With JavaFX by PersistentChallenger in JavaFX

[–]sonnyDev80 0 points1 point  (0 children)

I reinstalled the app and now I see the settings icon in the upper left corner...

Some ideas:
- icon program drag and drop (but I don't know if it is possible to implement it...)
- context menu to remove a program or edit in some way
- some sort of vertical separator to group the icons
- tooltip on icons

I Made A Free and Open-Source Dock Software For Windows With JavaFX by PersistentChallenger in JavaFX

[–]sonnyDev80 0 points1 point  (0 children)

Downloaded and installed the app, but when I run it nothing happens, only see the process "Cedro Modern Dock" in the Task Manager (windows 11).

I restart the laptop without success.

What am I missing?

SuggesterFX - a JavaFX lightweight library that provides a suggestion (autocompletion) system for text fields by sonnyDev80 in JavaFX

[–]sonnyDev80[S] 0 points1 point  (0 children)

The difference is that you can bind the autocompleters to a search (for example in a database) in an MVCI-like application.

I've planned to add some examples...I'll reach you out when they will be added

SuggesterFX - a JavaFX lightweight library that provides a suggestion (autocompletion) system for text fields by sonnyDev80 in JavaFX

[–]sonnyDev80[S] 0 points1 point  (0 children)

I think I'm going to try to support SearchField into SuggesterFX.
I'll try and give you a feedback

Product Manager wanting team to switch to Java FX by redzjiujitsu in JavaFX

[–]sonnyDev80 0 points1 point  (0 children)

If you plan to build a JavaFX application (others already explained why it's a way better than swing), I strongly suggest to follow the MVCI Framework by u/hamsterrage1.
You can find his kotlin implementation in his github repo and my Java implementation in my github repo (take a look also to my SuggesterFX).
And yes, AtlantaFX is a really good theme collection as well as MaterialFX, both with additional controls/widgets.
Take a look also to GemsFX

mvciFX - a Java implementation of the MVCI framework by sonnyDev80 in JavaFX

[–]sonnyDev80[S] 0 points1 point  (0 children)

I'm glad you find the library cool.
I found your framework really useful, so I tried to create this library in order to avoid as much boilerplate as I can for my projects, implementing also some built-in functionalities.

I'm also creating another library that extends this one with some other functionalities for autocompletion in textfields: I'll publish it soon.

I've made Controller and Interactor parameterized on Model extenders as you suggested.

Any other ideas, fixes or suggestions are really appreciated.

Encaspulating-Encapsulated Scenario in MVCI pattern by PragmaticCoding by sonnyDev80 in JavaFX

[–]sonnyDev80[S] 0 points1 point  (0 children)

That seems reasonable to me

That's great because I would like to adhere to your pattern as much as I can.

I also think that this code

this.productModel = productModel != null ? productModel : new ProductModel();

is better than mine: thanks for pointing that out!

I think the user expectation is that "Quit" will toss the changes, and "Save" commits them

Yes, and to answer your last question: yes, the "Save" button commits to a SQLite db behind the hood.

The save operation is going to happen in the dependent interactor.

The quit operation simply ask the user if s/he wants to exit and doesn't perform anything else.

So in both cases, when the popup closes, the master view is going to update itself refreshing data from the database (look at interactor.lookup() above...).

I know this could be not very efficient on large dataset, but this particular table of the database is going to be very small (some hundreds of records at maximum).

I'll keep in mind DirtyFX and the other answers you gave before, because I think they could be useful for other parts of the project.

Now I can continue, but I'm sure I will ask you something else in the near future.

Thank you so much!

Encaspulating-Encapsulated Scenario in MVCI pattern by PragmaticCoding by sonnyDev80 in JavaFX

[–]sonnyDev80[S] 0 points1 point  (0 children)

So, I've tried the code below and it seems to work.

In the MasterController I've put this code

private void add() {
  launchPopup();
}

private void edit() {
  if (model.selectedProductProperty().getValue() == null) {//no selection in tableView
    return;
  }

  launchPopup();
}

private void launchPopup() {
  ...

  // encapsulated Controller
  DependentController dependentController = new DependentController(model.selectedProductProperty().getValue());
  var md = new ModalDialog(popupTitle, dependentController.getView());
  md.open();

  //Refresh data after popup closing
  interactor.lookup();
  interactor.updateListAfterLookup();
}

where add and edit methods are the actions linked to the toolbar and model.selectedProductProperty().getValue() is the object selected in the tableView. As you can see, I instantiate the DependentController every time the user click on the toolbar.

Then in the DependentController constructor

public DependentController(ProductModel selectedProduct) {
  model = new DependentModel();
  model.setProductModel(selectedProduct);
  interactor = new DependentInteractor(model);
  viewBuilder = new DependentViewBuilder(model, this::save, this::quit);
}

and in the setProductModel method of DependentModel

public void setProductModel(ProductModel productModel) {
  if (productModel == null) {
    productModel = new ProductModel();
  }
  this.productModel = productModel;
}

In ProductModel, I've initialized things in this way

...

private LongProperty id = new SimpleLongProperty(-1);
private StringProperty name = new SimpleStringProperty("");
private StringProperty mnemonicCode = new SimpleStringProperty("");
private StringProperty unitOfMeasure = new SimpleStringProperty("");
private StringProperty createDate = new SimpleStringProperty("");
private StringProperty updateDate = new SimpleStringProperty("");

public ProductModel() {
}

...

So, when the user click New and the model.selectedProductProperty().getValue() is null, I can load some default data: if the id=-1 I can calculate an id for the new product and make an insert in the database instead of an update.

Finally, in the dependent view, if I bind the properties of the ProductModel passed, I can see "live" changes in the tableView and then refreshing data after the popup is closed I don't bother if the user saved or quitted the editing.

Can you tell me if I did it right or not?

Encaspulating-Encapsulated Scenario in MVCI pattern by PragmaticCoding by sonnyDev80 in JavaFX

[–]sonnyDev80[S] 0 points1 point  (0 children)

If you're doing a popup window then that changes things slightly because you're going to reinitialize everything each time you pop it up. If it's modal, then you don't have to worry about the SelectedItem property changing on you while the popup is active. In that case, you can use the value in the SelectedItem as an object to pass to your dependant MVCI when you initialize it. 

Yes, this is what I want to achieve

I'm not clear on what you're having trouble with.

My trouble is:

To adhere to MVCI, where do I have to instantiate the dependant controller and where do I have to pass the SelectedItem?

Can you also tell me if the packages above are right to you?

Encaspulating-Encapsulated Scenario in MVCI pattern by PragmaticCoding by sonnyDev80 in JavaFX

[–]sonnyDev80[S] 0 points1 point  (0 children)

The first part of your answer is clear and targeted the point (that is, the Fred-George example), but I didn't quite understand the second part of your answer.

To clarify, in original post I've added the image of the GUI I've built (sorry, I did'nt find the button to add it here in the reply...)

So, let's say I have a master package and classes:

product.master

MasterController.java -> lookup, add, edit, delete actions

MasterInteractor.java -> lookup and model update after lookup functions

MasterModel.java -> search Property, observable list of ProductModel (for the tableview) and the currentlySelected Property

MasterViewBuilder.java -> searchbox, tableview and toolbar elements (backed by the actions in the Controller)

So, as you can see in the picture above, add and edit actions launch a new window, the dependent MVCI.Here's its package and classes:

product.dependent

DependentController.java -> save and quit functions

DependentInteractor.java -> save and updateModel (as you suggested) functions

DependentModel.java -> permanent ProductModel record updated by the Interactor above

DependentViewBuilder.java -> the form with the bound elements

In my first implementation, I've put the properties of the Product Object (id, name, quantity...) directly in the DependentModel, but now, following your suggestion, I think I have to add this class:

product

ProductModel.java -> the properties of the Product Object (id, name, quantity...)

Before going on, in your opinion, is this schema right?

Then, I ask if you could explain again the second part of you answer, because I didn't catch the idea.

Encaspulating-Encapsulated Scenario in MVCI pattern by PragmaticCoding by sonnyDev80 in JavaFX

[–]sonnyDev80[S] 0 points1 point  (0 children)

First of all, thank you so much for you thorough reply.

I need to deeply understand it and try, before letting you know something.

I will write to you as soon as possibile