Modules in The Console – Take One

In previous posts (linked in the Summary) I discussed a topic of implementing modules in The Console. This time I'm going to describe my first step in this direction.

Currently The Console supports simple scripts - one .js file is one script, i.e.  scripts/info/currency.js  is just a  currency  command.

But that's not enough. I want the modules, too. Here's how I make them real.

→ Continue reading

Build Runnable JAR of Xtend + JavaFX project in Maven

After a long research I've found a site that helps with compiling Xtend using Maven - - pretty straightforward, isn't it? However, it lacks a few more things.

My goal was to compile and package Java 8 project together with JavaFX, written mostly in Xtend (in place of Java) with unpacked libraries into one Runnable JAR. In the end I'd like it to be compatible with e(fx)clipse IDE. Here's how.

→ Continue reading

The state of importing node.js modules into Java

As I noticed in previous article about script management I'd like to support script sharing in The Console. This topic automatically brings idea of supporting Node.js modules. Nashorn doesn't provide any kind of module import/export mechanism like CommonJS. However, it's doable to provide custom require() and module.exports. But is it possible to really import Node.js modules or anything from npm?

→ Continue reading

REPL or even better

Read-eval-print loop is quite useful kind of tool that simplifies both learning and trying some short code ideas. REPLs are always very specific - they can be used for evaluating programming language statements, some math calculation, database management, file processing and so on. In The Console I decided having all those things and even more - way to incorporate custom REPLs.

However, idea have grown much more than expected. In this post I explain what's the big deal to talk about which shows why the development have currently slowed down.

→ Continue reading

Power of lambda in Xtend

The Console supports multiple tabs. By hitting CTRL+T  combination new tab is opened and auto-named. I decided to name tabs as "Tab 1", "Tab 2", etc. However, those tabs can be renamed and moved inbetween so auto-naming need an algorithm. I've done similiar operation few times but never done this specific things by using Lambda Expressions in Xtend. I was quite surprised by one small detail.

→ Continue reading

The Console: script management

The biggest feature of my console software is ability to code own "commands" - scripts. It's supposed to be easy and quick for programmers. I'm not trying to design my own DSL language or make users install some weird packages into system. JavaScript and console API is all you need to know to code your custom scripts.

If one of goals of The Console project is to make easy custom scripting then it's logical that you need some way to manage your scripts. Putting all scripts in one file or even all scripts in one folder would be a mess. So, how to manage those files? How The Console deals with it?

→ Continue reading

JavaFX: comparison of rich text components

Rich text component is a user interface component that displays text by styling various parts of it differently. Very often Rich Text components are used for editors. An example may be any code editor that supports highlighting. I needed such UI component for my latest application - The Console so now I'll shortly discuss a comparison between few options:

  • e(fx)clipse Runtime StyledTextArea
  • RichTextFX
  • JavaFX built-in TextFlow
  • JavaFX built-in WebView

→ Continue reading

JavaFX: taskbar-less undecorated window

Applications that are launched in Windows OS are by default listed on taskbar. For a utility software like The Console it is not the case. It shouldn't pollute our task bar or even tray. It should be available under hotkey and that's it.

Problem is, JavaFX won't allow us. Previously presented line  stage.initStyle(StageStyle.UNDECORATED)  gives us undecorated window but collides with stage.initStyle(StageStyle.UTILITY) which makes window's task not visible in taskbar but window itself is then decorated.

Between workarounds I've found a solution. TL;DR initialize window using Swing.

→ Continue reading

The Console: deciding on tools, techs and workflow, then code

Continuing on my Retake on The Console.

Set up

Just installed Eclipse package which is named e(fx)clipse and contains plugins for some better JavaFX support and includes support for Xtend programming language - which is nice. Thanks to this configuration I decided to try Xtend instead of Java. Xtend's main selling point for me is type inference which reduces verbosity. It's a feature that I liked within TypeScript so I've already got good experience about it.

I'm committing using Angular Team's Commit Message Guidelines. It doesn't help when prototyping but it's more than delightful when projects grow. If anyone would ask - I use Windows and babun, simply no GUI for git.

My so-called task management will be done using a simple Trello board. I don't suppose to perform any Kanban here since it's a more "play-and-see" project than strictly-3-months work plan of destroying the world which can't cross the deadline. I do already have got some ideas but will prioritize them and note in there later.

First moment of JavaFX glory

Toggling window visibility was never simple. On the one hand all my twisted hacks around setting window on top after libgdx initialization and making them undecorated are now reduced to those lines with JavaFX:

So that's cool. But in the other hand I've got a problem with simply hiding the window without destroying it.

Platform.runLater()  takes an anonymous function (in Java - through Runnable  interface) which is supposted to be executed in the UI thread. Without it I'm going to see

However, that function is not going to be executed after "hiding" primary Stage. After googling, debugging and few tries around various things and googling again I found this magic line which appeared to be valid in JavaFX version 2.2:

Tada! Now CTRL+TILDE hotkey toggles visibility of the console. The Console. Two.

Retake on The Console

Some time ago I made this project for Windows OS. It's usage goes like this: hit CTRL+TILDE and on the top of the screen will open a Quake 3 Arena thingie that'll enable you to type in some commands. Commands are JavaScript'able and that's the power of the tool. I did some hacks here and there so I decided to change some techs and remake whole beauty to improve efficiency of use.

→ Continue reading