Skip to content

Commit

Permalink
feat(issue-243): changing the ChatResponsePanl layout to GridBagLayout
Browse files Browse the repository at this point in the history
  • Loading branch information
samkerr4coding committed Dec 16, 2024
1 parent dd9fd14 commit 7dd34a5
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions src/main/java/com/devoxx/genie/ui/panel/ChatResponsePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.jetbrains.annotations.NotNull;

import javax.swing.*;
import java.awt.*;

public class ChatResponsePanel extends BackgroundPanel {

Expand All @@ -14,15 +15,32 @@ public class ChatResponsePanel extends BackgroundPanel {
public ChatResponsePanel(@NotNull ChatMessageContext chatMessageContext) {
super(chatMessageContext.getId());
this.chatMessageContext = chatMessageContext;
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
setLayout(new GridBagLayout());
buildResponsePanel();
}

private void buildResponsePanel() {
add(new ResponseHeaderPanel(chatMessageContext));
add(new ResponseContentPanel(chatMessageContext));
add(new FileListPanel(chatMessageContext, FileListManager.getInstance().getFiles()));
add(new SemanticSearchReferencesPanel(chatMessageContext, chatMessageContext.getSemanticReferences()));
add(new MetricExecutionInfoPanel(chatMessageContext));
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.weightx = 1; // full width components
gbc.fill = GridBagConstraints.HORIZONTAL; // Fill horizontally
gbc.anchor = GridBagConstraints.WEST; // Anchor to the west (left)

add(new ResponseHeaderPanel(chatMessageContext), gbc);

gbc.gridy++;
add(new ResponseContentPanel(chatMessageContext), gbc);

gbc.gridy++;
add(new FileListPanel(chatMessageContext, FileListManager.getInstance().getFiles()), gbc);

gbc.gridy++;
add(new SemanticSearchReferencesPanel(chatMessageContext, chatMessageContext.getSemanticReferences()), gbc);

gbc.gridy++;
JPanel metricPanelWrapper = new JPanel(new FlowLayout(FlowLayout.LEFT));
metricPanelWrapper.add(new MetricExecutionInfoPanel(chatMessageContext));
add(metricPanelWrapper, gbc);
}
}

0 comments on commit 7dd34a5

Please sign in to comment.