Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8926448
commit 887441a
Showing
8 changed files
with
247 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
ummisco.gama.ui.shared/src/ummisco/gama/ui/parameters/GamaWizard.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package ummisco.gama.ui.parameters; | ||
|
||
import java.util.List; | ||
|
||
import org.eclipse.jface.wizard.Wizard; | ||
|
||
import msi.gama.util.GamaListFactory; | ||
import msi.gama.util.IList; | ||
import msi.gama.util.IMap; | ||
|
||
|
||
public class GamaWizard extends Wizard{ | ||
protected List<GamaWizardPage> pages; | ||
protected String title; | ||
|
||
public GamaWizard(String title, List<GamaWizardPage> pages) { | ||
super(); | ||
this.title = title; | ||
this.pages = pages; | ||
setNeedsProgressMonitor(true); | ||
} | ||
|
||
@Override | ||
public String getWindowTitle() { | ||
return title; | ||
} | ||
|
||
public IList<IMap<String, Object>> getValues() { | ||
IList<IMap<String, Object>> values = GamaListFactory.create(); | ||
for(GamaWizardPage p : pages) { | ||
System.out.println("page: " + p); | ||
values.add(p.getValues()); | ||
} | ||
return values; | ||
} | ||
|
||
@Override | ||
public void addPages() { | ||
for (GamaWizardPage p : pages) { | ||
addPage(p); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean performFinish() { | ||
return true; | ||
} | ||
|
||
|
||
|
||
} |
33 changes: 33 additions & 0 deletions
33
ummisco.gama.ui.shared/src/ummisco/gama/ui/parameters/GamaWizardDialog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package ummisco.gama.ui.parameters; | ||
|
||
|
||
import org.eclipse.jface.wizard.WizardDialog; | ||
import org.eclipse.swt.graphics.Point; | ||
import org.eclipse.swt.widgets.Shell; | ||
|
||
import msi.gama.util.IList; | ||
import msi.gama.util.IMap; | ||
|
||
public class GamaWizardDialog extends WizardDialog{ | ||
|
||
GamaWizard wizard; | ||
public GamaWizardDialog(Shell parentShell, GamaWizard newWizard) { | ||
super(parentShell, newWizard); | ||
this.wizard = newWizard; | ||
} | ||
|
||
/*@Override | ||
protected Point getInitialSize() { | ||
final var p = super.getInitialSize(); | ||
return new Point(p.x * 2, p.y); | ||
} | ||
@Override | ||
protected boolean isResizable() { | ||
return true; | ||
}*/ | ||
|
||
public IList<IMap<String, Object>> getValues() { | ||
return wizard.getValues(); | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
ummisco.gama.ui.shared/src/ummisco/gama/ui/parameters/GamaWizardPage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package ummisco.gama.ui.parameters; | ||
|
||
import java.util.List; | ||
|
||
import org.eclipse.jface.wizard.WizardPage; | ||
import org.eclipse.swt.SWT; | ||
import org.eclipse.swt.layout.GridLayout; | ||
import org.eclipse.swt.widgets.Composite; | ||
|
||
import msi.gama.kernel.experiment.IParameter; | ||
import msi.gama.runtime.IScope; | ||
import msi.gama.util.GamaFont; | ||
import msi.gama.util.GamaMapFactory; | ||
import msi.gama.util.IMap; | ||
import ummisco.gama.ui.interfaces.EditorListener; | ||
|
||
public class GamaWizardPage extends WizardPage{ | ||
|
||
private final IMap<String, Object> values = GamaMapFactory.createUnordered(); | ||
private final List<IParameter> parameters; | ||
private final GamaFont font; | ||
private final IScope scope; | ||
|
||
public GamaWizardPage(final IScope scope, final List<IParameter> parameters, | ||
final String title, final String description, final GamaFont font) { | ||
super(title); | ||
setTitle(title); | ||
setDescription(description); | ||
this.scope = scope; | ||
this.font = font; | ||
this.parameters = parameters; | ||
parameters.forEach(p -> { | ||
values.put(p.getName(), p.getInitialValue(scope)); | ||
}); | ||
} | ||
|
||
@Override | ||
public void createControl(Composite parent) { | ||
Composite composite = new Composite(parent, SWT.NONE); | ||
GridLayout layout = new GridLayout(); | ||
composite.setLayout(layout); | ||
layout.numColumns = 2; | ||
parameters.forEach(param -> { | ||
final EditorListener<?> listener = newValue -> { | ||
param.setValue(scope, newValue); | ||
values.put(param.getName(), newValue); | ||
}; | ||
EditorFactory.create(scope, composite, param, listener, false, false); | ||
}); | ||
composite.layout(); | ||
setControl(composite); | ||
} | ||
|
||
public IMap<String, Object> getValues() { | ||
return values; | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters