Skip to content

Commit

Permalink
feat(#62): interactive package details
Browse files Browse the repository at this point in the history
  • Loading branch information
DropSnorz committed Apr 2, 2024
1 parent bff3eb9 commit 498c8f3
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,14 @@ public void selectPackage(RemotePackage remotePackage) {
packageInfoController.show();
}

public void clearSearchChip() {
exploreChipView.getChips();
}

public void addSearchChip(String chip) {
exploreChipView.getChips().add(exploreChipView.getConverter().fromString(chip));
}

/**
* Trigger bundle installation sequence.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
import javafx.scene.effect.InnerShadow;
import javafx.scene.image.Image;
Expand Down Expand Up @@ -73,7 +74,7 @@ public class PackageInfoController extends BaseController {
@FXML
private Button installButton;
@FXML
private Label creatorLabel;
private Hyperlink creatorLink;
@FXML
private Label licenseLabel;
@FXML
Expand Down Expand Up @@ -104,6 +105,11 @@ public void initialize() {
sidebar.collapse();
packageInfoContainer.getChildren().add(sidebar);

creatorLink.setOnAction(e -> {
exploreController.clearSearchChip();
exploreController.addSearchChip(creatorLink.getText());
});

closeButton.setOnAction(e -> {
sidebar.collapse();
});
Expand Down Expand Up @@ -166,7 +172,7 @@ private void configureHeader(RemotePackage remotePackage) {
private void configureBody(RemotePackage remotePackage) {

// General fields binding
this.creatorLabel.setText(remotePackage.getCreator());
this.creatorLink.setText(remotePackage.getCreator());
this.descriptionLabel.setText(remotePackage.getDescription());

// License display
Expand Down Expand Up @@ -196,6 +202,10 @@ private void configureBody(RemotePackage remotePackage) {
for (PackageTag tag : remotePackage.getTags()) {
Node chip = new FakeChip(tag.getName());
chip.getStyleClass().add("chip");
chip.getStyleClass().add("fake-chip");
chip.setOnMouseClicked(e -> {
exploreController.addSearchChip(tag.getName());
});
tagContainer.getChildren().add(chip);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>

<HBox fx:id="packageInfoContainer" xmlns="http://javafx.com/javafx/16" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.owlplug.explore.controllers.PackageInfoController">
<HBox fx:id="packageInfoContainer" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.owlplug.explore.controllers.PackageInfoController">
<children>
<VBox fx:id="packageInfoContent" maxWidth="-Infinity" minWidth="400.0" prefWidth="400.0">
<children>
Expand Down Expand Up @@ -108,7 +108,7 @@
<RowConstraints maxHeight="1.7976931348623157E308" minHeight="24.0" valignment="CENTER" vgrow="ALWAYS" />
</rowConstraints>
<children>
<Label fx:id="creatorLabel" text="CREATOR">
<Hyperlink fx:id="creatorLink" styleClass="hyperlink-disabled" text="CREATOR">
<graphic>
<ImageView fitHeight="16.0" fitWidth="16.0" pickOnBounds="true" preserveRatio="true">
<image>
Expand All @@ -117,7 +117,7 @@
</ImageView>
</graphic>
<tooltip><Tooltip text="Creator" /></tooltip>
</Label>
</Hyperlink>
<Label fx:id="typeLabel" text="TYPE" GridPane.rowIndex="1">
<graphic>
<ImageView fitHeight="16.0" fitWidth="16.0" pickOnBounds="true" preserveRatio="true">
Expand Down
5 changes: 5 additions & 0 deletions owlplug-client/src/main/resources/owlplug.css
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ TextArea .content {
-fx-background-color: #657899
}

.fake-chip:hover {
-fx-cursor: hand;
-fx-background-color: #D4D4D4;
}

.button-danger{
-fx-background-color: danger-color;

Expand Down

0 comments on commit 498c8f3

Please sign in to comment.