Skip to content

Commit

Permalink
Layout corrections. Filter text has backround when filter is active.
Browse files Browse the repository at this point in the history
  • Loading branch information
icza committed Feb 1, 2010
1 parent 37bd87d commit 7ec40f4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/hu/belicza/andras/bwhfagent/view/AboutTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,15 @@ private void buildGUI() {
public void componentResized( final ComponentEvent ce ) {
SwingUtilities.invokeLater( new Runnable() {
public void run() {
// This is needed, else the scroll pane does not get resized (SwingWT bug also).
editorPane.setHeight( 10 );
editorPane.getParent().validate();
contentBox.validate();
}
} );
}
} );
buttonsPanel.setMaximumSize( Utils.getMaxDimension() );
JButton button = new JButton( "Visit home page", IconResourceManager.ICON_WORLD_GO );
button.addActionListener( new ActionListener() {
public void actionPerformed( final ActionEvent event ) {
Expand Down Expand Up @@ -127,7 +131,7 @@ public void hyperlinkUpdate( final HyperlinkEvent event ) {

// Why do we need this?
// Not setting preferred size of the editorPane results in really wide window size after pack,
// because the about html contains long lines which are not broke by default.
// because the about html contains long lines which are not broken by default.
// Setting preferred size of the editorPane results in no scrollbars around it, so its
// full content wouldn't be visible.
// Solution: the component added to the content box should be sized and scrolled.
Expand Down
5 changes: 5 additions & 0 deletions src/hu/belicza/andras/bwhfagent/view/ChartsTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import swingwt.awt.event.ActionListener;
import swingwt.awt.event.ComponentAdapter;
import swingwt.awt.event.ComponentEvent;
import swingwtx.swing.BorderFactory;
import swingwtx.swing.Box;
import swingwtx.swing.JButton;
import swingwtx.swing.JCheckBox;
Expand Down Expand Up @@ -136,6 +137,9 @@ private void buildGUI() {
public void componentResized( final ComponentEvent ce ) {
SwingUtilities.invokeLater( new Runnable() {
public void run() {
// The label might disappear, this will refresh it.
chartsComponent.gameDetailsLabel.setText( chartsComponent.gameDetailsLabel.getText() );
chartsComponent.actionsListTextArea.getParent().validate();
buttonsPanel.getParent().validate();
chartsComponent.repaint();
}
Expand Down Expand Up @@ -254,6 +258,7 @@ public void actionPerformed( final ActionEvent event ) {
contentBox.add( Utils.wrapInPanel( loadedReplayLabel ) );

final JPanel chartsCommonControlPanel = Utils.createWrapperPanel();
chartsCommonControlPanel.setBorder( BorderFactory.createLineBorder( Color.BLACK ) );
chartsCommonControlPanel.add( new JLabel( "Chart:" ) );
chartTypeComboBox.addChangeListener( new ChangeListener() {
public void stateChanged( final ChangeEvent event ) {
Expand Down
13 changes: 10 additions & 3 deletions src/hu/belicza/andras/bwhfagent/view/charts/ChartsComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public String toString() {
/** Panel containing options of the selected chart type. */
private final JPanel chartOptionsPanel = Utils.createWrapperPanel();
/** Game details label. */
private final JLabel gameDetailsLabel = new JLabel( "<Game info>", JLabel.CENTER );
public final JLabel gameDetailsLabel = new JLabel( "<Game info>", JLabel.CENTER );
/** Panel containing checkboxes of players. */
private final JPanel playersPanel = Utils.createWrapperPanel();
/** Replay whose charts to be visualized. */
Expand Down Expand Up @@ -218,7 +218,9 @@ public String toString() {
/** This is where we first construct actionsListTextArea's content. */
private final StringBuilder actionsListTextBuilder = new StringBuilder();
/** Text area to show the players' actions. */
private final JTextArea actionsListTextArea = new JTextArea();
public final JTextArea actionsListTextArea = new JTextArea();
/** Label before the filter text field. */
private final JLabel filterActionsLabel = new JLabel( "Filter actions:" );

/** To jump to a specific iteration. */
private final JTextField jumpToIterationTextField = new JTextField( 1 );
Expand Down Expand Up @@ -389,7 +391,7 @@ public void keyPressed( final KeyEvent event ) {
}
} );
actionListOptionsPanel.add( searchTextField );
actionListOptionsPanel.add( new JLabel( "Filter actions:" ) );
actionListOptionsPanel.add( filterActionsLabel );
filterTextField.addKeyListener( new KeyAdapter() {
@Override
public void keyPressed( final KeyEvent event ) {
Expand Down Expand Up @@ -728,6 +730,9 @@ public void setChartType( final ChartType chartType ) {
setZoom( (Integer) chartsTab.zoomComboBox.getSelectedItem() );
}

// Chart and action list might be differently synced in case of different chart type (like map view and not map view), so we resync now.
syncMarkerFromActionListToChart();

// We store values on the options panel before we remove the components, they might lost their values in SwingWT
assignUsedProperties();
// removeAll() does not work properly in SwingWT, we remove components manually!
Expand Down Expand Up @@ -975,6 +980,8 @@ public int compare( final Object[] o1, final Object[] o2 ) {
public void loadPlayerActionsIntoList() {
final String[][] filterGroups = createFilterGroups();

filterActionsLabel.setBackground( filterGroups == null ? filterActionsLabel.getParent().getBackground() : Color.GREEN );

actionList.clear();
actionsListTextBuilder.setLength( 0 );
if ( replay != null ) {
Expand Down

0 comments on commit 7ec40f4

Please sign in to comment.