Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profile gui #62

Merged
merged 11 commits into from
Jul 1, 2020
Merged
Show file tree
Hide file tree
Changes from 9 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
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -29,7 +25,7 @@
*/
public class AskOpinionForUtility {

private static final Logger LOGGER = LoggerFactory.getLogger(CreateApartmentGUI.class);
private static final Logger LOGGER = LoggerFactory.getLogger(AskOpinionForUtility.class);

/** To move for questions */
int pointer = 0;
Expand Down Expand Up @@ -68,13 +64,13 @@ public AskOpinionForUtility() {

/**
* This is the main function, it asks Questions , AdaptAnswers and then displays the list of
* Apartements
* Apartments
*
* @param args
* @throws IllegalAccessException for the DisplayApps function
GabG02 marked this conversation as resolved.
Show resolved Hide resolved
* @throws IOException
*/
public static void main(String[] args) throws IllegalAccessException, IOException {
public static void main(String[] args) {
GabG02 marked this conversation as resolved.
Show resolved Hide resolved

AskOpinionForUtility asker = new AskOpinionForUtility();
ApartmentValueFunction avf = new ApartmentValueFunction();
Expand Down Expand Up @@ -102,9 +98,6 @@ public static void main(String[] args) throws IllegalAccessException, IOExceptio
avf = avf.withSubjectiveValueWeight(Criterion.WIFI, 0);

LOGGER.info("Begining the Layout.");

LayoutApartmentGUI lay = new LayoutApartmentGUI(avf);
lay.displayAppart();
}

/**
Expand All @@ -117,7 +110,7 @@ public void askQuestions() {
choix1.add(Criterion.TELE);
choix2.add(Criterion.PRICE_PER_NIGHT);

shell.setText("Votre avis nous intéresse ;)");
shell.setText("Profile selection - Questions");
shell.setLayout(new GridLayout());
shell.setBounds(500, 500, 600, 500);

Expand Down Expand Up @@ -149,6 +142,7 @@ public void askQuestions() {
// the listener when we click on finish
Listener finishlistener =
new Listener() {
@Override
public void handleEvent(Event event) {

Preconditions.checkArgument(
Expand Down Expand Up @@ -221,6 +215,7 @@ public void clickOnButton(Button pressedButton, Button unPressedButton) {
Label boo = new Label(shell, SWT.NULL);
pressedButton.addSelectionListener(
new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Button source1 = (Button) e.widget;

Expand Down Expand Up @@ -262,13 +257,13 @@ public void widgetSelected(SelectionEvent e) {
public ApartmentValueFunction adaptAnswers(ApartmentValueFunction avf) {

// we collect the answers on the minimums and we adapt the utility of the user
avf = avf.adaptBounds(Criterion.NB_BEDROOMS, nbBedMin, true);
avf = avf.adaptBounds(Criterion.FLOOR_AREA, surfaceMin, true);
avf.adaptBounds(Criterion.NB_BEDROOMS, nbBedMin, true);
avf.adaptBounds(Criterion.FLOOR_AREA, surfaceMin, true);

// we collect the answer of the first Question and adapt the utility of the user
if (moreImportantAttributes.get(0).equals("WIFI")
&& lessImportantAttributes.get(0).equals("TERRACE")) {
avf = avf.adaptWeight(Criterion.WIFI, Criterion.TERRACE);
avf.adaptWeight(Criterion.WIFI, Criterion.TERRACE);
} else {
avf.adaptWeight(Criterion.TERRACE, Criterion.WIFI);
}
Expand All @@ -277,9 +272,9 @@ public ApartmentValueFunction adaptAnswers(ApartmentValueFunction avf) {
// user
if (moreImportantAttributes.get(1).equals("TELE")
&& lessImportantAttributes.get(1).equals("PRICE_PER_NIGHT low")) {
avf = avf.adaptWeight(Criterion.TELE, Criterion.PRICE_PER_NIGHT);
avf.adaptWeight(Criterion.TELE, Criterion.PRICE_PER_NIGHT);
} else {
avf = avf.adaptWeight(Criterion.PRICE_PER_NIGHT, Criterion.TELE);
avf.adaptWeight(Criterion.PRICE_PER_NIGHT, Criterion.TELE);
}

return avf;
Expand Down
Loading