Example usage for com.vaadin.ui VerticalLayout setHeight

List of usage examples for com.vaadin.ui VerticalLayout setHeight

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout setHeight.

Prototype

@Override
    public void setHeight(String height) 

Source Link

Usage

From source file:edu.nps.moves.mmowgli.modules.cards.CardChainPage.java

License:Open Source License

private void addChildListsTL() {
    MovePhase phase = MovePhase.getCurrentMovePhaseTL();
    Set<CardType> allowedTypes = phase.getAllowedCards();
    followOnTypes = new ArrayList<CardType>();
    for (CardType ct : allowedTypes)
        if (!ct.isIdeaCard()) // "idea/initiating" is the opposite of followon
            followOnTypes.add(ct);/* ww w. java  2 s . c  o  m*/

    Collections.sort(followOnTypes, new Comparator<CardType>() {
        @Override
        public int compare(CardType arg0, CardType arg1) {
            return (int) (arg0.getDescendantOrdinal() - arg1.getDescendantOrdinal());
        }
    });

    columnVLs = new ArrayList<VerticalLayout>(followOnTypes.size());

    for (int i = 0; i < followOnTypes.size(); i++) {
        VerticalLayout vl = new VerticalLayout();
        vl.setSpacing(true);
        columnVLs.add(vl);
        listsHL.addComponent(vl);
    }
    Card card = Card.getTL(cardId);
    Card parent = card.getParentCard();
    VerticalLayout spacerVL = new VerticalLayout();

    if (parent != null) {
        topHL.addComponent(spacerVL);
        topHL.setExpandRatio(spacerVL, 1.0f);
        spacerVL.setWidth("100%");

        parentSumm = CardSummary.newCardSummarySmallTL(parent.getId());
        spacerVL.addComponent(parentSumm);
        parentSumm.initGui();
        spacerVL.setComponentAlignment(parentSumm, Alignment.MIDDLE_CENTER);
        parentSumm.setCaption("Parent Card");
        parentSumm.addStyleName("m-parent-card-summary");
    } else {
        topHL.addComponent(spacerVL);
        topHL.setExpandRatio(spacerVL, 1.0f);
        spacerVL.setWidth("100%");

        gotoTopLevelButt.setStyleName("m-gotoTopLevelButton");
        gotoTopLevelButt.setDescription(idea_dash_tt);
        gotoTopLevelButt.setId(PLAY_AN_IDEA_BLUE_BUTTON);
        gotoTopLevelButt.setDescription("Show two top-level card rows");
        spacerVL.addComponent(gotoTopLevelButt);
        spacerVL.setComponentAlignment(gotoTopLevelButt, Alignment.MIDDLE_CENTER);

    }
    if (isGameMaster) {
        spacerVL.addComponent(cardMarkingPanel);
        spacerVL.setComponentAlignment(cardMarkingPanel, Alignment.BOTTOM_LEFT);
    }

    cardLg = CardLarge.newCardLargeTL(card.getId());
    topHL.addComponent(cardLg);
    cardLg.initGuiTL();

    VerticalLayout buttVL = new VerticalLayout();
    buttVL.setHeight("100%");
    topHL.addComponent(buttVL);
    topHL.setComponentAlignment(buttVL, Alignment.MIDDLE_CENTER);
    topHL.setExpandRatio(buttVL, 1.0f);

    Label spacer = new Label();
    buttVL.addComponent(spacer);
    buttVL.setExpandRatio(spacer, 1.0f);

    buttVL.addComponent(gotoIdeaDashButt);
    gotoIdeaDashButt.setStyleName("m-gotoIdeaDashboardButton");
    gotoIdeaDashButt.setDescription(idea_dash_tt);
    gotoIdeaDashButt.setId(GO_TO_IDEA_DASHBOARD_BUTTON);
    buttVL.setComponentAlignment(gotoIdeaDashButt, Alignment.MIDDLE_CENTER);

    buttVL.addComponent(chainButt);
    chainButt.setStyleName("m-viewCardChainButton");
    chainButt.setDescription(view_chain_tt);
    buttVL.setComponentAlignment(chainButt, Alignment.MIDDLE_CENTER);

    spacer = new Label();
    buttVL.addComponent(spacer);
    buttVL.setExpandRatio(spacer, 1.0f);

    int col = -1;
    for (CardType ct : followOnTypes) {
        col++;
        VerticalLayout columnV = columnVLs.get(col);

        CardSummaryListHeader lstHdr = CardSummaryListHeader.newCardSummaryListHeader(ct, card);
        lstHdr.addNewCardListener(this);
        columnV.addComponent(lstHdr);
        lstHdr.initGui();
    }

    listFollowers_oobTL(card.getId()); // gets current vaadin transaction session
}

From source file:edu.nps.moves.mmowgli.modules.cards.IdeaDashboardTabPanel.java

License:Open Source License

protected void buildCardTable() {
    VerticalLayout vLay = new VerticalLayout();
    vLay.setWidth("95%");
    vLay.setHeight("100%");
    getRightLayout().addComponent(vLay);

    vLay.addComponent(makeTableHeaders());

    Panel pan = new Panel();
    pan.setWidth("99%");
    pan.setHeight("99%");
    pan.setStyleName(Reindeer.PANEL_LIGHT);
    vLay.addComponent(pan);/*w ww.ja  va  2 s.c o m*/
    vLay.setExpandRatio(pan, 1.0f); // all of it

    VerticalLayout tableLay;
    pan.setContent(tableLay = new VerticalLayout());
    pan.addStyleName("m-greyborder");
    tableLay.setWidth("99%");

    List<Card> cards = getCardList();

    for (Card c : cards) {
        if (confirmCard(c)) {
            CardSummaryLine csl;
            tableLay.addComponent(csl = new CardSummaryLine(c.getId()));
            csl.initGui();
            csl.setWidth("98%");
        }
    }
}

From source file:edu.nps.moves.mmowgli.modules.gamemaster.UserAdminPanel.java

License:Open Source License

public void initGuiTL() {
    setWidth(APPLICATION_SCREEN_WIDTH);/* ww w .  ja  v  a2s.c o  m*/
    setHeight("100%");
    setSpacing(false);

    HorizontalLayout titleHL = new HorizontalLayout();
    addComponent(titleHL);
    Label lab;
    titleHL.addComponent(lab = new Label());
    lab.setWidth("20px");

    VerticalLayout tableVLayout = new VerticalLayout();
    tableContainer = tableVLayout;
    tableVLayout.setWidth(APPLICATION_SCREEN_WIDTH);
    tableVLayout.setHeight("900px");
    tableVLayout.setSpacing(true);
    tableVLayout.addStyleName("m-whitepage-header");

    addComponent(tableVLayout);

    tableVLayout.addComponent(lab = new Label());
    lab.setHeight("20px");
    tableVLayout.addComponent(
            lab = new HtmlLabel("<span style='margin-left:40px;color:red;'>" + WARNING_LABEL + "</span>"));
    lab.addStyleName("m-text-align-center");
    tableVLayout.addComponent(
            new HtmlLabel("<span style='margin-left:40px;'>" + getNumberUsersLabelTL() + "</span>"));
    tableVLayout.addComponent(
            new HtmlLabel("<span style='margin-left:40px;'>" + getNumberOnlineLabel() + "</span>"));
    tableVLayout.addComponent(
            new HtmlLabel("<span style='margin-left:40px;'>" + getNumberGameMastersTL() + "</span>"));
    tableVLayout.addComponent(
            new HtmlLabel("<span style='margin-left:40px;'>" + getNumberCardsLabelTL() + "</span>"));
    tableVLayout
            .addComponent(new HtmlLabel("<span style='margin-left:40px;'>Double click a row to edit</span>"));

    tableVLayout.addComponent(lab = new HtmlLabel(
            "<center><b><span style='font-size:175%'>Player Administration</span></b></center>"));

    HorizontalLayout srchHL = buildSearchRow();
    tableVLayout.addComponent(srchHL);
    tableVLayout.setComponentAlignment(srchHL, Alignment.MIDDLE_CENTER);

    table = createTable(lastTableFiller = new SimpleTableFiller());

    table.setCaption(null);
    addTableToLayout(Mmowgli2UI.getGlobals().getUserID());
}

