Open with on OSX

2014. 11. 20.

I managed to create an app template that handles document opening events recieved from OSX by creating a child process with the path as argument. This way the NoteTaker can now be opened via the open with command. When NoteTaker is opened with command line arguments it simply loads the given notes into the DocumentList instead loading the deafult direactory.

Minimizing Code

2014. 06. 25.

The architecture is a nice and extendable structure. But it has some drawbacks. Minor speed reduction due to the fact that every event in the view classes need to call through the assigned listeners, probably not noticable, and the overhead of managing much more code. I usually like to implement things as in the big book, but I also think that sometimes it is better to simply merge view and control classes. So that is what I did.

Also some new features were implemented. The preview is now not shown when the Document instaces previewAllowed method return false. Basically that means that plain text documents are not rendered as HTML. I created the callback for the new note menu item. It opens a Window subclass which adds a TextField and two Buttons to it. It is constructed with the DocumentList and the button click calls its create method.

View-Control Architecture

2014. 06. 20.

I have created a DocumentList class for managing multiple documents with selection change listener and other operations, and the corresponding DocumentListView class. It builds a simple layout to put the buttons in. There is also the DoucmentButton. When the List creates the View then it calls the contained Document instances button building methods. These methods also assign the proper methods in the List to the events.

Also a main class was created to put the basic layout and these document classes together. It is a simple three column layout. One for the documents and a splitter for the editor and preview. This main class assigns the proper methods to the selection changed event and also a text changed listener to the editor view. This listener updates the current documents content and uses the documents processor to convert the text and put it into the WebView instance. It also creates the menu, but the menu items are not working yet.

Implementation Babysteps

2014. 06. 18.

First I did convert my SmallMark implementation written in D to Java code. It was not a hard task, the most annoying thing was to convert every dynamic array in D to Java List instances and call the proper methods. This was the boring part.

It was obvious to me that I will create a Document interface which can be used to determine the actions available and the Processor to be used for rendering. The Processor is also an interface with one method. It converts the input text to the HTML to preview. So these sources look like this:

    • core
    • Document
    • Processor
    • Plain
    • PlainDocument
    • PlainProcessor
    • HTML
    • HTMLDocument
    • HTMLProcessor
    • Small
    • SmallDocument
    • SmallProcessor

Starting NoteTaker

2014. 06. 16.

As SmallMark started to take better shape, I thought it would be useful to create a note taking app based on it. Initially I created a simple realtime converting and rendering solution to try the markup language. But I got in the mood to create a whole desktop application.

I never created a full desktop application before. There is the MineSweeper and some games and experiments, but those are not the same. This app should handle saving and loading and some other complex functionalities like switching and removing document.

First I eveluated languages and widget toolkits. I decided that the best is to go with JavaFX. I am not a great Java fan, it has poor support for native compilation, no generics and no operator overloading, but mostly I am comfortable with it.

JavaFX is a powerful framework with a nice and familiar API. Familiar since I have been working with a similar Java GUI API for two years at work. Being able to design widgets with CSS, precisely aligning and coloring them is a nice thing.