Added display of settings-icon for the settings button
additionally modified margin of elements in ChatScene
This commit is contained in:
parent
bbd5f61486
commit
86e8b4b139
@ -12,6 +12,7 @@ import javafx.collections.FXCollections;
|
|||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.control.Alert.AlertType;
|
import javafx.scene.control.Alert.AlertType;
|
||||||
|
import javafx.scene.image.ImageView;
|
||||||
import javafx.scene.input.KeyCode;
|
import javafx.scene.input.KeyCode;
|
||||||
import javafx.scene.input.KeyEvent;
|
import javafx.scene.input.KeyEvent;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
@ -22,9 +23,7 @@ import envoy.client.data.Settings;
|
|||||||
import envoy.client.event.MessageCreationEvent;
|
import envoy.client.event.MessageCreationEvent;
|
||||||
import envoy.client.net.Client;
|
import envoy.client.net.Client;
|
||||||
import envoy.client.net.WriteProxy;
|
import envoy.client.net.WriteProxy;
|
||||||
import envoy.client.ui.ContactListCell;
|
import envoy.client.ui.*;
|
||||||
import envoy.client.ui.MessageListCell;
|
|
||||||
import envoy.client.ui.SceneContext;
|
|
||||||
import envoy.data.*;
|
import envoy.data.*;
|
||||||
import envoy.event.EventBus;
|
import envoy.event.EventBus;
|
||||||
import envoy.event.MessageStatusChange;
|
import envoy.event.MessageStatusChange;
|
||||||
@ -90,6 +89,12 @@ public final class ChatScene {
|
|||||||
messageList.setCellFactory(listView -> new MessageListCell());
|
messageList.setCellFactory(listView -> new MessageListCell());
|
||||||
userList.setCellFactory(listView -> new ContactListCell());
|
userList.setCellFactory(listView -> new ContactListCell());
|
||||||
|
|
||||||
|
try {
|
||||||
|
settingsButton.setGraphic(new ImageView(IconUtil.load("/icons/settings.png", 16)));
|
||||||
|
} catch (final IOException e2) {
|
||||||
|
logger.log(Level.WARNING, "Could not load settings icon", e2);
|
||||||
|
}
|
||||||
|
|
||||||
// Listen to received messages
|
// Listen to received messages
|
||||||
eventBus.register(MessageCreationEvent.class, e -> {
|
eventBus.register(MessageCreationEvent.class, e -> {
|
||||||
final var message = e.get();
|
final var message = e.get();
|
||||||
|
@ -21,11 +21,6 @@
|
|||||||
-fx-background-color: transparent;
|
-fx-background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
#remainingCharsLabel {
|
|
||||||
-fx-text-fill: #00FF00;
|
|
||||||
-fx-background-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scroll-bar:horizontal, .scroll-bar:horizontal *, .scroll-bar:horizontal > *{
|
.scroll-bar:horizontal, .scroll-bar:horizontal *, .scroll-bar:horizontal > *{
|
||||||
-fx-background-color: transparent;
|
-fx-background-color: transparent;
|
||||||
-fx-text-fill: transparent;
|
-fx-text-fill: transparent;
|
||||||
@ -58,3 +53,8 @@
|
|||||||
-fx-background-radius: 4.0em;
|
-fx-background-radius: 4.0em;
|
||||||
-fx-text-alignment: left;
|
-fx-text-alignment: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#remainingCharsLabel {
|
||||||
|
-fx-text-fill: #00FF00;
|
||||||
|
-fx-background-color: transparent;
|
||||||
|
}
|
||||||
|
@ -12,20 +12,40 @@
|
|||||||
<?import javafx.scene.layout.GridPane?>
|
<?import javafx.scene.layout.GridPane?>
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
|
|
||||||
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="400.0" minWidth="350.0" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="envoy.client.ui.controller.ChatScene">
|
<GridPane maxHeight="-Infinity" maxWidth="-Infinity"
|
||||||
|
minHeight="400.0" minWidth="350.0" prefHeight="400.0" prefWidth="600.0"
|
||||||
|
xmlns="http://javafx.com/javafx/11.0.1"
|
||||||
|
xmlns:fx="http://javafx.com/fxml/1"
|
||||||
|
fx:controller="envoy.client.ui.controller.ChatScene">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" minWidth="10.0" percentWidth="20.0" prefWidth="161.0" />
|
<ColumnConstraints hgrow="SOMETIMES"
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" minWidth="10.0" percentWidth="65.0" prefWidth="357.0" />
|
maxWidth="1.7976931348623157E308" minWidth="10.0" percentWidth="20.0"
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" minWidth="6.285736083984375" percentWidth="15.0" prefWidth="48.000030517578125" />
|
prefWidth="161.0" />
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES"
|
||||||
|
maxWidth="1.7976931348623157E308" minWidth="10.0" percentWidth="65.0"
|
||||||
|
prefWidth="357.0" />
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES"
|
||||||
|
maxWidth="1.7976931348623157E308" minWidth="6.285736083984375"
|
||||||
|
percentWidth="15.0" prefWidth="48.000030517578125" />
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints maxHeight="1.7976931348623157E308" minHeight="10.0" percentHeight="10.0" prefHeight="70.0" vgrow="SOMETIMES" />
|
<RowConstraints maxHeight="1.7976931348623157E308"
|
||||||
<RowConstraints maxHeight="1.7976931348623157E308" minHeight="10.0" percentHeight="70.0" prefHeight="326.2857404436384" vgrow="SOMETIMES" />
|
minHeight="10.0" percentHeight="10.0" prefHeight="70.0"
|
||||||
<RowConstraints maxHeight="1.7976931348623157E308" minHeight="10.0" percentHeight="5.0" prefHeight="50.0" vgrow="SOMETIMES" />
|
vgrow="SOMETIMES" />
|
||||||
<RowConstraints maxHeight="1.7976931348623157E308" minHeight="10.0" percentHeight="15.0" prefHeight="100.0" vgrow="SOMETIMES" />
|
<RowConstraints maxHeight="1.7976931348623157E308"
|
||||||
|
minHeight="10.0" percentHeight="70.0" prefHeight="326.2857404436384"
|
||||||
|
vgrow="SOMETIMES" />
|
||||||
|
<RowConstraints maxHeight="1.7976931348623157E308"
|
||||||
|
minHeight="10.0" percentHeight="5.0" prefHeight="50.0"
|
||||||
|
vgrow="SOMETIMES" />
|
||||||
|
<RowConstraints maxHeight="1.7976931348623157E308"
|
||||||
|
minHeight="10.0" percentHeight="15.0" prefHeight="100.0"
|
||||||
|
vgrow="SOMETIMES" />
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<ListView fx:id="userList" onMouseClicked="#userListClicked" prefHeight="211.0" prefWidth="300.0" GridPane.rowIndex="1" GridPane.rowSpan="2147483647">
|
<ListView fx:id="userList" onMouseClicked="#userListClicked"
|
||||||
|
prefHeight="211.0" prefWidth="300.0" GridPane.rowIndex="1"
|
||||||
|
GridPane.rowSpan="2147483647">
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets bottom="10.0" left="10.0" right="5.0" top="5.0" />
|
<Insets bottom="10.0" left="10.0" right="5.0" top="5.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
@ -35,26 +55,35 @@
|
|||||||
<contextMenu>
|
<contextMenu>
|
||||||
<ContextMenu anchorLocation="CONTENT_TOP_LEFT">
|
<ContextMenu anchorLocation="CONTENT_TOP_LEFT">
|
||||||
<items>
|
<items>
|
||||||
<MenuItem fx:id="deleteContactMenuItem" mnemonicParsing="false" text="Delete" onAction="#deleteContact"/>
|
<MenuItem fx:id="deleteContactMenuItem"
|
||||||
|
mnemonicParsing="false" text="Delete" onAction="#deleteContact" />
|
||||||
</items>
|
</items>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</contextMenu>
|
</contextMenu>
|
||||||
</ListView>
|
</ListView>
|
||||||
<Label fx:id="contactLabel" prefHeight="16.0" prefWidth="250.0" text="Select a contact to chat with" GridPane.columnSpan="2">
|
<Label fx:id="contactLabel" prefHeight="16.0" prefWidth="250.0"
|
||||||
|
text="Select a contact to chat with" GridPane.columnSpan="2">
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets bottom="5.0" left="10.0" right="5.0" top="10.0" />
|
<Insets left="15.0" right="5.0" top="5.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
</padding></Label>
|
</padding>
|
||||||
<Button fx:id="settingsButton" mnemonicParsing="true" onAction="#settingsButtonClicked" text="_Settings" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
|
</Label>
|
||||||
|
<Button fx:id="settingsButton" mnemonicParsing="true"
|
||||||
|
onAction="#settingsButtonClicked" text="_Settings"
|
||||||
|
GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.halignment="RIGHT"
|
||||||
|
GridPane.valignment="CENTER">
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="10.0" left="5.0" right="10.0" top="10.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
</padding></Button>
|
</padding>
|
||||||
<ListView fx:id="messageList" prefHeight="257.0" prefWidth="155.0" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="1" GridPane.rowSpan="2">
|
</Button>
|
||||||
|
<ListView fx:id="messageList" prefHeight="257.0"
|
||||||
|
prefWidth="155.0" GridPane.columnIndex="1" GridPane.columnSpan="2"
|
||||||
|
GridPane.rowIndex="1" GridPane.rowSpan="2">
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets bottom="5.0" left="5.0" right="10.0" top="5.0" />
|
<Insets bottom="5.0" left="5.0" right="10.0" top="5.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
@ -64,39 +93,60 @@
|
|||||||
<contextMenu>
|
<contextMenu>
|
||||||
<ContextMenu anchorLocation="CONTENT_TOP_LEFT">
|
<ContextMenu anchorLocation="CONTENT_TOP_LEFT">
|
||||||
<items>
|
<items>
|
||||||
<MenuItem mnemonicParsing="false" text="Copy" onAction="#copyMessage"/>
|
<MenuItem mnemonicParsing="false" text="Copy"
|
||||||
<MenuItem mnemonicParsing="false" text="Delete" onAction="#deleteMessage"/>
|
onAction="#copyMessage" />
|
||||||
<MenuItem mnemonicParsing="false" text="Forward" onAction="#forwardMessage"/>
|
<MenuItem mnemonicParsing="false" text="Delete"
|
||||||
<MenuItem mnemonicParsing="false" text="Quote" onAction="#quoteMessage"/>
|
onAction="#deleteMessage" />
|
||||||
|
<MenuItem mnemonicParsing="false" text="Forward"
|
||||||
|
onAction="#forwardMessage" />
|
||||||
|
<MenuItem mnemonicParsing="false" text="Quote"
|
||||||
|
onAction="#quoteMessage" />
|
||||||
</items>
|
</items>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</contextMenu></ListView>
|
</contextMenu>
|
||||||
<Button fx:id="postButton" defaultButton="true" disable="true" mnemonicParsing="true" onAction="#postMessage" prefHeight="10.0" prefWidth="65.0" text="_Post" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.rowIndex="3" GridPane.valignment="CENTER">
|
</ListView>
|
||||||
|
<Button fx:id="postButton" defaultButton="true" disable="true"
|
||||||
|
mnemonicParsing="true" onAction="#postMessage" prefHeight="10.0"
|
||||||
|
prefWidth="65.0" text="_Post" GridPane.columnIndex="2"
|
||||||
|
GridPane.halignment="CENTER" GridPane.rowIndex="3"
|
||||||
|
GridPane.valignment="CENTER">
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="5.0" left="5.0" right="5.0"/>
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
</padding>
|
</padding>
|
||||||
<tooltip>
|
<tooltip>
|
||||||
<Tooltip anchorLocation="WINDOW_TOP_LEFT" autoHide="true" maxWidth="350.0" text="Click this button to send the message. If it is disabled, you first have to select a contact to send it to. A message may automatically be sent when you press (Ctrl + ) Enter, according to your preferences. Additionally sends a message when pressing "Alt" + "P"." wrapText="true" />
|
<Tooltip anchorLocation="WINDOW_TOP_LEFT" autoHide="true"
|
||||||
|
maxWidth="350.0"
|
||||||
|
text="Click this button to send the message. If it is disabled, you first have to select a contact to send it to. A message may automatically be sent when you press (Ctrl + ) Enter, according to your preferences. Additionally sends a message when pressing "Alt" + "P"."
|
||||||
|
wrapText="true" />
|
||||||
</tooltip>
|
</tooltip>
|
||||||
<contextMenu>
|
<contextMenu>
|
||||||
<ContextMenu anchorLocation="CONTENT_TOP_LEFT">
|
<ContextMenu anchorLocation="CONTENT_TOP_LEFT">
|
||||||
<items>
|
<items>
|
||||||
<MenuItem mnemonicParsing="false" text="Copy and Send" onAction="#copyAndPostMessage"/>
|
<MenuItem mnemonicParsing="false" text="Copy and Send"
|
||||||
|
onAction="#copyAndPostMessage" />
|
||||||
</items>
|
</items>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</contextMenu>
|
</contextMenu>
|
||||||
</Button>
|
</Button>
|
||||||
<TextArea fx:id="messageTextArea" disable="true" onInputMethodTextChanged="#messageTextUpdated" onKeyPressed="#checkPostConditions" onKeyTyped="#checkKeyCombination" prefHeight="200.0" prefWidth="200.0" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="3">
|
<TextArea fx:id="messageTextArea" disable="true"
|
||||||
|
onInputMethodTextChanged="#messageTextUpdated"
|
||||||
|
onKeyPressed="#checkPostConditions" onKeyTyped="#checkKeyCombination"
|
||||||
|
prefHeight="200.0" prefWidth="200.0" wrapText="true"
|
||||||
|
GridPane.columnIndex="1" GridPane.rowIndex="3">
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets bottom="10.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="10.0" left="5.0" right="5.0" top="5.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
<opaqueInsets>
|
<opaqueInsets>
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
</opaqueInsets></TextArea>
|
</opaqueInsets>
|
||||||
<Button mnemonicParsing="true" onAction="#addContactButtonClicked" text="_Add Contacts" GridPane.halignment="CENTER" GridPane.rowIndex="3" GridPane.valignment="CENTER">
|
</TextArea>
|
||||||
|
<Button mnemonicParsing="true"
|
||||||
|
onAction="#addContactButtonClicked" text="_Add Contacts"
|
||||||
|
GridPane.halignment="CENTER" GridPane.rowIndex="3"
|
||||||
|
GridPane.valignment="CENTER">
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
</padding>
|
</padding>
|
||||||
@ -104,7 +154,11 @@
|
|||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
</Button>
|
</Button>
|
||||||
<Label id="remainingCharsLabel" fx:id="remainingChars" ellipsisString="" maxHeight="30.0" maxWidth="180.0" prefHeight="30.0" prefWidth="180.0" text="remaining chars: 0/x" textFill="LIME" textOverrun="LEADING_WORD_ELLIPSIS" visible="false" GridPane.columnIndex="1" GridPane.rowIndex="2">
|
<Label id="remainingCharsLabel" fx:id="remainingChars"
|
||||||
|
ellipsisString="" maxHeight="30.0" maxWidth="180.0" prefHeight="30.0"
|
||||||
|
prefWidth="180.0" text="remaining chars: 0/x" textFill="LIME"
|
||||||
|
textOverrun="LEADING_WORD_ELLIPSIS" visible="false"
|
||||||
|
GridPane.columnIndex="1" GridPane.rowIndex="2">
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
@ -115,7 +169,9 @@
|
|||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
</opaqueInsets>
|
</opaqueInsets>
|
||||||
<tooltip>
|
<tooltip>
|
||||||
<Tooltip text="Shows how many chars you can still enter in this message" wrapText="true" />
|
<Tooltip
|
||||||
|
text="Shows how many chars you can still enter in this message"
|
||||||
|
wrapText="true" />
|
||||||
</tooltip>
|
</tooltip>
|
||||||
</Label>
|
</Label>
|
||||||
</children>
|
</children>
|
||||||
|
Reference in New Issue
Block a user