From source file:edu.nps.moves.mmowgli.modules.registrationlogin.RegistrationPageBase.java

License:Open Source License

@Override
public void initGui() {
    setWidth("988px"); // same width as included panel
    setHeight(BIGGESTWINDOW_HEIGHT_S); // try to handle making the popup miss the video

    Instrumentation.addInstrumentation(this);

    Game game = Game.getTL();//from w w  w  .  j  a  v a  2 s .c  o m
    MovePhase phase = game.getCurrentMove().getCurrentMovePhase();

    HorizontalLayout outerLayout = new HorizontalLayout();
    outerLayout.setSpacing(true);
    addComponent(outerLayout);
    outerLayout.setWidth("988px");
    setExpandRatio(outerLayout, 1);
    Label spacer;

    outerLayout.addComponent(baseVLayout = new VerticalLayout());
    baseVLayout.setWidth("988px");
    outerLayout.setComponentAlignment(baseVLayout, Alignment.TOP_CENTER);
    baseVLayout.setSpacing(true);

    // This is just to give us a hidden widget to update to keep push channel alive through Akamai
    outerLayout.addComponent(pushPingLab = new HtmlLabel(""));
    pushPingLab.setWidth("5px");

    String headingStr = phase.getOrientationCallToActionText();
    String summaryStr = phase.getOrientationHeadline();
    String textStr = phase.getOrientationSummary();
    Media vid = phase.getOrientationVideo();

    vidPan = new VideoWithRightTextPanel(vid, headingStr, summaryStr, textStr, null);
    vidPan.setLargeText(true);
    baseVLayout.addComponent(vidPan);
    vidPan.initGui();

    HorizontalLayout bottomHLayout = new HorizontalLayout();
    bottomHLayout.addComponent(spacer = new Label()); // special spacer
    bottomHLayout.setExpandRatio(spacer, 1.0f);

    Label[] spacers = new Label[5];

    Label lab;
    int numButts = 0;

    // Email signup button
    //-----------------------
    if (phase.isSignupButtonShow()) {
        VerticalLayout signupVL = new VerticalLayout();
        signupVL.setHeight("50px");
        signupVL.setMargin(false);

        if (mockupOnly)
            signupVL.addComponent(signupButt = new NativeButton(null)); // no handler
        else
            signupVL.addComponent(signupButt = new NativeButton(null, this));
        signupButt.addStyleName("signupbutton");
        signupButt.setEnabled(phase.isSignupButtonEnabled());
        Mmowgli2UI.getGlobals().mediaLocator().decorateImageButton(signupButt, phase.getSignupButtonIcon());
        signupVL.setComponentAlignment(signupButt, Alignment.MIDDLE_CENTER);

        signupVL.addComponent(lab = new Label());
        lab.setHeight("1px");
        signupVL.setExpandRatio(lab, 1.0f);

        signupVL.addComponent(lab = new HtmlLabel(phase.getSignupButtonSubText()));
        lab.addStyleName("m-text-align-center");
        signupButt.setDescription(phase.getSignupButtonToolTip());
        lab.setDescription(phase.getSignupButtonToolTip());
        lab.setEnabled(phase.isSignupButtonEnabled());
        signupVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

        bottomHLayout.addComponent(signupVL);
        numButts++;
    }

    // New player reg button
    //----------------------
    if (phase.isNewButtonShow()) {
        if (numButts > 0)
            bottomHLayout.addComponent(spacers[numButts] = new Label());

        VerticalLayout newButtVL = new VerticalLayout();
        newButtVL.setHeight("50px");
        newButtVL.setMargin(false);

        if (mockupOnly)
            newButtVL.addComponent(imNewButt = new NativeButton(null)); // no handler
        else
            newButtVL.addComponent(imNewButt = new NativeButton(null, this));
        imNewButt.setEnabled(phase.isNewButtonEnabled());
        imNewButt.addStyleName("newuserbutton");
        Mmowgli2UI.getGlobals().mediaLocator().decorateImageButton(imNewButt, phase.getNewButtonIcon());
        newButtVL.setComponentAlignment(imNewButt, Alignment.MIDDLE_CENTER);

        newButtVL.addComponent(lab = new Label());
        lab.setHeight("1px");
        newButtVL.setExpandRatio(lab, 1.0f);

        /*
              boolean gameRO = game.isReadonly();
              boolean gameClamped = game.isRegisteredLogonsOnly();
              imNewButt.setEnabled(!gameRO & !gameClamped);
                
              // Label lab;
              if (gameRO) {
                newButtVL.addComponent(lab = new Label("No new player accounts, for now")); // "Player registration is currently closed"));
                                                                            // //"Sorry, no more new players"));
                String s;
                lab.setDescription(s = "New player accounts will open when game play starts");
                imNewButt.setDescription(s);
              }
              else if (gameClamped)
                newButtVL.addComponent(lab = new Label("The game is full, please retry later")); // "Sorry, no more new players"));
              else
                newButtVL.addComponent(lab = new Label("You can get started in 2 minutes..."));
        */
        newButtVL.addComponent(lab = new HtmlLabel(phase.getNewButtonSubText()));
        newButtVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);
        lab.addStyleName("m-text-align-center");
        lab.setEnabled(phase.isNewButtonEnabled());
        imNewButt.setDescription(phase.getNewButtonToolTip());
        lab.setDescription(phase.getNewButtonToolTip());

        newButtVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

        bottomHLayout.addComponent(newButtVL);
        numButts++;
    }

    // Existing player button
    //-----------------------
    if (phase.isLoginButtonShow()) {
        if (numButts > 0)
            bottomHLayout.addComponent(spacers[numButts] = new Label());

        VerticalLayout rightButtVL = new VerticalLayout();
        rightButtVL.setHeight("50px");
        rightButtVL.setMargin(false);

        if (mockupOnly)
            rightButtVL.addComponent(imRegisteredButt = new NativeButton(null)); // no handler
        else
            rightButtVL.addComponent(imRegisteredButt = new NativeButton(null, this));
        imRegisteredButt.addStyleName("loginbutton");
        imRegisteredButt.setEnabled(phase.isLoginButtonEnabled());

        Mmowgli2UI.getGlobals().mediaLocator().decorateImageButton(imRegisteredButt,
                phase.getLoginButtonIcon());
        rightButtVL.setComponentAlignment(imRegisteredButt, Alignment.MIDDLE_CENTER);

        rightButtVL.addComponent(lab = new Label());
        lab.setHeight("1px");
        rightButtVL.setExpandRatio(lab, 1.0f);

        rightButtVL.addComponent(lab = new HtmlLabel(phase.getLoginButtonSubText()));
        lab.addStyleName("m-text-align-center");
        lab.setEnabled(phase.isLoginButtonEnabled());
        rightButtVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

        imRegisteredButt.setDescription(phase.getLoginButtonToolTip());
        lab.setDescription(phase.getLoginButtonToolTip());

        bottomHLayout.addComponent(rightButtVL);
        numButts++;

        checkQuickCACLoginTL();
    }

    // Guest signup button
    //-----------------------
    if (phase.isGuestButtonShow()) {
        if (numButts > 0)
            bottomHLayout.addComponent(spacers[numButts] = new Label());

        VerticalLayout guestButtVL = new VerticalLayout();
        guestButtVL.setHeight("50px");
        guestButtVL.setMargin(false);

        if (mockupOnly)
            guestButtVL.addComponent(guestButt = new NativeButton(null));
        else
            guestButtVL.addComponent(guestButt = new NativeButton(null, this));
        guestButt.addStyleName("guestbutton");
        guestButt.setEnabled(phase.isGuestButtonEnabled());

        Mmowgli2UI.getGlobals().mediaLocator().decorateImageButton(guestButt, phase.getGuestButtonIcon());
        guestButtVL.setComponentAlignment(guestButt, Alignment.MIDDLE_CENTER);

        guestButtVL.addComponent(lab = new Label());
        lab.setHeight("1px");
        guestButtVL.setExpandRatio(lab, 1.0f);

        guestButtVL.addComponent(lab = new HtmlLabel(phase.getGuestButtonSubText()));
        lab.addStyleName("m-text-align-center");
        guestButtVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

        guestButt.setDescription(phase.getGuestButtonToolTip());
        lab.setDescription(phase.getGuestButtonToolTip());
        lab.setEnabled(phase.isGuestButtonEnabled());
        bottomHLayout.addComponent(guestButtVL);
        numButts++;
    }

    for (int i = 0; i < numButts; i++)
        if (spacers[i] != null)
            spacers[i].setWidth(BUTTON_SPACING[numButts]);

    bottomHLayout.addComponent(spacer = new Label()); // special spacer
    bottomHLayout.setExpandRatio(spacer, 1.0f);

    baseVLayout.addComponent(bottomHLayout);
    baseVLayout.setComponentAlignment(bottomHLayout, Alignment.TOP_CENTER);

    lab = new HtmlLabel(
            "<center>Each MMOWGLI game is independent.<br>&nbsp;You need a new account for every game.&nbsp;</center>");
    lab.setSizeUndefined();
    lab.addStyleName("m-margintop-20");
    lab.addStyleName("m-greyborder");
    lab.addStyleName("m-background-white");
    lab.addStyleName("m-opacity-75");
    baseVLayout.addComponent(lab);
    baseVLayout.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

    String troubleUrl = GameLinks.getTL().getTroubleLink();
    Link lnk = new Link("Trouble signing in?", new ExternalResource(troubleUrl));
    baseVLayout.addComponent(lnk);
    lnk.setTargetName(PORTALTARGETWINDOWNAME);
    lnk.setTargetBorder(BorderStyle.DEFAULT);
    lnk.addStyleName("m-margin-top-20");
    baseVLayout.setComponentAlignment(lnk, Alignment.MIDDLE_CENTER);

    //checkUserLimits();  done from app entry point
}

