Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark messages as favorites #137

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -16,11 +16,12 @@ public static synchronized PublishGlobalDispatcher getInstance() {
public void onPublishSuceeded(String connectionId, MessageDTO messageDTO) {
triggerFiltered(connectionId, o -> o.onPublishSucceeded(connectionId, messageDTO));
}

public void onPublishChangeFavoriteStatus(String connectionId, MessageDTO messageDTO) {
triggerFiltered(connectionId, o -> o.onPublishChangeFavoriteStatus(connectionId, messageDTO));
}
public void onPublishRemoved(String connectionId, MessageDTO messageDTO) {
triggerFiltered(connectionId, o -> o.onPublishRemoved(connectionId, messageDTO));
}

public void onPublishesCleared(String connectionId){
triggerFiltered(connectionId, o -> o.onPublishesCleared(connectionId));
}
Original file line number Diff line number Diff line change
@@ -7,4 +7,5 @@ public interface PublishGlobalObserver extends BaseConnectionObserver {
void onPublishSucceeded(String connectionId, MessageDTO messageDTO);
void onPublishRemoved(String connectionId, MessageDTO messageDTO);
void onPublishesCleared(String connectionId);
void onPublishChangeFavoriteStatus(String connectionId, MessageDTO messageDTO);
}
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ public class MessageDTO implements Comparable<MessageDTO> {
private String topic;
private String payload;
private boolean isRetained;
private boolean isFavorited;
private Qos qos;
@MessageDateTimeFormatter
private LocalDateTime dateTime;
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -79,7 +80,7 @@ public void onPublishSucceeded(String connectionId, MessageDTO messageDTO) {
List<String> topicsSet = getTopics(connectionId);
String topic = messageDTO.getTopic();
topicsSet.remove(topic);
topicsSet.add(topic);
topicsSet.add(0,topic);
while (topicsSet.size() > MAX_ENTRIES) {
LOGGER.info("Removing last entry from publish history, cause limit of {} is reached.", MAX_ENTRIES);
topicsSet.remove(topicsSet.iterator().next());
@@ -108,6 +109,11 @@ public void onPublishesCleared(String connectionId) {
// nothing to do
}

@Override
public void onPublishChangeFavoriteStatus(String connectionId, MessageDTO messageDTO) {
// nothing to do
}

@Override
public void onDisconnectFromConnectionDeleted(String connectionId) {
// nothing to do
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
package org.correomqtt.business.provider;

import org.correomqtt.business.dispatcher.ConfigDispatcher;
import org.correomqtt.business.dispatcher.ConfigObserver;
import org.correomqtt.business.dispatcher.ConnectionLifecycleDispatcher;
import org.correomqtt.business.dispatcher.ConnectionLifecycleObserver;
import org.correomqtt.business.dispatcher.PersistPublishHistoryDispatcher;
import org.correomqtt.business.dispatcher.PublishGlobalDispatcher;
import org.correomqtt.business.dispatcher.PublishGlobalObserver;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.correomqtt.business.model.MessageDTO;
import org.correomqtt.business.model.PublishMessageHistoryListDTO;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.correomqtt.gui.model.MessagePropertiesDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;

public class PersistPublishMessageHistoryProvider extends BasePersistHistoryProvider<PublishMessageHistoryListDTO>
implements PublishGlobalObserver,
@@ -68,20 +70,27 @@ void setDTO(String id, PublishMessageHistoryListDTO dto) {
historyDTOs.put(id, dto);
}

public List<MessageDTO> getMessages(String connectionId) {
public LinkedList<MessageDTO> getMessages(String connectionId) {
return historyDTOs.get(connectionId).getMessages();
}

@Override
public void onPublishSucceeded(String connectionId, MessageDTO messageDTO) {
LOGGER.info("Persisting new publish history entry: {}", messageDTO.getTopic());

List<MessageDTO> messageList = getMessages(connectionId);
messageList.add(0,messageDTO);
while (messageList.size() > MAX_ENTRIES) {
LinkedList<MessageDTO> messageList = getMessages(connectionId);
messageList.addFirst(messageDTO);

LinkedList<MessageDTO> nonFavorites = messageList.stream()
.filter(m->m.isFavorited()!=true)
.collect(Collectors.toCollection(LinkedList::new));

while (messageList.size() > MAX_ENTRIES){
LOGGER.info("Removing last entry from publish history, cause limit of {} is reached.", MAX_ENTRIES);
messageList.remove(messageList.size()-1);
messageList.remove(nonFavorites.getLast());
nonFavorites.clear();
}

saveHistory(connectionId);
}

@@ -101,12 +110,25 @@ public void onPublishRemoved(String connectionId, MessageDTO messageDTO) {
messageList.remove(messageDTO);
saveHistory(connectionId);
}
@Override
public void onPublishChangeFavoriteStatus(String connectionId, MessageDTO messageDTO) {
LOGGER.info("change {} in fervorites list for {}.", messageDTO.getTopic(), connectionId);
LinkedList<MessageDTO> messageList = getMessages(connectionId);
for(int i =0; i<messageList.size();i++){
if(messageList.get(i).getMessageId()==messageDTO.getMessageId()){
messageDTO.setFavorited(!messageList.get(i).isFavorited());
messageList.set(i,messageDTO);
}
}
saveHistory(connectionId);
}

@Override
public void onPublishesCleared(String connectionId) {
LOGGER.info("Clearing publish history for {}.", connectionId);
List<MessageDTO> messageList = getMessages(connectionId);
messageList.clear();
LinkedList<MessageDTO> messageList = getMessages(connectionId);
List<MessageDTO> nonFavoriteMessages =messageList.stream().filter(m-> !m.isFavorited()).collect(Collectors.toList());
messageList.removeAll(nonFavoriteMessages);
saveHistory(connectionId);
}

16 changes: 14 additions & 2 deletions src/main/java/org/correomqtt/gui/cell/MessageViewCell.java
Original file line number Diff line number Diff line change
@@ -57,11 +57,17 @@ public class MessageViewCell extends ListCell<MessagePropertiesDTO> {
@FXML
private Label payloadLabel;

@FXML
private ToggleButton FavoriteStar;

@FXML
private Label subscriptionLabel;

private FXMLLoader loader;

private MessagePropertiesDTO messageDTO;

private ContextMenu contextMenu;

@FXML
private ResourceBundle resources;
@@ -123,7 +129,9 @@ private void setUpMessage(MessagePropertiesDTO messageDTO) {

subscriptionLabel.setVisible(false);
subscriptionLabel.setManaged(false);


this.messageDTO = messageDTO;

topicLabel.setText(messageDTO.getTopic());

if (messageDTO.getSubscription() != null) {
@@ -134,6 +142,10 @@ private void setUpMessage(MessagePropertiesDTO messageDTO) {

retainedLabel.setVisible(messageDTO.isRetained());
retainedLabel.setManaged(messageDTO.isRetained());

FavoriteStar.setVisible(messageDTO.isFavorited());
FavoriteStar.setSelected(messageDTO.isFavorited());

qosLabel.setText(messageDTO.getQos().toString());
String payload = messageDTO.getPayload();
payloadLabel.setText(payload.substring(0, Math.min(payload.length(), MAX_PAYLOAD_LENGTH))
@@ -145,7 +157,7 @@ private void setUpMessage(MessagePropertiesDTO messageDTO) {
private void executeOnCreateMessageEntryExtensions(MessagePropertiesDTO messageDTO) {
labelBox.getChildren().clear();
PluginManager.getInstance().getExtensions(MessageListHook.class)
.forEach(p -> p.onCreateEntry(new MessageExtensionDTO(messageDTO), labelBox));
.forEach(p -> p.onCreateEntry(new MessageExtensionDTO(messageDTO), labelBox));
}

private void validateMessage(MessagePropertiesDTO messageDTO) {
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@ public class MessageListContextMenu extends BaseMessageContextMenu<MessageListCo
private MenuItem removeMessage;
private MenuItem saveMessage;
private MenuItem timeInfo;
private MenuItem markAsFavorite;

private SeparatorMenuItem separator1;
private SeparatorMenuItem separator2;
@@ -34,6 +35,9 @@ protected void initializeItems() {
saveMessage = new MenuItem(getResources().getString("messageListContextMenuSaveMenuItem"));
saveMessage.setOnAction(this::saveMessage);

markAsFavorite = new MenuItem(getResources().getString("messageListContextMenuMarkAsFavorite"));
markAsFavorite.setOnAction(this::markMessageAsFavorite);

timeInfo = new MenuItem();
timeInfo.setVisible(false);
timeInfo.setDisable(true);
@@ -49,6 +53,7 @@ protected void initializeItems() {
showDetails,
removeMessage,
saveMessage,
markAsFavorite,
separator1,
copyTopicToClipboard,
copyTimeToClipboard,
@@ -69,6 +74,14 @@ private void saveMessage(ActionEvent actionEvent) {
}
}

private void markMessageAsFavorite(ActionEvent actionEvent){
if (dto != null) {
delegate.markMessageAsFavorite(dto);
} else {
LOGGER.warn("Call to {}::removeMessage with empty message.", getClassName());
}
}


@Override
public void setObject(MessagePropertiesDTO messageDTO){
Original file line number Diff line number Diff line change
@@ -9,4 +9,6 @@ public interface MessageListContextMenuDelegate extends BaseMessageContextMenuDe
void removeMessage(MessagePropertiesDTO messageDTO);

void saveMessage(MessagePropertiesDTO dto);

void markMessageAsFavorite(MessagePropertiesDTO dto);
}
Original file line number Diff line number Diff line change
@@ -139,6 +139,8 @@ public class DetailViewController extends BaseConnectionController implements
private Label emptyLabel;
@FXML
private VBox metaHolder;
@FXML
private ToggleButton FavoriteStar;
private List<Search> results;
private int currentSearchResult;
private String currentSearchString = null;
@@ -215,6 +217,8 @@ private void initialize() {
}
});

FavoriteStar.setVisible(false );

detailViewVBox.addEventHandler(KeyEvent.KEY_PRESSED, event -> {
if (event.isShortcutDown() && KeyCode.F == event.getCode()) {
toggleSearchBar();
@@ -319,6 +323,9 @@ private void showMessage() {
emptyLabel.setManaged(false);
messageGroup.setVisible(true);
messageGroup.setManaged(true);
FavoriteStar.setVisible(messageDTO!=null && messageDTO.isFavorited());



detailViewTopicLabel.setText(messageDTO.getTopic());
detailViewTime.setText(messageDTO.getDateTime().toString()); //TODO formatter
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@

import org.correomqtt.business.dispatcher.ConnectionLifecycleDispatcher;
import org.correomqtt.business.dispatcher.ConnectionLifecycleObserver;
import org.correomqtt.business.model.MessageDTO;
import org.correomqtt.business.model.ControllerType;
import org.correomqtt.business.model.MessageType;
import org.correomqtt.business.model.PublishStatus;
@@ -19,6 +20,7 @@
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.collections.transformation.FilteredList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.*;
@@ -30,14 +32,18 @@
import javafx.stage.Stage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.Getter;

import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Predicate;
import java.util.stream.Collectors;

public class MessageListViewController extends BaseConnectionController implements
ConnectionLifecycleObserver,
MessageListContextMenuDelegate,
DetailViewDelegate {
DetailViewDelegate ,
MessageListViewDelegate{

private static final Logger LOGGER = LoggerFactory.getLogger(MessageListViewController.class);

@@ -59,16 +65,24 @@ public class MessageListViewController extends BaseConnectionController implemen
private TextField messageSearchTextField;
@FXML
private Button messageSearchClearButton;

@FXML
@Getter
public ToggleButton FavoritesFilterButton;
@FXML
@Getter
public ToggleButton FavoriteButton;
@FXML
protected ToggleButton showDetailViewButton;

private ObservableList<MessagePropertiesDTO> messages;

private FilteredList<MessagePropertiesDTO> filteredMessages;

private FilteredList<MessagePropertiesDTO> favoritesMessages;

private DetailViewController detailViewController;


protected ControllerType controllerType = null;

public MessageListViewController(String connectionId, MessageListViewDelegate delegate) {
@@ -90,15 +104,20 @@ public void initialize() {
copyToFormButton.setDisable(true);
showDetailsButton.setDisable(true);
clearMessagesButton.setDisable(true);
FavoriteButton.setVisible(false);
FavoritesFilterButton.setVisible(false);
FavoriteButton.setDisable(true);

messages = FXCollections.observableArrayList(MessagePropertiesDTO.extractor());

filteredMessages = new FilteredList<>(messages, s -> true);

favoritesMessages = new FilteredList<>(messages, MessagePropertiesDTO::isFavorited);


listView.setItems(filteredMessages);
listView.setCellFactory(this::createCell);

splitPane.widthProperty().addListener((observable, oldValue, newValue) -> Platform.runLater(() -> calculateDetailView(newValue)));

messageSearchTextField.textProperty().addListener((observable, oldValue, newValue) -> searchInMessages(newValue));
}

@@ -136,7 +155,6 @@ private void searchInMessages(String newValue) {
if (newValue == null || newValue.isEmpty()) {
return true;
}

return message.getTopic().contains(newValue);
});
}
@@ -170,24 +188,28 @@ private void onCellClicked(MouseEvent event, MessagePropertiesDTO messageDTO) {
DetailViewController.showAsDialog(messageDTO, getConnectionId(), this);
}

if(this.getSelectedMessage()!=null)
FavoriteButton.setDisable(false);
FavoriteButton.setSelected(this.getSelectedMessage().isFavorited());

if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Message selected in list: {}: {}", (messageDTO != null) ? messageDTO.getTopic() : null, getConnectionId());
}
}


@FXML
public void clearList() {

if (detailViewController != null) {
detailViewController.setMessage(null);
}

messages.clear();
List<MessagePropertiesDTO> messageList =messages.stream().filter(m-> !m.isFavorited()).collect(Collectors.toList());
messages.removeAll(messageList);


copyToFormButton.setDisable(true);
showDetailsButton.setDisable(true);
clearMessagesButton.setDisable(true);

delegate.clearMessages();

@@ -212,6 +234,12 @@ public void saveMessage(MessagePropertiesDTO messageDTO) {
MessageUtils.saveMessage(getConnectionId(), messageDTO, stage);
}

@Override
public void markMessageAsFavorite(MessagePropertiesDTO dto) {
changeFavoriteStatus(dto);
}


void setFilterPredicate(Predicate<MessagePropertiesDTO> filterPredicate) {
filteredMessages.setPredicate(filterPredicate);
}
@@ -221,7 +249,6 @@ Node getMainNode() {
return splitPane;
}


private MessagePropertiesDTO getSelectedMessage() {
return listView.getSelectionModel().getSelectedItem();
}
@@ -328,6 +355,25 @@ protected void showDetailView() {
});
}
}
@FXML
void OnClickedFavoritesFilter() {
if(FavoritesFilterButton.isSelected()) {
listView.setItems(favoritesMessages);
}
else {
listView.setItems(filteredMessages);
}
}
@FXML
void OnClickedChangeFavoriteStatus() {
if (this.getSelectedMessage()!=null)
changeFavoriteStatus(this.getSelectedMessage());
}
@Override
public void changeFavoriteStatus(MessagePropertiesDTO messageDTO) {
messageDTO.getIsFavoritedProperty().set(!messageDTO.isFavorited());
delegate.changeFavoriteStatus(messageDTO);
}

@Override
public void onDisconnectFromConnectionDeleted(String connectionId) {
@@ -413,8 +459,25 @@ public void showDetailsInSeparateWindow(MessagePropertiesDTO messageDTO) {
// do nothing
}

@Override
public void removeMessage(MessageDTO messageDTO) {
// do nothing
}

@Override
public void clearMessages() {
// do nothing
}

@Override
public void setTabDirty() {
// do nothing
}

@Override
public void setUpToForm(MessagePropertiesDTO messageDTO) {
delegate.setUpToForm(messageDTO);
}


}
Original file line number Diff line number Diff line change
@@ -3,10 +3,11 @@
import org.correomqtt.business.model.MessageDTO;
import org.correomqtt.gui.model.MessagePropertiesDTO;

public interface MessageListViewDelegate {
interface MessageListViewDelegate {

void removeMessage(MessageDTO messageDTO);
void clearMessages();
void setTabDirty();
void setUpToForm(MessagePropertiesDTO selectedMessage);
void changeFavoriteStatus(MessagePropertiesDTO messageDTO);
}
Original file line number Diff line number Diff line change
@@ -131,6 +131,9 @@ public void initialize() {
qosComboBox.getSelectionModel().selectFirst();
qosComboBox.setCellFactory(QosCell::new);

messageListViewController.getFavoritesFilterButton().setVisible(true);
messageListViewController.getFavoriteButton().setVisible(true);

pluginSystem.getExtensions(PublishMenuHook.class).forEach(p -> {
HBox pluginBox = new HBox();
pluginBox.setAlignment(Pos.CENTER_RIGHT);
@@ -329,6 +332,11 @@ public void setUpToForm(MessagePropertiesDTO messageDTO) {
}
}

@Override
public void changeFavoriteStatus(MessagePropertiesDTO messageDTO) {
PublishGlobalDispatcher.getInstance().onPublishChangeFavoriteStatus(getConnectionId(), MessageTransformer.propsToDTO(messageDTO));
}

private void executeOnCopyMessageToFormExtensions(MessagePropertiesDTO messageDTO) {
pluginSystem.getExtensions(MessageContextMenuHook.class)
.forEach(p -> p.onCopyMessageToPublishForm(getConnectionId(), new MessageExtensionDTO(messageDTO)));
Original file line number Diff line number Diff line change
@@ -108,7 +108,6 @@ static LoaderResult<SubscriptionViewController> load(String connectionId, Subscr
public void initialize() {

initMessageListView();

qosComboBox.setItems(FXCollections.observableArrayList(Qos.values()));
qosComboBox.getSelectionModel().selectFirst();
qosComboBox.setCellFactory(QosCell::new);
@@ -186,7 +185,6 @@ private void subscribe() {
.topic(topic)
.qos(selectedQos)
.build());

if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Subscribing to topic '{}': {}", topic, getConnectionId());
}
@@ -364,6 +362,10 @@ public void setUpToForm(MessagePropertiesDTO messageDTO) {
delegate.setUpToForm(messageDTO);
}

@Override
public void changeFavoriteStatus(MessagePropertiesDTO messageDTO) {
// do nothing
}
@Override
public void onDisconnectFromConnectionDeleted(String connectionId) {
// do nothing
@@ -471,12 +473,12 @@ public void onUnsubscribeSucceeded(SubscriptionDTO subscriptionDTO) {

@Override
public void onUnsubscribeCanceled(SubscriptionDTO subscriptionDTO) {
// nothing to do
// nothing to do
}

@Override
public void onUnsubscribeFailed(SubscriptionDTO subscriptionDTO, Throwable exception) {
// nothing to do
// nothing to do
}

@Override
18 changes: 12 additions & 6 deletions src/main/java/org/correomqtt/gui/model/MessagePropertiesDTO.java
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@ public class MessagePropertiesDTO implements Comparable<MessagePropertiesDTO> {
private final StringProperty topicProperty;
private final StringProperty payloadProperty;
private final BooleanProperty isRetainedProperty;
private final BooleanProperty isFavoritedProperty;
private final Property<Qos> qosProperty;
private final Property<LocalDateTime> dateTimeProperty;
private final Property<SubscriptionPropertiesDTO> subscriptionDTOProperty;
@@ -35,13 +36,14 @@ public static Callback<MessagePropertiesDTO, Observable[]> extractor() {
m.topicProperty,
m.payloadProperty,
m.isRetainedProperty,
m.isFavoritedProperty,
m.qosProperty,
m.dateTimeProperty,
m.subscriptionDTOProperty,
m.messageIdProperty,
m.messageTypeProperty,
m.publishStatusProperty,
m.extraProperties
m.extraProperties,
};
}

@@ -73,6 +75,8 @@ public boolean isRetained() {
return isRetainedProperty.get();
}

public boolean isFavorited() {return isFavoritedProperty.get(); }

public Qos getQos() {
return qosProperty.getValue();
}
@@ -94,11 +98,6 @@ public LocalDateTime getDateTime() {
return dateTimeProperty.getValue();
}

@Override
public String toString() {
return "Message to " + getTopic() + " with QoS: " + getQos().ordinal() + " at " + getDateTime();
}

@Override
public int hashCode() {
return (getTopic() + getPayload() + isRetained() + getQos() + getDateTime()).hashCode();
@@ -143,6 +142,7 @@ public static class MessagePropertiesDTOBuilder {
private StringProperty topicProperty = new SimpleStringProperty();
private StringProperty payloadProperty = new SimpleStringProperty();
private BooleanProperty isRetainedProperty = new SimpleBooleanProperty(false);
private BooleanProperty FavoritedProperty = new SimpleBooleanProperty(false);
private Property<Qos> qosProperty = new SimpleObjectProperty<>();
private Property<LocalDateTime> dateTimeProperty = new SimpleObjectProperty<>();
private Property<SubscriptionPropertiesDTO> subscriptionDTOProperty = new SimpleObjectProperty<>();
@@ -151,6 +151,7 @@ public static class MessagePropertiesDTOBuilder {
private Property<PublishStatus> publishStatusProperty = new SimpleObjectProperty<>();
private SimpleMapProperty<String, Object> extraProperties = new SimpleMapProperty<>();


public MessagePropertiesDTOBuilder topic(String topic) {
this.topicProperty.set(topic);
return this;
@@ -165,6 +166,10 @@ public MessagePropertiesDTOBuilder isRetained(boolean isRetained) {
this.isRetainedProperty.set(isRetained);
return this;
}
public MessagePropertiesDTOBuilder isFavorited(boolean isFavorited ) {
this.FavoritedProperty.set(isFavorited);
return this;
}

public MessagePropertiesDTOBuilder qos(Qos qos) {
this.qosProperty.setValue(qos);
@@ -205,6 +210,7 @@ public MessagePropertiesDTO build() {
return new MessagePropertiesDTO(topicProperty,
payloadProperty,
isRetainedProperty,
FavoritedProperty,
qosProperty,
dateTimeProperty,
subscriptionDTOProperty,
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ public static MessagePropertiesDTO dtoToProps(MessageDTO messageDTO) {
.topic(messageDTO.getTopic())
.payload(messageDTO.getPayload())
.isRetained(messageDTO.isRetained())
.isFavorited(messageDTO.isFavorited())
.qos(messageDTO.getQos())
.dateTime(messageDTO.getDateTime())
.messageId(messageDTO.getMessageId())
@@ -27,6 +28,7 @@ public static MessageDTO propsToDTO(MessagePropertiesDTO messagePropertiesDTO) {
.topic(messagePropertiesDTO.getTopic())
.payload(messagePropertiesDTO.getPayload())
.isRetained(messagePropertiesDTO.isRetained())
.isFavorited(messagePropertiesDTO.isFavorited())
.qos(messagePropertiesDTO.getQos())
.dateTime(messagePropertiesDTO.getDateTime())
.messageId(messagePropertiesDTO.getMessageId())
10 changes: 6 additions & 4 deletions src/main/resources/org/correomqtt/gui/cell/messageView.fxml
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@

<?import java.lang.String?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ToggleButton?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Region?>
@@ -18,19 +19,20 @@
</Label>
<Label fx:id="subscriptionLabel" styleClass="subscription" text="sub" />
<Region HBox.hgrow="SOMETIMES" />
<ToggleButton fx:id="FavoriteStar" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" prefHeight="2.0" prefWidth="34.0" stylesheets="@../css/FavoritesList.css" />
<HBox>
<HBox fx:id="labelBox">
</HBox>
<Label fx:id="validLabel" alignment="CENTER" maxWidth="-Infinity" minWidth="-Infinity" text=" " textAlignment="CENTER">
<styleClass>
<String fx:value="tag"/>
<String fx:value="valid"/>
<String fx:value="tag" />
<String fx:value="valid" />
</styleClass>
</Label>
<Label fx:id="invalidLabel" alignment="CENTER" maxWidth="-Infinity" minWidth="-Infinity" text=" " textAlignment="CENTER">
<styleClass>
<String fx:value="tag"/>
<String fx:value="invalid"/>
<String fx:value="tag" />
<String fx:value="invalid" />
</styleClass>
</Label>
<Label fx:id="retainedLabel" alignment="CENTER" maxWidth="-Infinity" minWidth="-Infinity" styleClass="tag" text="Retained" textAlignment="CENTER">
Original file line number Diff line number Diff line change
@@ -135,6 +135,7 @@
<HBox alignment="CENTER_LEFT" minHeight="20.0" VBox.vgrow="NEVER">
<HBox fx:id="detailViewNodeBox" alignment="CENTER_LEFT" HBox.hgrow="ALWAYS">
</HBox>
<ToggleButton fx:id="FavoriteStar" id="FavoriteStar" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" prefHeight="2.0" prefWidth="34.0" stylesheets="@../css/FavoritesList.css" />
<Label id="detailViewValid" fx:id="detailViewValid" alignment="CENTER" maxWidth="-Infinity"
minWidth="-Infinity" styleClass="tag, valid" text="OK" HBox.hgrow="ALWAYS">
<HBox.margin>
Original file line number Diff line number Diff line change
@@ -27,26 +27,31 @@
</tooltip>
</Button>
<Pane HBox.hgrow="ALWAYS" />
<TextField fx:id="messageSearchTextField" promptText="Search topics .." styleClass="messageSearchTextField">
<HBox.margin>
<Insets left="5.0" />
</HBox.margin></TextField>
<Button fx:id="messageSearchClearButton" minHeight="25.0" minWidth="30.0" mnemonicParsing="false" onAction="#resetMessageSearchTextField">
<HBox.margin>
<Insets left="-1.0" />
</HBox.margin>
<styleClass>
<String fx:value="broom-solid" />
<String fx:value="messageSearchClear" />
</styleClass></Button>
<TextField fx:id="messageSearchTextField" promptText="Search topics .." styleClass="messageSearchTextField" />
<Button fx:id="messageSearchClearButton" minHeight="25.0" minWidth="30.0" mnemonicParsing="false" onAction="#resetMessageSearchTextField">
<HBox.margin>
<Insets />
</HBox.margin>
<styleClass>
<String fx:value="broom-solid" />
<String fx:value="messageSearchClear" />
</styleClass>
</Button>
<ToggleButton fx:id="FavoritesFilterButton" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="20.0" mnemonicParsing="false" onAction="#OnClickedFavoritesFilter" prefHeight="25.0" prefWidth="20.0" stylesheets="@../css/FavoritesList.css">
<HBox.margin>
<Insets left="5.0" />
</HBox.margin>
</ToggleButton>
<ToggleButton fx:id="FavoriteButton" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="25.0" mnemonicParsing="false" onAction="#OnClickedChangeFavoriteStatus" prefHeight="25.0" prefWidth="25.0" stylesheets="@../css/FavoritesList.css">
<HBox.margin>
<Insets />
</HBox.margin>
</ToggleButton>

<Button fx:id="clearMessagesButton" minHeight="25.0" minWidth="30.0" mnemonicParsing="false" onAction="#clearList" styleClass="trash-alt-solid">
<tooltip>
<Tooltip text="%messageListViewClearMessagesButton" />
</tooltip>
<HBox.margin>
<Insets left="5.0" />
</HBox.margin>
<HBox.margin>
<Insets left="5.0" />
</HBox.margin>
</Button>
<ToggleButton fx:id="showDetailViewButton" minHeight="25.0" minWidth="30.0" mnemonicParsing="false" onAction="#toggleDetailView" styleClass="columns-solid-without-toolbar">
<tooltip>
@@ -56,6 +61,9 @@
<Insets left="5.0" />
</HBox.margin>
</ToggleButton>
<VBox.margin>
<Insets />
</VBox.margin>
</HBox>
<ListView fx:id="listView" styleClass="noBorder" VBox.vgrow="ALWAYS">
</ListView>
43 changes: 43 additions & 0 deletions src/main/resources/org/correomqtt/gui/css/FavoritesList.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@import "global.css";


.black #FavoriteButton {
-fx-graphic: url("../icons/star-regular-black.png");
}

.white #FavoriteButton {
-fx-graphic: url("../icons/star-regular-white.png");
}

.black #FavoriteButton:selected {
-fx-graphic: url("../icons/star-solid-black.png");
}

.white #FavoriteButton:selected {
-fx-graphic: url("../icons/star-solid-white.png");
}

.black #FavoritesFilterButton {
-fx-graphic: url("../icons/filter-solid-black.png");
}

.white #FavoritesFilterButton {
-fx-graphic: url("../icons/filter-solid-white.png");
}

#FavoriteStar:selected {
-fx-graphic: url("../icons/columns-solid-without-toolbar-stargold.png");
-fx-border-color: transparent;
-fx-border-width: 0;
-fx-background-radius: 0;
-fx-background-color: transparent;
}
#FavoriteStar{
-fx-graphic: url("../icons/columns-solid-without-toolbar-stargold.png");
-fx-border-color: transparent;
-fx-border-width: 0;
-fx-background-radius: 0;
-fx-background-color: transparent;
}


Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/main/resources/org/correomqtt/i18n_de_DE.properties
Original file line number Diff line number Diff line change
@@ -75,6 +75,7 @@ baseMessageContextMenuPayloadMenuItem=Kopiere Payload in die Zwischenablage
messageListContextMenuClearMenuItem=Liste leeren
messageListContextMenuRemoveMenuItem=Nachricht entfernen
messageListContextMenuSaveMenuItem=Nachricht speichern ...
messageListContextMenuMarkAsFavorite=Als Favorit speichern
subscriptionListMessageContextMenuFilterOnlyMenuItem=Nur nach dieser Subscription filtern
subscriptionListMessageContextMenuSelectAllMenuItem=Alle auswählen
subscriptionListMessageContextMenuSelectNoneMenuItem=Keine auswählen
1 change: 1 addition & 0 deletions src/main/resources/org/correomqtt/i18n_en_US.properties
Original file line number Diff line number Diff line change
@@ -76,6 +76,7 @@ baseMessageContextMenuPayloadMenuItem=Copy Payload To Clipboard
messageListContextMenuClearMenuItem=Clear List
messageListContextMenuRemoveMenuItem=Remove Message
messageListContextMenuSaveMenuItem=Save Message ...
messageListContextMenuMarkAsFavorite=Mark As Favorite
subscriptionListMessageContextMenuFilterOnlyMenuItem=Filter on this subscription only
subscriptionListMessageContextMenuSelectAllMenuItem=Select All
subscriptionListMessageContextMenuSelectNoneMenuItem=Select None