Added (currently useless) message-info menuItem
additionally: - moved MessageListCell and ContactListCell into envoy.client.ui.listcell - edited editable property of ClearableTextField
This commit is contained in:
parent
2cccddc606
commit
2b1debbad7
@ -1,5 +1,6 @@
|
|||||||
package envoy.client.ui;
|
package envoy.client.ui;
|
||||||
|
|
||||||
|
import javafx.beans.property.BooleanProperty;
|
||||||
import javafx.beans.property.ObjectProperty;
|
import javafx.beans.property.ObjectProperty;
|
||||||
import javafx.beans.property.StringProperty;
|
import javafx.beans.property.StringProperty;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
@ -156,4 +157,11 @@ public class ClearableTextField extends GridPane {
|
|||||||
* @since Envoy Client v0.1-beta
|
* @since Envoy Client v0.1-beta
|
||||||
*/
|
*/
|
||||||
public final void setEditable(boolean value) { textField.setEditable(value); }
|
public final void setEditable(boolean value) { textField.setEditable(value); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the current property whether this ClearableTextField is editable
|
||||||
|
* @see javafx.scene.control.TextInputControl#editableProperty()
|
||||||
|
* @since Envoy Client v0.1-beta
|
||||||
|
*/
|
||||||
|
public final BooleanProperty editableProperty() { return textField.editableProperty(); }
|
||||||
}
|
}
|
||||||
|
@ -40,21 +40,21 @@ public final class SceneContext {
|
|||||||
public enum SceneInfo {
|
public enum SceneInfo {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main scene in which chats are displayed.
|
* The main scene in which the chat screen is displayed.
|
||||||
*
|
*
|
||||||
* @since Envoy Client v0.1-beta
|
* @since Envoy Client v0.1-beta
|
||||||
*/
|
*/
|
||||||
CHAT_SCENE("/fxml/ChatScene.fxml"),
|
CHAT_SCENE("/fxml/ChatScene.fxml"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The scene in which settings are displayed.
|
* The scene in which the settings screen is displayed.
|
||||||
*
|
*
|
||||||
* @since Envoy Client v0.1-beta
|
* @since Envoy Client v0.1-beta
|
||||||
*/
|
*/
|
||||||
SETTINGS_SCENE("/fxml/SettingsScene.fxml"),
|
SETTINGS_SCENE("/fxml/SettingsScene.fxml"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The scene in which the contact search is displayed.
|
* The scene in which the contact search screen is displayed.
|
||||||
*
|
*
|
||||||
* @since Envoy Client v0.1-beta
|
* @since Envoy Client v0.1-beta
|
||||||
*/
|
*/
|
||||||
@ -72,7 +72,14 @@ public final class SceneContext {
|
|||||||
*
|
*
|
||||||
* @since Envoy Client v0.1-beta
|
* @since Envoy Client v0.1-beta
|
||||||
*/
|
*/
|
||||||
LOGIN_SCENE("/fxml/LoginScene.fxml");
|
LOGIN_SCENE("/fxml/LoginScene.fxml"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The scene in which the info screen is displayed.
|
||||||
|
*
|
||||||
|
* @since Envoy Client v0.1-beta
|
||||||
|
*/
|
||||||
|
MESSAGE_INFO_SCENE("/fxml/MessageInfoScene.fxml");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The path to the FXML resource.
|
* The path to the FXML resource.
|
||||||
|
@ -24,7 +24,10 @@ 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.*;
|
import envoy.client.ui.IconUtil;
|
||||||
|
import envoy.client.ui.SceneContext;
|
||||||
|
import envoy.client.ui.listcell.ContactListCell;
|
||||||
|
import envoy.client.ui.listcell.MessageListCell;
|
||||||
import envoy.data.*;
|
import envoy.data.*;
|
||||||
import envoy.event.EventBus;
|
import envoy.event.EventBus;
|
||||||
import envoy.event.MessageStatusChange;
|
import envoy.event.MessageStatusChange;
|
||||||
@ -386,4 +389,7 @@ public final class ChatScene {
|
|||||||
updateRemainingCharsLabel();
|
updateRemainingCharsLabel();
|
||||||
postButton.setDisable(messageText.isBlank());
|
postButton.setDisable(messageText.isBlank());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void loadMessageInfoScene() { try {} catch (final NullPointerException e) {} }
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,8 @@ import javafx.scene.control.ListView;
|
|||||||
import envoy.client.data.LocalDB;
|
import envoy.client.data.LocalDB;
|
||||||
import envoy.client.event.SendEvent;
|
import envoy.client.event.SendEvent;
|
||||||
import envoy.client.ui.ClearableTextField;
|
import envoy.client.ui.ClearableTextField;
|
||||||
import envoy.client.ui.ContactListCell;
|
|
||||||
import envoy.client.ui.SceneContext;
|
import envoy.client.ui.SceneContext;
|
||||||
|
import envoy.client.ui.listcell.ContactListCell;
|
||||||
import envoy.data.Contact;
|
import envoy.data.Contact;
|
||||||
import envoy.event.ElementOperation;
|
import envoy.event.ElementOperation;
|
||||||
import envoy.event.EventBus;
|
import envoy.event.EventBus;
|
||||||
|
@ -10,8 +10,8 @@ import javafx.scene.control.Alert.AlertType;
|
|||||||
import envoy.client.data.LocalDB;
|
import envoy.client.data.LocalDB;
|
||||||
import envoy.client.event.SendEvent;
|
import envoy.client.event.SendEvent;
|
||||||
import envoy.client.ui.ClearableTextField;
|
import envoy.client.ui.ClearableTextField;
|
||||||
import envoy.client.ui.ContactListCell;
|
|
||||||
import envoy.client.ui.SceneContext;
|
import envoy.client.ui.SceneContext;
|
||||||
|
import envoy.client.ui.listcell.ContactListCell;
|
||||||
import envoy.data.Contact;
|
import envoy.data.Contact;
|
||||||
import envoy.event.EventBus;
|
import envoy.event.EventBus;
|
||||||
import envoy.event.GroupCreation;
|
import envoy.event.GroupCreation;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package envoy.client.ui;
|
package envoy.client.ui.listcell;
|
||||||
|
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.ListCell;
|
import javafx.scene.control.ListCell;
|
||||||
@ -52,7 +52,7 @@ public class ContactListCell extends ListCell<Contact> {
|
|||||||
vbox.getChildren().add(statusLabel);
|
vbox.getChildren().add(statusLabel);
|
||||||
} else // Member count
|
} else // Member count
|
||||||
vbox.getChildren().add(new Label(((Group) contact).getContacts().size() + " members"));
|
vbox.getChildren().add(new Label(((Group) contact).getContacts().size() + " members"));
|
||||||
prefWidthProperty().bind(listView.widthProperty().subtract(40));
|
if (listView != null) prefWidthProperty().bind(listView.widthProperty().subtract(40));
|
||||||
setGraphic(vbox);
|
setGraphic(vbox);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package envoy.client.ui;
|
package envoy.client.ui.listcell;
|
||||||
|
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -10,6 +10,7 @@ import javafx.scene.image.ImageView;
|
|||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.stage.PopupWindow.AnchorLocation;
|
import javafx.stage.PopupWindow.AnchorLocation;
|
||||||
|
|
||||||
|
import envoy.client.ui.IconUtil;
|
||||||
import envoy.data.Message;
|
import envoy.data.Message;
|
||||||
import envoy.data.Message.MessageStatus;
|
import envoy.data.Message.MessageStatus;
|
||||||
import envoy.data.User;
|
import envoy.data.User;
|
||||||
@ -64,7 +65,7 @@ public class MessageListCell extends ListCell<Message> {
|
|||||||
} else cell.getStyleClass().add("received-message");
|
} else cell.getStyleClass().add("received-message");
|
||||||
// Adjusting height and weight of the cell to the corresponding ListView
|
// Adjusting height and weight of the cell to the corresponding ListView
|
||||||
cell.paddingProperty().setValue(new Insets(5, 20, 5, 20));
|
cell.paddingProperty().setValue(new Insets(5, 20, 5, 20));
|
||||||
cell.prefWidthProperty().bind(listView.widthProperty().subtract(40));
|
if (listView != null) cell.prefWidthProperty().bind(listView.widthProperty().subtract(40));
|
||||||
// Creating the Tooltip to deselect a message
|
// Creating the Tooltip to deselect a message
|
||||||
final var tooltip = new Tooltip("You can select a message by clicking on it \nand deselect it by pressing \"ctrl\" and clicking on it");
|
final var tooltip = new Tooltip("You can select a message by clicking on it \nand deselect it by pressing \"ctrl\" and clicking on it");
|
||||||
tooltip.setWrapText(true);
|
tooltip.setWrapText(true);
|
12
src/main/java/envoy/client/ui/listcell/package-info.java
Normal file
12
src/main/java/envoy/client/ui/listcell/package-info.java
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/**
|
||||||
|
* This package contains custom list cells that are used to display certain
|
||||||
|
* things.
|
||||||
|
* <p>
|
||||||
|
* Project: <strong>envoy-client</strong><br>
|
||||||
|
* File: <strong>package-info.java</strong><br>
|
||||||
|
* Created: <strong>30.06.2020</strong><br>
|
||||||
|
*
|
||||||
|
* @author Leon Hofmeister
|
||||||
|
* @since Envoy Client v0.1-beta
|
||||||
|
*/
|
||||||
|
package envoy.client.ui.listcell;
|
@ -102,6 +102,8 @@
|
|||||||
onAction="#forwardMessage" text="Forward" />
|
onAction="#forwardMessage" text="Forward" />
|
||||||
<MenuItem mnemonicParsing="false"
|
<MenuItem mnemonicParsing="false"
|
||||||
onAction="#quoteMessage" text="Quote" />
|
onAction="#quoteMessage" text="Quote" />
|
||||||
|
<MenuItem mnemonicParsing="false"
|
||||||
|
onAction="#loadMessageInfoScene" text="Info" />
|
||||||
</items>
|
</items>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</contextMenu>
|
</contextMenu>
|
||||||
@ -176,8 +178,8 @@
|
|||||||
</tooltip>
|
</tooltip>
|
||||||
</Label>
|
</Label>
|
||||||
<Label fx:id="infoLabel" text="Something happened"
|
<Label fx:id="infoLabel" text="Something happened"
|
||||||
textFill="#faa007" visible="false" GridPane.columnIndex="1"
|
wrapText="true" textFill="#faa007" visible="false"
|
||||||
GridPane.rowIndex="1">
|
GridPane.columnIndex="1" GridPane.rowIndex="1">
|
||||||
<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>
|
||||||
|
Reference in New Issue
Block a user