From source file:eu.livotov.tpt.gui.dialogs.DownloadDialog.java

License:Apache License

private void initUI() {
    VerticalLayout layout = new VerticalLayout();
    setLayout(layout);/*from  w  w w . ja v a2s  .co m*/

    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setHeight("100%");
    layout.setWidth("100%");

    buttonsArea = new DownloadDialogButtonsComponent(parentWindow.getApplication());
    layout.addComponent(buttonsArea);

    setWidth("450px");
    setHeight("240px");
}

From source file:eu.livotov.tpt.gui.dialogs.InputDialog.java

License:Apache License

private void initUI() {
    VerticalLayout layout = new VerticalLayout();
    setLayout(layout);//from w w  w .  ja v a 2 s. co  m

    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setHeight("100%");
    layout.setWidth("100%");

    layout.addComponent(buttonsArea);

    setWidth("450px");
    setHeight("180px");
}

From source file:eu.lod2.LOD2Demo.java

License:Apache License

@Override
public void init() {
    state = new LOD2DemoState();

    mainWindow = new Window("LOD2 Prototype");
    setTheme("lod2");
    mainContainer = new VerticalLayout();
    mainWindow.addComponent(mainContainer);
    mainContainer.setSizeFull();//from  w ww.  j  av a2s. c  o  m

    final AbsoluteLayout welcomeSlagzin = new AbsoluteLayout();
    welcomeSlagzin.setWidth("370px");
    welcomeSlagzin.setHeight("75px");
    final Link homepage = new Link();
    homepage.setResource(new ExternalResource("http://lod2.eu"));
    final ThemeResource logo = new ThemeResource("app_images/logo-lod2-small.png");
    homepage.setIcon(logo);
    welcomeSlagzin.addComponent(homepage, "top:0px; left:5px");
    homepage.setSizeFull();
    homepage.addStyleName("logo");

    // the current graph as label
    /*
    currentgraphlabel = new Label("no current graph selected");
    currentgraphlabel.addStyleName("currentgraphlabel");
    */

    Button homeb = new Button("home");
    homeb.setDebugId(this.getClass().getSimpleName() + "_homeb");
    homeb.addListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            home();
        }
    });
    homeb.setStyleName(BaseTheme.BUTTON_LINK);
    homeb.addStyleName("currentgraphlabel");

    currentgraphlabel = state.cGraph;
    currentgraphlabel.addStyleName("currentgraphlabel");
    // Create an horizontal container
    HorizontalLayout welcomeContainer = new HorizontalLayout();

    //menubarContainer.addComponent(lod2logo);
    welcomeContainer.addComponent(welcomeSlagzin);
    welcomeContainer.setComponentAlignment(welcomeSlagzin, Alignment.TOP_LEFT);
    welcomeContainer.addComponent(homeb);
    welcomeContainer.setComponentAlignment(homeb, Alignment.TOP_RIGHT);
    welcomeContainer.addComponent(currentgraphlabel);
    welcomeContainer.setComponentAlignment(currentgraphlabel, Alignment.TOP_RIGHT);

    final VerticalLayout welcome = new VerticalLayout();
    welcome.addComponent(welcomeContainer);
    // unfortunately, we need to be able to build components from outside
    // this initialization function and the welcome component needs to be
    // resized properly afterward
    this.welcome = welcome;

    mainContainer.addComponent(welcome);

    //************************************************************************
    //  menu bar style
    //
    MenuBar menubar = new MenuBar();
    menubar.setDebugId(this.getClass().getSimpleName() + "_menubar");

    // First define all menu commands

    MenuBar.Command me1c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            ELoadRDFFile content = new ELoadRDFFile(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(content, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };

    MenuBar.Command me3c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            EXML me3c_content = new EXML(state);
            workspace.addComponent(me3c_content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            me3c_content.setSizeFull();
        }
    };
    MenuBar.Command me3cbis = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            EXMLExtended content = new EXMLExtended(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setSizeFull();
        }
    };

    MenuBar.Command me4c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            ESpotlight content = new ESpotlight(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(content, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };

    MenuBar.Command me5c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            EPoolPartyExtractor me5c_content = new EPoolPartyExtractor(state);
            workspace.addComponent(me5c_content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            me5c_content.setHeight("90%");
        }
    };

    MenuBar.Command me6c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            D2RCordis content = new D2RCordis(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(content, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };

    MenuBar.Command me7c_1 = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            IframedUrl content = new IframedUrl(state, "http://publicdata.eu/dataset?res_format=RDF&q=rdf");
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(content, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };

    MenuBar.Command me7c_2 = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            IframedUrl content = new IframedUrl(state, "http://datahub.io/dataset?groups=lodcloud");
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(content, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };

    MenuBar.Command me8c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            EURL content = new EURL(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setHeight("90%");
        }
    };

    MenuBar.Command me9c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            EPoolPartyLabel content = new EPoolPartyLabel(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setHeight("90%");
        }
    };

    MenuBar.Command silk = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            LinkingTab lsilk = new LinkingTab(state);
            workspace.addComponent(lsilk);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            lsilk.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(lsilk, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };

    MenuBar.Command limes = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            Limes limes = new Limes(state);
            workspace.addComponent(limes);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            limes.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(limes, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };

    MenuBar.Command sameaslinking = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            SameAsLinking content = new SameAsLinking(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setSizeFull();
        }
    };

    MenuBar.Command ore = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            ORE content = new ORE(state);
            workspace.addComponent(content);
            welcome.setHeight("110px");
            content.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(content, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };

    MenuBar.Command lodrefine = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            Lodrefine content = new Lodrefine(state);
            workspace.addComponent(content);
            welcome.setHeight("110px");
            content.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(content, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };

    MenuBar.Command mconfiguration = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            ConfigurationTab content = new ConfigurationTab(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setHeight("500px");
        }
    };

    MenuBar.Command mabout = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            About content = new About(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
        }
    };

    MenuBar.Command mau = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            OntoWiki content = new OntoWiki(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(content, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };

    MenuBar.Command mq1c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            SesameSPARQL content = new SesameSPARQL(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(content, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };

    MenuBar.Command mq2c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            OntoWikiQuery content = new OntoWikiQuery(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(content, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };

    MenuBar.Command mq3c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            VirtuosoSPARQL content = new VirtuosoSPARQL(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(content, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };

    MenuBar.Command mq4c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            VirtuosoISPARQL content = new VirtuosoISPARQL(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(content, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };

    /** Deprecated temporarily
    MenuBar.Command mq5c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            GeoSpatial content = new GeoSpatial(state);
            workspace.addComponent(content);
          resetSizeFull(workspace);
            welcome.setHeight("110px");
          workspace.setSizeFull();
          workspace.setHeight("500px");
          workspace.setExpandRatio(content,1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
        }
    };
            
    MenuBar.Command mq_s_6c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
           workspace.removeAllComponents();
            Sparqled content = new Sparqled(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(content, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };
            
    MenuBar.Command mq_s_7c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
           workspace.removeAllComponents();
            SparqledManager content = new SparqledManager(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(content, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };
    */

    MenuBar.Command mo1c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            SameAs content = new SameAs(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setHeight("500px");
        }
    };

    /** Deprecated temporarily
    MenuBar.Command mo2c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            Sigma content = new Sigma(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(content, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };
    */

    MenuBar.Command mo3c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            LODCloud content = new LODCloud(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(content, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };

    MenuBar.Command mo4c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            DBpedia content = new DBpedia(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(content, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };

    MenuBar.Command mo5c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            SPARQLPoolParty content = new SPARQLPoolParty(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(content, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };

    MenuBar.Command mo6c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            OnlinePoolParty content = new OnlinePoolParty(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(content, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };

    MenuBar.Command mo7c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            MondecaSPARQLList content = new MondecaSPARQLList(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(content, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };

    MenuBar.Command mo8c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            CKAN content = new CKAN(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(content, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };

    MenuBar.Command mo9c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            IframedUrl content = new IframedUrl(state, "http://publicdata.eu");
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(content, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };

    /** Deprecated temporarily
    MenuBar.Command mo10c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            IframedUrl content = new IframedUrl(state, "http://sig.ma");
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(content, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };
    */

    MenuBar.Command mo11c = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            IframedUrl content = new IframedUrl(state, "http://sindice.com");
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setSizeFull();
            workspace.setSizeFull();
            workspace.setExpandRatio(content, 1.0f);
            mainContainer.setExpandRatio(workspace, 2.0f);
            mainWindow.getContent().setSizeFull();
        }
    };

    MenuBar.Command userinfoCommand = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            showInWorkspace(/*new Authenticator(*/new UserInformation(state)/*, state)*/);
        }
    };

    MenuBar.Command publishCommand = new Command() {
        public void menuSelected(MenuItem selectedItem) {
            // publishing should be protected with an authenticator, otherwise a store could be published
            // without provenance information!
            showInWorkspace(/*new Authenticator(*/new CKANPublisherPanel(state)/*, state)*/);
        }
    };

    MenuBar.Command mDeleteGraphs = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            showInWorkspace(/*new Authenticator(*/new DeleteGraphs(state)/*, state)*/);
        }
    };

    // Secondly define menu layout
    // root menu's
    MenuBar.MenuItem extraction = menubar.addItem("Extraction & Loading", null, null);
    MenuBar.MenuItem querying = menubar.addItem("Querying & Exploration", null, null);
    MenuBar.MenuItem authoring = menubar.addItem("Authoring", null, null);
    MenuBar.MenuItem linking = menubar.addItem("Linking", null, null);
    MenuBar.MenuItem enrichment = menubar.addItem("Enrichment & Data Cleaning", null, null);
    MenuBar.MenuItem onlinetools = menubar.addItem("Online Tools & Services", null, null);
    MenuBar.MenuItem configuration = menubar.addItem("Configuration", null, null);

    // sub menu's 
    MenuBar.MenuItem me1 = extraction.addItem("Upload RDF file or RDF from URL", null, me1c);
    //       MenuBar.MenuItem me1b = extraction.addItem("Import RDF data from URL", null, me8c);
    MenuBar.MenuItem me2_1 = extraction.addItem("Load RDF data from publicdata.eu", null, me7c_1);
    MenuBar.MenuItem me2_2 = extraction.addItem("Load LOD cloud RDF data from the Data Hub", null, me7c_2);
    MenuBar.MenuItem me3 = extraction.addItem("Extract RDF from XML", null, null);
    MenuBar.MenuItem me6 = extraction.addItem("Extract RDF from SQL", null, me6c);
    MenuBar.MenuItem me4 = extraction.addItem("Extract RDF from text w.r.t. DBpedia", null, me4c);
    MenuBar.MenuItem me5 = extraction.addItem("Extract RDF from text w.r.t. a controlled vocabulary", null,
            me5c);
    //       MenuBar.MenuItem me9  = extraction.addItem("Complete RDF w.r.t. a controlled vocabulary", null, me9c);

    MenuBar.MenuItem exml = me3.addItem("Basic extraction", null, me3c);
    MenuBar.MenuItem extended = me3.addItem("Extended extraction", null, me3cbis);

    MenuBar.MenuItem mq1 = querying.addItem("SPARQL querying", null, null);
    // Deprecated temporarily
    //MenuBar.MenuItem mq2 = querying.addItem("Sig.ma EE", null, mo2c);
    //MenuBar.MenuItem mq3 = querying.addItem("Geo-spatial exploration", null, mq5c);
    // TODO: replace this with a menu with two entries, editor and manager, after stephane fixes the manager
    //MenuBar.MenuItem mqs5 = mq1.addItem("SparQLed - Assisted Querying", null, mq_s_6c);
    //MenuBar.MenuItem mqsparqled1 = mqs5.addItem("Use currently selected graph", null, mq_s_6c);
    //MenuBar.MenuItem mqsparqled2 = mqs5.addItem("Use manager to calculate summary graph", null, mq_s_7c);
    //MenuBar.MenuItem mqs1 = mq1.addItem("Direct via Sesame API", null, mq1c);
    MenuBar.MenuItem mqs2 = mq1.addItem("OntoWiki SPARQL endpoint", null, mq2c);
    MenuBar.MenuItem mqs3 = mq1.addItem("Virtuoso SPARQL endpoint", null, mq3c);
    MenuBar.MenuItem mqs4 = mq1.addItem("Virtuoso interactive SPARQL endpoint", null, mq4c);

    MenuBar.MenuItem ma = authoring.addItem("OntoWiki", null, mau);
    MenuBar.MenuItem publishing = authoring.addItem("Publish to CKAN", null, publishCommand);

    MenuBar.MenuItem linking1 = linking.addItem("Silk", null, silk);
    MenuBar.MenuItem linking2 = linking.addItem("Limes", null, limes);
    MenuBar.MenuItem linking3 = linking.addItem("SameAs Linking", null, sameaslinking);

    MenuBar.MenuItem enrichment1 = enrichment.addItem("ORE", null, ore);
    MenuBar.MenuItem enrichment2 = enrichment.addItem("LOD enabled Refine", null, lodrefine);

    MenuBar.MenuItem sameAs = onlinetools.addItem("SameAs", null, mo1c);
    MenuBar.MenuItem sindice = onlinetools.addItem("Sindice", null, mo11c);
    //Deprecated temporarily
    //MenuBar.MenuItem sigmaOnline  = onlinetools.addItem("Sigma", null, mo10c);
    MenuBar.MenuItem ckan = onlinetools.addItem("CKAN", null, mo8c);
    MenuBar.MenuItem publicdata = onlinetools.addItem("Europe's Public Data", null, mo9c);
    MenuBar.MenuItem poolparty = onlinetools.addItem("PoolParty", null, mo6c);
    MenuBar.MenuItem sparqlonline = onlinetools.addItem("Online SPARQL endpoints", null, null);
    MenuBar.MenuItem lodcloud = sparqlonline.addItem("LOD cloud", null, mo3c);
    MenuBar.MenuItem dbpedia = sparqlonline.addItem("DBpedia", null, mo4c);
    MenuBar.MenuItem sparqlpoolparty = sparqlonline.addItem("PoolParty SPARQL endpoint", null, mo5c);
    MenuBar.MenuItem mondecalist = sparqlonline.addItem("Mondeca SPARQL endpoint Collection", null, mo7c);

    MenuBar.MenuItem conf = configuration.addItem("Demonstrator configuration", null, mconfiguration);
    MenuBar.MenuItem userconf = configuration.addItem("UserConfiguration", null, userinfoCommand);
    MenuBar.MenuItem about = configuration.addItem("About", null, mabout);
    MenuBar.MenuItem delgraphs = configuration.addItem("Delete Graphs", null, mDeleteGraphs);

    HorizontalLayout menubarContainer = new HorizontalLayout();
    menubarContainer.addComponent(menubar);
    menubarContainer.addStyleName("menubarContainer");
    menubarContainer.setWidth("100%");
    welcome.addComponent(menubarContainer);
    welcome.setHeight("110px");

    //************************************************************************
    // add workspace
    workspace = new VerticalLayout();

    mainContainer.addComponent(workspace);

    //create login/logout component that shows currently logged in user
    LoginStatus login = new LoginStatus(state, this.workspace);
    welcomeContainer.addComponent(login);
    welcomeContainer.setComponentAlignment(login, Alignment.TOP_RIGHT);
    welcomeContainer.setWidth("100%");

    /*
    workspace.setHeight("80%");
            
    HorizontalLayout introH = new HorizontalLayout();
    Embedded lod2cycle = new Embedded("", new ThemeResource("app_images/lod-lifecycle-small.png"));
    lod2cycle.setMimeType("image/png");
    introH.addComponent(lod2cycle);
    introH.setComponentAlignment(lod2cycle, Alignment.MIDDLE_LEFT);
            
    VerticalLayout introV =  new VerticalLayout();
    introH.addComponent(introV);
            
    Label introtextl =  new Label(introtext, Label.CONTENT_XHTML);
    introV.addComponent(introtextl);
    introtextl.setWidth("400px");
            
    HorizontalLayout introVH =  new HorizontalLayout();
    introV.addComponent(introVH);
            
    Embedded euflag = new Embedded("", new ThemeResource("app_images/eu-flag.gif"));
    euflag.setMimeType("image/gif");
    introVH.addComponent(euflag);
    euflag.addStyleName("eugif");
    euflag.setHeight("50px");
    Embedded fp7 = new Embedded("", new ThemeResource("app_images/fp7-gen-rgb_small.gif"));
    fp7.setMimeType("image/gif");
    fp7.addStyleName("eugif");
    fp7.setHeight("50px");
    introVH.addComponent(fp7);
            
    workspace.addComponent(introH);
    */
    home();

    // Create a tracker for the demo.lod2.eu domain.
    if (!state.googleAnalyticsID.equals("")) {
        //            GoogleAnalyticsTracker tracker = new GoogleAnalyticsTracker("UA-26375798-1", "demo.lod2.eu");
        GoogleAnalyticsTracker tracker = new GoogleAnalyticsTracker(state.googleAnalyticsID,
                state.googleAnalyticsDomain);
        mainWindow.addComponent(tracker);
        tracker.trackPageview("/lod2statworkbench");
    }
    ;

    setMainWindow(mainWindow);

    //       mainWindow.setExpandRatio(workspace, 1.0f);

    if (!state.InitStatus) {
        mainWindow.showNotification("Initialization Demonstration Failed", state.ErrorMessage,
                Notification.TYPE_ERROR_MESSAGE);
    }
    ;

}

From source file:eu.lod2.stat.StatLOD2Demo.java

License:Apache License

@Override
public void init() {
    ensureState();/*from   ww  w  .  jav  a2s. c  o m*/

    customComponentFactory = new CustomComponentFactory(state);

    mainWindow = new Window("LOD2 Statistical Workbench DEMO");
    setTheme("lod2");
    mainContainer = new VerticalLayout();
    mainWindow.addComponent(mainContainer);
    mainContainer.setSizeFull();

    final AbsoluteLayout welcomeSlagzin = new AbsoluteLayout();
    welcomeSlagzin.setWidth("370px");
    welcomeSlagzin.setHeight("75px");
    final Link homepage = new Link();
    homepage.setResource(new ExternalResource("http://lod2.eu"));
    final ThemeResource logo = new ThemeResource("app_images/logo-lod2-small.png");
    homepage.setIcon(logo);
    welcomeSlagzin.addComponent(homepage, "top:0px; left:5px");
    homepage.setSizeFull();
    homepage.addStyleName("logo");

    // the current graph as label
    /*
    currentgraphlabel = new Label("no current graph selected");
    currentgraphlabel.addStyleName("currentgraphlabel");
    */

    Button homeb = new Button("home");
    homeb.setDebugId(this.getClass().getSimpleName() + "_homeb");
    homeb.addListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            home();
        }
    });
    homeb.setStyleName(BaseTheme.BUTTON_LINK);
    homeb.addStyleName("currentgraphlabel");

    currentgraphlabel = state.cGraph;
    currentgraphlabel.addStyleName("currentgraphlabel");
    // Create an horizontal container
    HorizontalLayout welcomeContainer = new HorizontalLayout();
    HorizontalLayout stateContainer = new HorizontalLayout();
    VerticalLayout toolsContainer = new VerticalLayout();
    toolsContainer.setWidth("100%");
    welcomeContainer.setWidth("100%");

    //menubarContainer.addComponent(lod2logo);
    welcomeContainer.addComponent(welcomeSlagzin);
    welcomeContainer.addComponent(toolsContainer);
    toolsContainer.addComponent(stateContainer);
    welcomeContainer.setComponentAlignment(welcomeSlagzin, Alignment.TOP_LEFT);
    stateContainer.addComponent(homeb);
    welcomeContainer.setComponentAlignment(toolsContainer, Alignment.TOP_RIGHT);
    stateContainer.addComponent(currentgraphlabel);
    stateContainer.setComponentAlignment(homeb, Alignment.TOP_LEFT);
    stateContainer.setComponentAlignment(currentgraphlabel, Alignment.TOP_RIGHT);

    final VerticalLayout welcome = new VerticalLayout();
    welcome.addComponent(welcomeContainer);
    // unfortunately, we need to be able to build components from outside
    // this initialization function and the welcome component needs to be
    // resized properly afterward
    this.welcome = welcome;

    mainContainer.addComponent(welcome);

    //************************************************************************
    //  menu bar style
    //
    MenuBar menubar = new MenuBar();
    menubar.setDebugId(this.getClass().getSimpleName() + "_menubar");

    // First define all menu commands

    String sparqlAuthURL;
    if (state.getHostName().equals("http://localhost:8080")) {
        sparqlAuthURL = "http://localhost:8890/sparql-auth";
    } else {
        sparqlAuthURL = state.getHostName() + "/virtuoso/sparql-auth";
    }
    ;

    MenuBar.Command cmdOntoWikiCreateKB = getCustomComponentCommand(CompType.CreateKB);
    MenuBar.Command cmdOntoWikiImport = getCustomComponentCommand(CompType.ImportCSV);

    MenuBar.Command cmdSearchCubes = getCustomComponentCommand(CompType.SearchCubes);
    //        MenuBar.Command cmdConfigGUI = getCustomComponentCommand(CompType.ConfigGUIStat);
    MenuBar.Command cmdManageDSD = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            showInWorkspace(new DSDRepoComponentWrapper(state, workspace));
            //                showInWorkspace(new DSDRepoComponent(state.getRdfStore(), state.getCurrentGraph()));
        }
    };
    MenuBar.Command cmdValidation = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            showInWorkspace(new Validation(state, workspace));
        }
    };
    //MenuBar.Command cmdUploadRDF = getCustomComponentCommand(CompType.UploadRDF);
    //MenuBar.Command cmdExtractXML = getCustomComponentCommand(CompType.ExtractFromXML, false);
    //MenuBar.Command cmdExtractXMLE = getCustomComponentCommand(CompType.ExtractFromXMLExtended, false);
    MenuBar.Command cmdLoadFromPublicData = getFramedUrlCommand(
            "http://publicdata.eu/dataset?q=statistical&res_format=application%2Frdf%2Bxml&_res_format_limit=0&sort=relevance+asc");
    MenuBar.Command cmdLoadFromDataHub = getFramedUrlCommand(
            "http://datahub.io/dataset?tags=statistics&q=&groups=lodcloud");
    //MenuBar.Command cmdD2R = getCustomComponentCommand(CompType.D2R);
    MenuBar.Command cmdSparqled = getCustomComponentCommand(CompType.Sparqled);
    MenuBar.Command cmdSparqledManager = getCustomComponentCommand(CompType.SparqledManager);
    MenuBar.Command cmdSparqlOntowiki = getCustomComponentCommand(CompType.SparqlOW);
    MenuBar.Command cmdSparqlVirtuoso = getCustomComponentCommand(CompType.SparqlVirtuoso);
    MenuBar.Command cmdSparqlVirtuosoI = getCustomComponentCommand(CompType.SparqlIVirtuoso);
    MenuBar.Command cmdOntoWikiEdit = getCustomComponentCommand(CompType.EditWithOW);
    MenuBar.Command cmdSparqlUpdateVirtuoso = getFramedUrlCommand(sparqlAuthURL);
    MenuBar.Command cmdPoolPartyEdit = getCustomComponentCommand(CompType.OnlinePoolParty);
    MenuBar.Command cmdMergeDatasets = getCustomComponentCommand(CompType.MergeDatasets);
    MenuBar.Command cmdMergeDimensions = getCustomComponentCommand(CompType.MergeDimensions);
    MenuBar.Command cmdSliceDatasets = getCustomComponentCommand(CompType.SliceDatasets);
    //MenuBar.Command cmdCkan = getCustomComponentCommand(CompType.CKAN);
    MenuBar.Command cmdGeoSpatial = getCustomComponentCommand(CompType.GeoSpatial);
    MenuBar.Command cmdSilk = getCustomComponentCommand(CompType.Silk);
    MenuBar.Command cmdLodRefine = getCustomComponentCommand(CompType.LodRefine);
    MenuBar.Command cmdLimes = getCustomComponentCommand(CompType.Limes);
    MenuBar.Command cmdSameAs = getCustomComponentCommand(CompType.SameAs);
    //MenuBar.Command cmdPublicData = getFramedUrlCommand("http://publicdata.eu");
    //MenuBar.Command cmdSigMa = getFramedUrlCommand("http://sig.ma");
    MenuBar.Command cmdSindice = getFramedUrlCommand("http://sindice.com/main/submit");
    //MenuBar.Command cmdLODCloud = getCustomComponentCommand(CompType.LODCloud);
    MenuBar.Command cmdDBPedia = getCustomComponentCommand(CompType.DBPedia);
    MenuBar.Command cmdSPARQLPoolParty = getCustomComponentCommand(CompType.SPARQLPoolParty);
    MenuBar.Command cmdMondecaSPARQLList = getCustomComponentCommand(CompType.MondecaSPARQLList);
    MenuBar.Command cmdEditDataset = this.getEditDatasetCommand(this.state);
    MenuBar.Command cmdEditStructureDef = this.getEditStructureDefinition(this.state);
    MenuBar.Command cmdEditComponentProp = this.getEditComponentPropertyCommand(this.state);
    MenuBar.Command cmdVisualizeCubeviz = getCustomComponentCommand(CompType.VisualizeCubeviz);

    MenuBar.Command cmdDemoConfig = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            workspace.removeAllComponents();
            ConfigurationTab content = new ConfigurationTab(state);
            workspace.addComponent(content);
            // stretch the content to the full workspace area
            welcome.setHeight("110px");
            content.setHeight("500px");
        }
    };
    /*MenuBar.Command userinfoCommand = new MenuBar.Command() {
    public void menuSelected(MenuItem selectedItem) {
        showInWorkspace(new Authenticator(new UserInformation(state), new HashSet<String>(Arrays.asList(state.userRole)), state));
    }
    }; removed due to WebID issues */

    MenuBar.Command publishCommand = new Command() {
        public void menuSelected(MenuItem selectedItem) {
            showInWorkspace(new CKANPublisherPanel(state));
        }
    };

    MenuBar.Command publishDataHubCommand = new Command() {
        public void menuSelected(MenuItem selectedItem) {
            showInWorkspace(new DataHubPublisher(state));
        }
    };

    MenuBar.Command mDeleteGraphs = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            showInWorkspace(new DeleteGraphs(state));
        }
    };

    MenuBar.Command extractXML = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            showInWorkspace(new EXML(state));
        }
    };
    MenuBar.Command extractXMLExtended = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            showInWorkspace(new EXMLExtended(state));
        }
    };
    MenuBar.Command extractSDMX = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            showInWorkspace(new LinkedSDMX(state));
        }
    };

    MenuBar.Command importDirectly = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            showInWorkspace(new OntoWikiPathExtended(state, "/model/add", true));
        }
    };

    MenuBar.Command exportRDFXML = getOWExportCommand("rdfxml");
    MenuBar.Command exportTurtle = getOWExportCommand("turtle");
    MenuBar.Command exportRDFJson = getOWExportCommand("rdfjson");
    MenuBar.Command exportRDFN3 = getOWExportCommand("rdfn3");

    MenuBar.Command cmdExamples = getFramedUrlCommand(
            "http://wiki.lod2.eu/display/LOD2DOC/LOD2+Statistical+Workbench");

    /*
     legend for menu item names:
     - *: stub
     - !: incomplete functionality
     */

    // root menus
    MenuBar.MenuItem menuGraph = menubar.addItem("Manage Graph", null, null);
    MenuBar.MenuItem menuExtraction = menubar.addItem("Find more Data Online", null, null);
    MenuBar.MenuItem menuEdit = menubar.addItem("Edit & Transform", null, null);
    //MenuBar.MenuItem menuQuery      = menubar.addItem("Querying & Exploration", null, null);
    MenuBar.MenuItem menuEnrich = menubar.addItem("Enrich Datacube", null, null);
    //MenuBar.MenuItem menuOnline      = menubar.addItem("Online Tools & Services", null, null);
    MenuBar.MenuItem menuPresent = menubar.addItem("Present & Publish", null, null);
    MenuBar.MenuItem menuHelp = menubar.addItem("Help", null, null);

    //graph menu
    menuGraph.addItem("Select Default Graph", null, cmdDemoConfig);
    menuGraph.addItem("Create Graph", null, cmdOntoWikiCreateKB);
    menuGraph.addItem("Search Cubes", cmdSearchCubes);
    //        menuGraph.addItem("Configure URIs", cmdConfigGUI);
    MenuBar.MenuItem menuImport = menuGraph.addItem("Import", null, null);
    menuImport.addItem("Import from CSV", null, cmdOntoWikiImport);
    MenuBar.MenuItem excelImport = menuImport.addItem("Import from XML", null, null);
    MenuBar.MenuItem directImport = menuImport.addItem("Import triples from file", null, importDirectly);
    excelImport.addItem("From Text", null, extractXML);
    excelImport.addItem("From File", null, extractXMLExtended);
    excelImport.addItem("From SDMX", null, extractSDMX);
    MenuBar.MenuItem menuExport = menuGraph.addItem("Export", null, null);
    menuExport.addItem("Export as RDF/XML", null, exportRDFXML);
    menuExport.addItem("Export as Turtle", null, exportTurtle);
    menuExport.addItem("Export as RDF/JSON", null, exportRDFJson);
    menuExport.addItem("Export as Notation 3", null, exportRDFN3);
    menuGraph.addItem("DSD Management", cmdManageDSD);
    menuGraph.addItem("Validate", null, cmdValidation);
    menuGraph.addItem("Remove Graphs", null, mDeleteGraphs);

    // edit menu
    MenuItem editmenu = menuEdit.addItem("Edit Graph (OntoWiki)", null, cmdOntoWikiEdit);
    editmenu.addItem("Edit qb:Dataset", null, cmdEditDataset);
    editmenu.addItem("Edit qb:StructureDefinition", null, cmdEditStructureDef);
    editmenu.addItem("Edit qb:ComponentProperty", null, cmdEditComponentProp);
    menuEdit.addItem("Edit Code Lists (PoolParty)", null, cmdPoolPartyEdit);
    menuEdit.addItem("Reconcile dimensions", null, cmdMergeDimensions);
    menuEdit.addItem("Merge datasets", null, cmdMergeDatasets);
    menuEdit.addItem("Slice datasets", null, cmdSliceDatasets);
    menuEdit.addItem("Transform and Update Graph (SPARQL Update Endpoint)", null, cmdSparqlUpdateVirtuoso);
    menuEdit.addItem("Transform and Update Graph (R2R rules)", null, getCustomComponentCommand(CompType.R2R));

    // extraction menus
    //menuExtraction.addItem("Upload RDF File or RDF from URL", null, cmdUploadRDF);
    //MenuBar.MenuItem itemExtractFromXML = menuExtraction.addItem("Extract RDF from XML", null, null);
    //itemExtractFromXML.addItem("Basic extraction", null, cmdExtractXML);
    //itemExtractFromXML.addItem("Extended extraction", null, cmdExtractXMLE);
    menuExtraction.addItem("Load RDF data from publicdata.eu", null, cmdLoadFromPublicData);
    menuExtraction.addItem("Load RDF data from Data Hub", null, cmdLoadFromDataHub);
    //menuExtraction.addItem("Extract RDF from SQL", null, cmdD2R);

    // querying menu
    // many sparql query frontends are attached to the same endpoint (virtuoso) Removing duplicates
    //MenuBar.MenuItem itemSparqlQuerying = menuEdit.addItem("SPARQL querying", null, null);
    //Deprecated temporarily
    //MenuBar.MenuItem itemSparqled = menuEdit.addItem("SparQLed - Assisted Querying", null, cmdSparqled);
    //itemSparqled.addItem("Use currently selected graph", null, cmdSparqled);
    //itemSparqled.addItem("Use manager to calculate summary graph", null, cmdSparqledManager);
    //itemSparqlQuerying.addItem("OntoWiki SPARQL endpoint", null, cmdSparqlOntowiki);
    //itemSparqlQuerying.addItem("Virtuoso SPARQL endpoint", null, cmdSparqlVirtuoso);
    //itemSparqlQuerying.addItem("Virtuoso interactive SPARQL endpoint", null, cmdSparqlVirtuosoI);
    //        menuQuery.addItem("Find RDF Data Cubes", null, null);
    //        menuQuery.addItem("RDF Data Cube Matching Analysis", null, null);
    menuPresent.addItem("Visualization with CubeViz", null, cmdVisualizeCubeviz);
    // seems like duplicate of publicdata.eu
    //menuQuery.addItem("CKAN", null, cmdCkan);
    //menuPresent.addItem("Geo-Spatial exploration", null, cmdGeoSpatial);
    menuPresent.addItem("Publish to CKAN", null, publishCommand);
    menuPresent.addItem("Publish to datahub.io", null, publishDataHubCommand);

    // enrichment menu
    menuEnrich.addItem("Interlinking dimensions (Silk)", null, cmdSilk);
    menuEnrich.addItem("Data enrichment and reconciliation (LODRefine)", null, cmdLodRefine);
    menuEnrich.addItem("Interlinking with Limes", null, cmdLimes);
    menuEnrich.addItem("Interlinking with SameAs", null, cmdSameAs);

    // online menu
    //moved to present and publish
    menuPresent.addItem("Publish to Sindice", null, cmdSindice);
    //menuOnline.addItem("Sig.ma", null, cmdSigMa); // not a fitting case for stat wb?
    // duplicate?
    //menuOnline.addItem("Europe's Public Data", null, cmdPublicData);
    //MenuBar.MenuItem itemOnlineSparql = menuOnline.addItem("Online SPARQL Endpoints", null, null);
    // no longer working
    //itemOnlineSparql.addItem("LOD cloud", null, cmdLODCloud);
    // moved to find more data
    menuExtraction.addItem("DBPedia", null, cmdDBPedia);
    // moved to sparql querying
    menuEdit.addItem("PoolParty Code Lists SPARQL endpoint", null, cmdSPARQLPoolParty);
    // moved to extract
    menuExtraction.addItem("Mondeca SPARQL endpoint Collection", null, cmdMondecaSPARQLList);

    // help menu
    /* menuHelp.addItem("User Configuration", null, userinfoCommand); removed due to WebID issues */
    //menuHelp.addItem("*Documentation", null, null);
    menuHelp.addItem("Examples", null, cmdExamples);
    //menuHelp.addItem("*About", null, null);

    HorizontalLayout menubarContainer = new HorizontalLayout();
    menubarContainer.addComponent(menubar);
    menubarContainer.addStyleName("menubarContainer");
    menubarContainer.setWidth("100%");
    welcome.addComponent(menubarContainer);
    welcome.setHeight("110px");

    //************************************************************************
    // add workspace
    workspace = new VerticalLayout();

    mainContainer.addComponent(workspace);

    //create login/logout component that shows currently logged in user
    LoginStatus login = new LoginStatus(state, workspace);
    toolsContainer.addComponent(login);
    //welcome.setComponentAlignment(login, Alignment.TOP_RIGHT);

    /*
        workspace.setHeight("80%");
            
        HorizontalLayout introH = new HorizontalLayout();
        Embedded lod2cycle = new Embedded("", new ThemeResource("app_images/lod-lifecycle-small.png"));
        lod2cycle.setMimeType("image/png");
        introH.addComponent(lod2cycle);
        introH.setComponentAlignment(lod2cycle, Alignment.MIDDLE_LEFT);
            
        VerticalLayout introV =  new VerticalLayout();
        introH.addComponent(introV);
            
        Label introtextl =  new Label(introtext, Label.CONTENT_XHTML);
        introV.addComponent(introtextl);
        introtextl.setWidth("400px");
            
        HorizontalLayout introVH =  new HorizontalLayout();
        introV.addComponent(introVH);
            
        Embedded euflag = new Embedded("", new ThemeResource("app_images/eu-flag.gif"));
        euflag.setMimeType("image/gif");
        introVH.addComponent(euflag);
        euflag.addStyleName("eugif");
        euflag.setHeight("50px");
        Embedded fp7 = new Embedded("", new ThemeResource("app_images/fp7-gen-rgb_small.gif"));
        fp7.setMimeType("image/gif");
        fp7.addStyleName("eugif");
        fp7.setHeight("50px");
        introVH.addComponent(fp7);
            
        workspace.addComponent(introH);
        */
    home();

    // Create a tracker for the demo.lod2.eu domain.
    if (!state.googleAnalyticsID.equals("")) {
        //            GoogleAnalyticsTracker tracker = new GoogleAnalyticsTracker("UA-26375798-1", "demo.lod2.eu");
        GoogleAnalyticsTracker tracker = new GoogleAnalyticsTracker(state.googleAnalyticsID,
                state.googleAnalyticsDomain);
        mainWindow.addComponent(tracker);
        tracker.trackPageview("/lod2statworkbench");
    }
    ;

    setMainWindow(mainWindow);

    //       mainWindow.setExpandRatio(workspace, 1.0f);

    if (!state.InitStatus) {
        mainWindow.showNotification("Initialization Demonstration Failed", state.ErrorMessage,
                Notification.TYPE_ERROR_MESSAGE);
    }
    ;

}

