Skip to content
Open
Show file tree
Hide file tree
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
26 changes: 20 additions & 6 deletions src/main/java/org/ciscavate/cjwizard/WizardContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
package org.ciscavate.cjwizard;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.util.LinkedList;
import java.util.List;

import java.util.ResourceBundle;
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JPanel;

import org.ciscavate.cjwizard.pagetemplates.DefaultPageTemplate;
import org.ciscavate.cjwizard.pagetemplates.PageTemplate;
import org.ciscavate.utilities.ExceptionUtilities;
Expand All @@ -47,6 +47,8 @@ public class WizardContainer extends JPanel implements WizardController {
*/
private static Logger log = LoggerFactory.getLogger(WizardContainer.class);

private static ResourceBundle msg = ResourceBundle.getBundle("i18n.cjwizard");

/**
* Storage for all the collected information.
*/
Expand Down Expand Up @@ -83,7 +85,7 @@ public class WizardContainer extends JPanel implements WizardController {
*/
private JPanel _extraButtonPanel;

private final AbstractAction _prevAction = new AbstractAction("< Prev"){
private final AbstractAction _prevAction = new AbstractAction(msg.getString("PREVIOUS")){
{
setEnabled(false);
}
Expand All @@ -93,14 +95,14 @@ public void actionPerformed(ActionEvent e) {
}
};

private final AbstractAction _nextAction = new AbstractAction("Next >"){
private final AbstractAction _nextAction = new AbstractAction(msg.getString("NEXT")){
@Override
public void actionPerformed(ActionEvent e) {
next();
}
};

private final AbstractAction _finishAction = new AbstractAction("Finish"){
private final AbstractAction _finishAction = new AbstractAction(msg.getString("FINISH")){
{
setEnabled(false);
}
Expand All @@ -110,7 +112,7 @@ public void actionPerformed(ActionEvent e) {
}
};

private final AbstractAction _cancelAction = new AbstractAction("Cancel"){
private final AbstractAction _cancelAction = new AbstractAction(msg.getString("CANCEL")){
@Override
public void actionPerformed(ActionEvent e) {
cancel();
Expand Down Expand Up @@ -149,6 +151,18 @@ private void initComponents() {
final JButton finishBtn = new JButton(_finishAction);
final JButton cancelBtn = new JButton(_cancelAction);

Dimension preferredMax = prevBtn.getPreferredSize();
for (JButton b : new JButton[]{nextBtn, finishBtn, cancelBtn}) {
Dimension bp = b.getPreferredSize();
preferredMax.setSize(Math.max(preferredMax.getWidth(), bp.getWidth()),
Math.max(preferredMax.getHeight(), bp.getHeight()));
}

prevBtn.setPreferredSize(preferredMax);
nextBtn.setPreferredSize(preferredMax);
finishBtn.setPreferredSize(preferredMax);
cancelBtn.setPreferredSize(preferredMax);

_extraButtonPanel = new JPanel();
_extraButtonPanel.setLayout(
new BoxLayout(_extraButtonPanel, BoxLayout.LINE_AXIS));
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/ciscavate/cjwizard/WizardPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private Object getValue(Component c) {
} else if (c instanceof JList){
val = ((JList) c).getSelectedValues();
} else {
log.warn("Unknown component: "+c);
log.warn("Unknown component: {}", c);
}

return val;
Expand Down Expand Up @@ -197,7 +197,7 @@ private void setValue(Component c, Object o) {
}
list.setSelectedIndices(indices);
} else {
log.warn("Unknown component: "+c);
log.warn("Unknown component: {}", c);
}

}
Expand Down Expand Up @@ -283,7 +283,7 @@ private class WPContainerListener implements ContainerListener {
*/
@Override
public void componentAdded(ContainerEvent e) {
log.trace("component added: "+e.getChild());
log.trace("component added: {}", e.getChild());
Component newComp = e.getChild();

storeIfNamed(newComp);
Expand Down Expand Up @@ -319,7 +319,7 @@ private void storeIfNamed(Component newComp) {
*/
@Override
public void componentRemoved(ContainerEvent e) {
log.trace("component removed: "+e.getChild());
log.trace("component removed: {}", e.getChild());
_namedComponents.remove(e.getChild());
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/ciscavate/cjwizard/WizardTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,19 @@ public WizardTest(){
wc.addWizardListener(new WizardListener(){
@Override
public void onCanceled(List<WizardPage> path, WizardSettings settings) {
log.debug("settings: "+wc.getSettings());
log.debug("settings: {}", wc.getSettings());
WizardTest.this.dispose();
}

@Override
public void onFinished(List<WizardPage> path, WizardSettings settings) {
log.debug("settings: "+wc.getSettings());
log.debug("settings: {}", wc.getSettings());
WizardTest.this.dispose();
}

@Override
public void onPageChanged(WizardPage newPage, List<WizardPage> path) {
log.debug("settings: "+wc.getSettings());
log.debug("settings: {}", wc.getSettings());
// Set the dialog title to match the description of the new page:
WizardTest.this.setTitle(newPage.getDescription());
}
Expand Down Expand Up @@ -165,7 +165,7 @@ public void rendering(List<WizardPage> path, WizardSettings settings) {
@Override
public WizardPage createPage(List<WizardPage> path,
WizardSettings settings) {
log.debug("creating page "+path.size());
log.debug("creating page {}", path.size());

// Get the next page to display. The path is the list of all wizard
// pages that the user has proceeded through from the start of the
Expand All @@ -179,7 +179,7 @@ public WizardPage createPage(List<WizardPage> path,
// In fact, we can do arbitrarily complex computation to determine
// the next wizard page.

log.debug("Returning page: "+page);
log.debug("Returning page: {}", page);
return page;
}

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/ciscavate/cjwizard/WizardTest2.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,19 @@ public WizardTest2(){
wc.addWizardListener(new WizardListener(){
@Override
public void onCanceled(List<WizardPage> path, WizardSettings settings) {
log.debug("settings: "+wc.getSettings());
log.debug("settings: {}", wc.getSettings());
WizardTest2.this.dispose();
}

@Override
public void onFinished(List<WizardPage> path, WizardSettings settings) {
log.debug("settings: "+wc.getSettings());
log.debug("settings: {}", wc.getSettings());
WizardTest2.this.dispose();
}

@Override
public void onPageChanged(WizardPage newPage, List<WizardPage> path) {
log.debug("settings: "+wc.getSettings());
log.debug("settings: {}", wc.getSettings());
// Set the dialog title to match the description of the new page:
WizardTest2.this.setTitle(newPage.getDescription());
}
Expand All @@ -101,7 +101,7 @@ private class TestFactory implements PageFactory{
@Override
public WizardPage createPage(List<WizardPage> path,
WizardSettings settings) {
log.debug("creating page "+path.size());
log.debug("creating page {}", path.size());

// Get the next page to display. The path is the list of all wizard
// pages that the user has proceeded through from the start of the
Expand All @@ -116,7 +116,7 @@ public WizardPage createPage(List<WizardPage> path,
// In fact, we can do arbitrarily complex computation to determine
// the next wizard page.

log.debug("Returning page: "+page);
log.debug("Returning page: {}", page);
return page;
}

Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/i18n/cjwizard.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PREVIOUS=< Prev
NEXT=Next >
FINISH=Finish
CANCEL=Cancel
4 changes: 4 additions & 0 deletions src/main/resources/i18n/cjwizard_pl.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PREVIOUS=Wstecz
NEXT=Dalej
FINISH=Zako\u0144cz
CANCEL=Anuluj