Skip to content

Commit

Permalink
Set up actual main layout for the gui
Browse files Browse the repository at this point in the history
  • Loading branch information
lexun committed Jan 26, 2015
1 parent d215bb4 commit 06606b1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 72 deletions.
2 changes: 1 addition & 1 deletion lib/launchpad/gui/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Application < JRubyFX::Application
# @param [Java::JavafxStage::Stage] stage
# automatically provided when {.launch} is called.
def start(stage)
with(stage, title: 'Launchpad', width: 800, height: 600) do
with(stage, title: 'Launchpad', resizable: false) do
fxml 'main.fxml'
show
end
Expand Down
9 changes: 0 additions & 9 deletions lib/launchpad/gui/fxml/main.css
Original file line number Diff line number Diff line change
@@ -1,9 +0,0 @@
.menu-bar {
-fx-background-color: #aeb5ba,
linear-gradient(to bottom, #ecf4fa 0%, #ced4d9 100%);
-fx-background-insets: 0, 0 0 1 0;
}

.menu-bar .menu .label {
-fx-text-fill: #2d3e4c;
}
77 changes: 18 additions & 59 deletions lib/launchpad/gui/fxml/main.fxml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.web.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.canvas.*?>
<?import javafx.geometry.*?>
<?import java.lang.*?>
<?import java.net.*?>
<?import java.util.*?>
Expand All @@ -8,62 +12,17 @@
<?import javafx.scene.paint.*?>
<?import javafx.scene.text.*?>

<VBox prefHeight="400.0" prefWidth="640.0"
xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2">
<children>
<MenuBar VBox.vgrow="NEVER">
<menus>
<Menu mnemonicParsing="false" text="File">
<items>
<MenuItem mnemonicParsing="false" text="New" />
<MenuItem mnemonicParsing="false" text="Open…" />
<Menu mnemonicParsing="false" text="Open Recent" />
<SeparatorMenuItem mnemonicParsing="false" />
<MenuItem mnemonicParsing="false" text="Close" />
<MenuItem mnemonicParsing="false" text="Save" />
<MenuItem mnemonicParsing="false" text="Save As…" />
<MenuItem mnemonicParsing="false" text="Revert" />
<SeparatorMenuItem mnemonicParsing="false" />
<MenuItem mnemonicParsing="false" text="Preferences…" />
<SeparatorMenuItem mnemonicParsing="false" />
<MenuItem mnemonicParsing="false" text="Quit" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Edit">
<items>
<MenuItem mnemonicParsing="false" text="Undo" />
<MenuItem mnemonicParsing="false" text="Redo" />
<SeparatorMenuItem mnemonicParsing="false" />
<MenuItem mnemonicParsing="false" text="Cut" />
<MenuItem mnemonicParsing="false" text="Copy" />
<MenuItem mnemonicParsing="false" text="Paste" />
<MenuItem mnemonicParsing="false" text="Delete" />
<SeparatorMenuItem mnemonicParsing="false" />
<MenuItem mnemonicParsing="false" text="Select All" />
<MenuItem mnemonicParsing="false" text="Unselect All" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Help">
<items>
<MenuItem mnemonicParsing="false" text="About MyHelloApp" />
</items>
</Menu>
</menus>
</MenuBar>
<AnchorPane maxHeight="-1.0" maxWidth="-1.0"
prefHeight="-1.0" prefWidth="-1.0" VBox.vgrow="ALWAYS">
<children>
<Label alignment="CENTER" layoutX="155.0" layoutY="177.0" style="&#10;"
text="Drag components from Library here…" textAlignment="CENTER"
textFill="#9f9f9f" wrapText="false">
<font>
<Font size="18.0" />
</font>
</Label>
</children>
</AnchorPane>
</children>
<stylesheets>
<URL value="@main.css" />
</stylesheets>
</VBox>
<AnchorPane prefHeight="400.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children>
<WebView prefHeight="350.0" />
<AnchorPane layoutY="350.0" prefHeight="46.0" prefWidth="800.0">
<children>
<Button layoutX="720.0" layoutY="11.0" mnemonicParsing="false" text="Launch" />
<Button layoutX="662.0" layoutY="11.0" mnemonicParsing="false" text="Scan" />
<Button layoutX="585.0" layoutY="11.0" mnemonicParsing="false" text="Options" />
<ProgressBar layoutX="14.0" layoutY="11.0" prefHeight="27.0" prefWidth="559.0" progress="0.0" />
<Label layoutX="33.0" layoutY="17.0" text="Info" />
</children>
</AnchorPane>
</children>
</AnchorPane>
5 changes: 2 additions & 3 deletions spec/lib/launchpad/gui/application_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
let(:stage) { double 'stage' }

before do
messages = [:title=, :width=, :height=, :fxml, :show]
messages = [:title=, :width=, :height=, :resizable=, :fxml, :show]
messages.each { |message| allow(stage).to receive message }
subject.start stage
end

it 'should set up the stage' do
expect(stage).to have_received(:title=).with 'Launchpad'
expect(stage).to have_received(:width=).with 800
expect(stage).to have_received(:height=).with 600
expect(stage).to have_received(:resizable=).with false
expect(stage).to have_received(:fxml).with 'main.fxml'
expect(stage).to have_received(:show)
end
Expand Down

0 comments on commit 06606b1

Please sign in to comment.