From source file:fi.semantum.strategia.widget.NumberTrafficValuation.java

License:Open Source License

@Override
public Runnable getEditor(VerticalLayout layout, final Main main, final Meter meter) {

    Indicator indicator = meter.getPossibleIndicator(main.getDatabase());
    String unit = indicator.getUnit();

    final ComboBox combo = new ComboBox("Valitse mittarin mritystapa");
    combo.addItem(State.INCREASE3);
    combo.addItem(State.DECREASE3);
    combo.addItem(State.INCREASE2);
    combo.addItem(State.DECREASE2);
    combo.setInvalidAllowed(false);//from  w ww .  j a  v a 2  s . co m
    combo.setNullSelectionAllowed(false);
    combo.setWidth("100%");
    combo.addStyleName(ValoTheme.COMBOBOX_TINY);
    layout.addComponent(combo);
    layout.setComponentAlignment(combo, Alignment.TOP_CENTER);
    layout.setExpandRatio(combo, 0.0f);

    final VerticalLayout vl1 = new VerticalLayout();
    vl1.setHeight("50px");
    vl1.setWidth("100%");
    vl1.setStyleName("redBlock");
    layout.addComponent(vl1);
    layout.setComponentAlignment(vl1, Alignment.TOP_CENTER);
    layout.setExpandRatio(vl1, 0.0f);
    final Label l1 = new Label(" > " + df.format(greenLimit.doubleValue()) + " " + unit);
    l1.setSizeUndefined();
    l1.addStyleName(ValoTheme.LABEL_LARGE);
    vl1.addComponent(l1);
    vl1.setComponentAlignment(l1, Alignment.MIDDLE_CENTER);

    HorizontalLayout hl1 = new HorizontalLayout();
    hl1.setSpacing(true);
    layout.addComponent(hl1);
    layout.setComponentAlignment(hl1, Alignment.TOP_LEFT);

    final TextField tf1 = new TextField();
    tf1.setValue(df.format(greenLimit.doubleValue()));
    tf1.setWidth("150px");
    tf1.setCaption("Suurempi raja-arvo");
    tf1.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tf1.setValidationVisible(true);
    hl1.addComponent(tf1);

    Label unit1 = new Label();
    unit1.setSizeUndefined();
    unit1.setCaption("");
    unit1.setValue(unit);
    hl1.addComponent(unit1);
    hl1.setComponentAlignment(unit1, Alignment.MIDDLE_LEFT);

    final VerticalLayout vl2 = new VerticalLayout();
    vl2.setHeight("50px");
    vl2.setWidth("100%");
    vl2.addStyleName("yellowBlock");
    layout.addComponent(vl2);
    layout.setComponentAlignment(vl2, Alignment.TOP_CENTER);
    layout.setExpandRatio(vl2, 0.0f);
    final Label l2 = new Label();
    l2.setSizeUndefined();
    l2.addStyleName(ValoTheme.LABEL_LARGE);
    vl2.addComponent(l2);
    vl2.setComponentAlignment(l2, Alignment.MIDDLE_CENTER);

    HorizontalLayout hl2 = new HorizontalLayout();
    hl2.setSpacing(true);
    layout.addComponent(hl2);
    layout.setComponentAlignment(hl2, Alignment.TOP_LEFT);

    final TextField tf2 = new TextField();
    tf2.setWidth("150px");
    tf2.setCaption("Pienempi raja-arvo");
    tf2.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tf2.setValidationVisible(true);
    hl2.addComponent(tf2);
    hl2.setComponentAlignment(tf2, Alignment.TOP_CENTER);

    Label unit2 = new Label();
    unit2.setSizeUndefined();
    unit2.setCaption("");
    unit2.setValue("" + unit);
    hl2.addComponent(unit2);
    hl2.setComponentAlignment(unit2, Alignment.MIDDLE_LEFT);

    final VerticalLayout vl3 = new VerticalLayout();
    vl3.setHeight("50px");
    vl3.setWidth("100%");
    vl3.addStyleName("greenBlock");
    layout.addComponent(vl3);
    layout.setComponentAlignment(vl3, Alignment.TOP_CENTER);
    layout.setExpandRatio(vl3, 0.0f);
    final Label l3 = new Label();
    l3.setSizeUndefined();
    l3.addStyleName(ValoTheme.LABEL_LARGE);
    vl3.addComponent(l3);
    vl3.setComponentAlignment(l3, Alignment.MIDDLE_CENTER);

    applyValues(main, meter, combo, vl1, l1, vl2, l2, vl3, l3, tf1, tf2);

    combo.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = 8396168732300003038L;

        @Override
        public void valueChange(ValueChangeEvent event) {

            if (inApply)
                return;

            State currentState = getState();

            if (currentState.equals(combo.getValue()))
                return;

            if (State.DECREASE3.equals(combo.getValue())) {
                makeThree = true;
                if (State.INCREASE3.equals(currentState)) {
                    swap();
                } else if (State.INCREASE2.equals(currentState)) {
                    redLimit = greenLimit;
                    greenLimit = null;
                }
            } else if (State.INCREASE3.equals(combo.getValue())) {
                makeThree = true;
                if (State.DECREASE3.equals(currentState)) {
                    swap();
                } else if (State.DECREASE2.equals(currentState)) {
                    greenLimit = redLimit;
                    redLimit = null;
                }
            } else if (State.INCREASE2.equals(combo.getValue())) {
                if (State.DECREASE3.equals(currentState)) {
                    greenLimit = redLimit;
                } else if (State.DECREASE2.equals(currentState)) {
                    greenLimit = redLimit;
                }
                redLimit = null;
                makeThree = false;
            } else if (State.DECREASE2.equals(combo.getValue())) {
                if (State.INCREASE3.equals(currentState)) {
                    redLimit = greenLimit;
                } else if (State.INCREASE2.equals(currentState)) {
                    redLimit = greenLimit;
                }
                greenLimit = null;
                makeThree = false;
            }

            updateMakeThree();

            applyValues(main, meter, combo, vl1, l1, vl2, l2, vl3, l3, tf1, tf2);

        }

    });

    tf1.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = -5484608577999300097L;

        @Override
        public void valueChange(ValueChangeEvent event) {

            if (inApply)
                return;

            if (State.DECREASE3.equals(combo.getValue())) {
                if (makeThree)
                    greenLimit = redLimit;
                redLimit = new BigDecimal(tf1.getValue());
            } else if (State.INCREASE3.equals(combo.getValue())) {
                if (makeThree)
                    redLimit = greenLimit;
                greenLimit = new BigDecimal(tf1.getValue());
            } else if (State.INCREASE2.equals(combo.getValue())) {
                greenLimit = new BigDecimal(tf1.getValue());
            } else if (State.DECREASE2.equals(combo.getValue())) {
                redLimit = new BigDecimal(tf1.getValue());
            }

            updateMakeThree();

            applyValues(main, meter, combo, vl1, l1, vl2, l2, vl3, l3, tf1, tf2);

        }

    });

    tf2.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = 5825320869230527588L;

        @Override
        public void valueChange(ValueChangeEvent event) {

            if (inApply)
                return;

            // This should not happen!
            if (State.INCREASE2.equals(combo.getValue()) || State.DECREASE2.equals(combo.getValue()))
                return;

            if (State.DECREASE3.equals(combo.getValue())) {
                greenLimit = new BigDecimal(tf2.getValue());
            } else if (State.INCREASE3.equals(combo.getValue())) {
                redLimit = new BigDecimal(tf2.getValue());
            }

            updateMakeThree();

            applyValues(main, meter, combo, vl1, l1, vl2, l2, vl3, l3, tf1, tf2);

        }

    });

    return null;

}

From source file:fr.amapj.view.views.permanence.grille.BlocGrilleDrawer.java

License:Open Source License

protected void createContent(VerticalLayout contentLayout, int nbCol,
        AbstractPeriodePermanenceGrillePart grillePart) {
    List<List<BlocGrille>> lines = CollectionUtils.cutInSubList(blocGrilles, nbCol);

    for (List<BlocGrille> line : lines) {
        drawLine(contentLayout, line, grillePart);

        VerticalLayout spacer = new VerticalLayout();
        spacer.setHeight("10px");
        contentLayout.addComponent(spacer);
    }/*from ww w. jav  a  2s  .  c o m*/
}