List of usage examples for com.google.gwt.user.client.ui Label setText
public void setText(String text)
From source file:org.sigmah.client.ui.view.project.logframe.ProjectLogFrameGrid.java
License:Open Source License
/** * Adds a specific objective row.// w w w . java 2s . co m * * @param specificObjective * The specific objective. Must not be <code>null</code>. */ private void addSpecificObjective(final SpecificObjectiveDTO specificObjective) { // Checks if the objective is correct. if (specificObjective == null) { throw new NullPointerException("specific objective must not be null"); } // Retrieves the group. final LogFrameGroupDTO logFrameGroup = specificObjective.getGroup(); // Retrieves the equivalent rows group. @SuppressWarnings("unchecked") RowsGroup<LogFrameGroupDTO> g = (RowsGroup<LogFrameGroupDTO>) specificObjectivesView .getGroup(logFrameGroup.getClientSideId()); // If the rows hasn't been created already, adds it. if (g == null) { g = addSpecificObjectivesGroup(logFrameGroup); } // Sets the display label. final StringBuilder sb = new StringBuilder(); sb.append(I18N.CONSTANTS.logFrameSpecificObjectivesCode()); sb.append(" "); sb.append(specificObjective.getFormattedCode()); specificObjective.setLabel(sb.toString()); // Sets the position the last if it doesn't exist. if (specificObjective.getPosition() == null) { specificObjective.setPosition(g.getRowsCount() + 1); } // Adds the row. specificObjectivesView.insertRow(specificObjective.getPosition(), logFrameGroup.getClientSideId(), new Row<SpecificObjectiveDTO>(specificObjective) { @Override public boolean isSimilar(int column, SpecificObjectiveDTO userObject, SpecificObjectiveDTO other) { switch (column) { case 1: // Code. return userObject.getCode().equals(other.getCode()); } return false; } @Override public Widget getWidgetAt(int column, final SpecificObjectiveDTO userObject) { switch (column) { case 0: // Parent code. return null; case 1: // Code. final Label codeLabel = new Label(); codeLabel.addStyleName(CSS_CODE_LABEL_STYLE_NAME); if (userObject != null) { codeLabel.setText(userObject.getLabel()); } // Grid. final Grid grid = new Grid(1, 2); grid.setCellPadding(0); grid.setCellSpacing(0); grid.setWidget(0, 0, codeLabel); if (!readOnly) { grid.setWidget(0, 1, buildSpecificObjectiveMenu(this, codeLabel)); } return grid; case 2: // Intervention logic. final TextArea interventionLogicTextBox = new TextArea(); interventionLogicTextBox.setWidth("100%"); interventionLogicTextBox.setHeight("100%"); interventionLogicTextBox.setVisibleLines(3); interventionLogicTextBox.addStyleName(CSS_HTML_TEXTBOX); interventionLogicTextBox.setEnabled(!readOnly); if (userObject != null) { interventionLogicTextBox.setText(userObject.getInterventionLogic()); } interventionLogicTextBox.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent e) { userObject.setInterventionLogic(interventionLogicTextBox.getText()); fireLogFrameEdited(); } }); return interventionLogicTextBox; case 4: // Indicators. final IndicatorListWidget indicatorListWidget = new IndicatorListWidget(eventBus, databaseId, specificObjective); indicatorListWidget.addValueChangeHandler(new ValueChangeHandler<Void>() { @Override public void onValueChange(ValueChangeEvent<Void> event) { fireLogFrameEdited(); } }); return indicatorListWidget; case 5: // Risks and Assumptions. final TextArea risksAssumptionsTextBox = new TextArea(); risksAssumptionsTextBox.setWidth("100%"); risksAssumptionsTextBox.setHeight("100%"); risksAssumptionsTextBox.setVisibleLines(3); risksAssumptionsTextBox.addStyleName(CSS_HTML_TEXTBOX); risksAssumptionsTextBox.setEnabled(!readOnly); if (userObject != null) { risksAssumptionsTextBox.setText(userObject.getRisksAndAssumptions()); } risksAssumptionsTextBox.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent e) { userObject.setRisksAndAssumptions(risksAssumptionsTextBox.getText()); fireLogFrameEdited(); } }); return risksAssumptionsTextBox; default: return null; } } @Override public int getId(SpecificObjectiveDTO userObject) { return userObject.getClientSideId(); } }); fireLogFrameEdited(); // Adds sub expected results. for (final ExpectedResultDTO result : specificObjective.getExpectedResults()) { addExpectedResult(result); } }
From source file:org.sigmah.client.ui.view.project.logframe.ProjectLogFrameGrid.java
License:Open Source License
/** * Adds an activity row./*from w w w. java2s.c o m*/ * * @param result * The expected result. Must not be <code>null</code>. */ private void addExpectedResult(final ExpectedResultDTO result) { // Checks if the result is correct. if (result == null) { throw new NullPointerException("result must not be null"); } // Retrieves the group. final LogFrameGroupDTO group = result.getGroup(); // Retrieves the equivalent rows group. @SuppressWarnings("unchecked") RowsGroup<LogFrameGroupDTO> g = (RowsGroup<LogFrameGroupDTO>) expectedResultsView .getGroup(group.getClientSideId()); // If the rows hasn't been created already, adds it. if (g == null) { g = addExpectedResultsGroup(group); } // Sets the display label. final StringBuilder sb = new StringBuilder(); sb.append(I18N.CONSTANTS.logFrameExceptedResultsCode()); sb.append(" "); sb.append(result.getFormattedCode()); result.setLabel(sb.toString()); // Sets the position the last if it doesn't exist. if (result.getPosition() == null) { result.setPosition(g.getRowsCount() + 1); } // Adds the row. expectedResultsView.insertRow(result.getPosition(), group.getClientSideId(), new Row<ExpectedResultDTO>(result) { @Override public boolean isSimilar(int column, ExpectedResultDTO userObject, ExpectedResultDTO other) { switch (column) { case 0: // Parent code. return userObject.getParentSpecificObjective() != null && other.getParentSpecificObjective() != null && userObject.getParentSpecificObjective().getCode() .equals(other.getParentSpecificObjective().getCode()); } return false; } @Override public Widget getWidgetAt(int column, final ExpectedResultDTO userObject) { switch (column) { case 0: // Parent code. final Label parentCodeLabel = new Label(); parentCodeLabel.addStyleName(CSS_CODE_LABEL_STYLE_NAME); final SpecificObjectiveDTO parent; if (userObject != null && (parent = userObject.getParentSpecificObjective()) != null) { final StringBuilder sb = new StringBuilder(); sb.append(I18N.CONSTANTS.logFrameExceptedResultsCode()); sb.append(" ("); sb.append(I18N.CONSTANTS.logFrameSpecificObjectivesCode()); sb.append(" "); sb.append(parent.getFormattedCode()); sb.append(")"); parentCodeLabel.setText(sb.toString()); } return parentCodeLabel; case 1: // Code. final Label codeLabel = new Label(); codeLabel.addStyleName(CSS_CODE_LABEL_STYLE_NAME); if (userObject != null) { codeLabel.setText(userObject.getLabel()); } // Grid. final Grid grid = new Grid(1, 2); grid.setCellPadding(0); grid.setCellSpacing(0); grid.setWidget(0, 0, codeLabel); if (!readOnly) { grid.setWidget(0, 1, buildExpectedResultMenu(this, codeLabel)); } return grid; case 2: // Intervention logic. final TextArea interventionLogicTextBox = new TextArea(); interventionLogicTextBox.setWidth("100%"); interventionLogicTextBox.setHeight("100%"); interventionLogicTextBox.setVisibleLines(3); interventionLogicTextBox.addStyleName(CSS_HTML_TEXTBOX); interventionLogicTextBox.setEnabled(!readOnly); if (userObject != null) { interventionLogicTextBox.setText(userObject.getInterventionLogic()); } interventionLogicTextBox.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent e) { userObject.setInterventionLogic(interventionLogicTextBox.getText()); fireLogFrameEdited(); } }); return interventionLogicTextBox; case 4: // Indicators. final IndicatorListWidget indicatorListWidget = new IndicatorListWidget(eventBus, databaseId, result); indicatorListWidget.addValueChangeHandler(new ValueChangeHandler<Void>() { @Override public void onValueChange(ValueChangeEvent<Void> event) { fireLogFrameEdited(); } }); return indicatorListWidget; case 5: // Risks and Assumptions. final TextArea risksAssumptionsTextBox = new TextArea(); risksAssumptionsTextBox.setWidth("100%"); risksAssumptionsTextBox.setHeight("100%"); risksAssumptionsTextBox.setVisibleLines(3); risksAssumptionsTextBox.addStyleName(CSS_HTML_TEXTBOX); risksAssumptionsTextBox.setEnabled(!readOnly); if (userObject != null) { risksAssumptionsTextBox.setText(userObject.getRisksAndAssumptions()); } risksAssumptionsTextBox.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent e) { userObject.setRisksAndAssumptions(risksAssumptionsTextBox.getText()); fireLogFrameEdited(); } }); return risksAssumptionsTextBox; default: return null; } } @Override public int getId(ExpectedResultDTO userObject) { return userObject.getClientSideId(); } }); fireLogFrameEdited(); // Adds sub activities. for (final LogFrameActivityDTO activity : result.getActivities()) { addActivity(activity); } }
From source file:org.sigmah.client.ui.view.project.logframe.ProjectLogFrameGrid.java
License:Open Source License
/** * Adds an activity row./*w w w. ja v a 2 s . c o m*/ * * @param activity * The activity. Must not be <code>null</code>. */ private void addActivity(final LogFrameActivityDTO activity) { // Checks if the activity is correct. if (activity == null) { throw new NullPointerException("activity must not be null"); } // Retrieves the group. final LogFrameGroupDTO group = activity.getGroup(); // Retrieves the equivalent rows group. @SuppressWarnings("unchecked") RowsGroup<LogFrameGroupDTO> g = (RowsGroup<LogFrameGroupDTO>) activitiesView .getGroup(group.getClientSideId()); // If the rows hasn't been created already, adds it. if (g == null) { g = addActivitiesGroup(group); } // Sets the display label. final StringBuilder sb = new StringBuilder(); sb.append(I18N.CONSTANTS.logFrameActivitiesCode()); sb.append(" "); sb.append(activity.getFormattedCode()); activity.setLabel(sb.toString()); // Sets the position the last if it doesn't exist. if (activity.getPosition() == null) { activity.setPosition(g.getRowsCount() + 1); } // Adds the row. activitiesView.insertRow(activity.getPosition(), group.getClientSideId(), new Row<LogFrameActivityDTO>(activity) { @Override public boolean isSimilar(int column, LogFrameActivityDTO userObject, LogFrameActivityDTO other) { switch (column) { case 0: // Parent code. return userObject.getParentExpectedResult() != null && other.getParentExpectedResult() != null && userObject.getParentExpectedResult().getCode() .equals(other.getParentExpectedResult().getCode()); } return false; } @Override public Widget getWidgetAt(int column, final LogFrameActivityDTO userObject) { switch (column) { case 0: // Parent code. final Label parentCodeLabel = new Label(); parentCodeLabel.addStyleName(CSS_CODE_LABEL_STYLE_NAME); final ExpectedResultDTO parent; if (userObject != null && (parent = userObject.getParentExpectedResult()) != null) { final StringBuilder sb = new StringBuilder(); sb.append(I18N.CONSTANTS.logFrameActivitiesCode()); sb.append(" ("); sb.append(I18N.CONSTANTS.logFrameExceptedResultsCode()); sb.append(" "); sb.append(parent.getFormattedCode()); sb.append(")"); parentCodeLabel.setText(sb.toString()); } return parentCodeLabel; case 1: // Code. final Label codeLabel = new Label(); codeLabel.addStyleName(CSS_CODE_LABEL_STYLE_NAME); if (userObject != null) { codeLabel.setText(userObject.getLabel()); } // Grid. final Grid grid = new Grid(1, 2); grid.setCellPadding(0); grid.setCellSpacing(0); grid.setWidget(0, 0, codeLabel); if (!readOnly) { grid.setWidget(0, 1, buildActivityMenu(this, codeLabel)); } return grid; case 2: // Activity content. final TextArea contentTextBox = new TextArea(); contentTextBox.setWidth("100%"); contentTextBox.setHeight("100%"); contentTextBox.setVisibleLines(2); contentTextBox.addStyleName(CSS_HTML_TEXTBOX); contentTextBox.setEnabled(!readOnly); if (userObject != null) { contentTextBox.setText(userObject.getTitle()); } contentTextBox.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent e) { userObject.setTitle(contentTextBox.getText()); fireLogFrameEdited(); } }); return contentTextBox; case 4: // Indicators. final IndicatorListWidget indicatorListWidget = new IndicatorListWidget(eventBus, databaseId, userObject); indicatorListWidget.addValueChangeHandler(new ValueChangeHandler<Void>() { @Override public void onValueChange(ValueChangeEvent<Void> event) { fireLogFrameEdited(); } }); return indicatorListWidget; case 5: return new Label(); default: return null; } } @Override public int getId(LogFrameActivityDTO userObject) { return userObject.getClientSideId(); } }); fireLogFrameEdited(); }
From source file:org.sigmah.client.ui.view.project.logframe.ProjectLogFrameGrid.java
License:Open Source License
/** * Adds an prerequisite row.// w w w.j a v a 2 s . co m * * @param prerequisite * The prerequisite. Must not be <code>null</code>. */ private void addPrerequisite(final PrerequisiteDTO prerequisite) { // Checks if the prerequisite is correct. if (prerequisite == null) { throw new NullPointerException("prerequisite must not be null"); } // Retrieves the group. final LogFrameGroupDTO group = prerequisite.getGroup(); // Retrieves the equivalent rows group. @SuppressWarnings("unchecked") RowsGroup<LogFrameGroupDTO> g = (RowsGroup<LogFrameGroupDTO>) prerequisitesView .getGroup(group.getClientSideId()); // If the rows hasn't been created already, adds it. if (g == null) { g = addPrerequisitesGroup(group); } // Sets the display label. final StringBuilder sb = new StringBuilder(); sb.append(I18N.CONSTANTS.logFramePrerequisitesCode()); sb.append(" "); sb.append(prerequisite.getFormattedCode()); prerequisite.setLabel(sb.toString()); // Sets the position the last if it doesn't exist. if (prerequisite.getPosition() == null) { prerequisite.setPosition(g.getRowsCount() + 1); } // Adds the row. prerequisitesView.insertRow(prerequisite.getPosition(), group.getClientSideId(), new Row<PrerequisiteDTO>(prerequisite) { @Override public boolean isSimilar(int column, PrerequisiteDTO userObject, PrerequisiteDTO other) { return false; } @Override public Widget getWidgetAt(int column, final PrerequisiteDTO userObject) { switch (column) { case 0: // Code. final Label codeLabel = new Label(); codeLabel.addStyleName(CSS_CODE_LABEL_STYLE_NAME); if (userObject != null) { codeLabel.setText(userObject.getLabel()); } // Grid. final Grid grid = new Grid(1, 2); grid.setCellPadding(0); grid.setCellSpacing(0); grid.setWidget(0, 0, codeLabel); if (!readOnly) { grid.setWidget(0, 1, buildPrerequisiteMenu(this, codeLabel)); } return grid; case 5: // Activity content. final TextArea contentTextBox = new TextArea(); contentTextBox.setWidth("100%"); contentTextBox.setHeight("100%"); contentTextBox.setVisibleLines(2); contentTextBox.addStyleName(CSS_HTML_TEXTBOX); contentTextBox.setEnabled(!readOnly); if (userObject != null) { contentTextBox.setText(userObject.getContent()); } contentTextBox.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent e) { userObject.setContent(contentTextBox.getText()); fireLogFrameEdited(); } }); return contentTextBox; default: return null; } } @Override public int getId(PrerequisiteDTO userObject) { return userObject.getClientSideId(); } }); fireLogFrameEdited(); }
From source file:org.sigmah.client.ui.widget.panel.FoldPanel.java
License:Open Source License
/** * Defines the header of this fold panel. * /*from ww w . j a va2s . c o m*/ * @param text * Text to display in the header of this fold panel. */ public void setHeading(String text) { final HorizontalPanel titleBar = (HorizontalPanel) super.getWidget(HEADER_INDEX); final Label heading = (Label) titleBar.getWidget(0); heading.setText(text); if (text != null && !"".equals(text)) { super.getWidget(BODY_INDEX).addStyleName("fold-content"); titleBar.getElement().getStyle().setProperty("display", ""); } else { super.getWidget(BODY_INDEX).removeStyleName("fold-content"); titleBar.getElement().getStyle().setDisplay(Style.Display.NONE); } }
From source file:org.sigmah.shared.dto.element.TripletsListElementDTO.java
License:Open Source License
@Override public Object renderHistoryToken(final HistoryTokenListDTO token) { final Label details = new Label(); details.addStyleName("history-details"); if (token.getTokens().size() == 1) { details.setText("1 " + I18N.CONSTANTS.historyModification()); } else {/*from ww w . j av a2s.co m*/ details.setText(token.getTokens().size() + " " + I18N.CONSTANTS.historyModifications()); } details.addClickHandler(new ClickHandler() { private Window window; @Override public void onClick(ClickEvent e) { if (window == null) { // Builds window. window = new Window(); window.setAutoHide(true); window.setModal(false); window.setPlain(true); window.setHeaderVisible(true); window.setClosable(true); window.setLayout(new FitLayout()); window.setWidth(750); window.setHeight(400); window.setBorders(false); window.setResizable(true); // Builds grid. final ListStore<TripletValueDTO> store = new ListStore<TripletValueDTO>(); final com.extjs.gxt.ui.client.widget.grid.Grid<TripletValueDTO> grid = new com.extjs.gxt.ui.client.widget.grid.Grid<TripletValueDTO>( store, new ColumnModel(Arrays.asList(getColumnModel()))); grid.getView().setForceFit(true); grid.setBorders(false); grid.setAutoExpandColumn("name"); window.add(grid); // Fills store. for (final HistoryTokenDTO t : token.getTokens()) { final List<String> l = ValueResultUtils.splitElements(t.getValue()); final TripletValueDTO triplet = new TripletValueDTO(); triplet.setCode(l.get(0)); triplet.setName(l.get(1)); triplet.setPeriod(l.get(2)); triplet.setType(t.getType()); store.add(triplet); } } window.setPagePosition(e.getNativeEvent().getClientX(), e.getNativeEvent().getClientY()); window.show(); } private ColumnConfig[] getColumnModel() { // Change type. final ColumnConfig typeColumn = new ColumnConfig(); typeColumn.setId("type"); typeColumn.setHeaderText(I18N.CONSTANTS.historyModificationType()); typeColumn.setWidth(150); typeColumn.setSortable(false); typeColumn.setRenderer(new GridCellRenderer<TripletValueDTO>() { @Override public Object render(TripletValueDTO model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<TripletValueDTO> store, Grid<TripletValueDTO> grid) { if (model.getType() != null) { switch (model.getType()) { case ADD: return I18N.CONSTANTS.historyAdd(); case EDIT: return I18N.CONSTANTS.historyEdit(); case REMOVE: return I18N.CONSTANTS.historyRemove(); default: return "-"; } } else { return "-"; } } }); // Code. final ColumnConfig codeColumn = new ColumnConfig(); codeColumn.setId("code"); codeColumn.setHeaderText(I18N.CONSTANTS.flexibleElementTripletsListCode()); codeColumn.setWidth(200); // Name. final ColumnConfig nameColumn = new ColumnConfig(); nameColumn.setId("name"); nameColumn.setHeaderText(I18N.CONSTANTS.flexibleElementTripletsListName()); nameColumn.setWidth(200); // Period. final ColumnConfig periodColumn = new ColumnConfig(); periodColumn.setId("period"); periodColumn.setHeaderText(I18N.CONSTANTS.flexibleElementTripletsListPeriod()); periodColumn.setWidth(200); return new ColumnConfig[] { typeColumn, codeColumn, nameColumn, periodColumn }; } }); return details; }
From source file:org.ssgwt.client.ui.component.TipBar.java
License:Apache License
/** * This function will add a single tip item to the tip bar * // ww w . java2 s . co m * @author Dmitri De Klerk <dmitri.deklerk@a24group.com> * @since 9 June 2014 * * @param tipBarItem - The tip items that needs to be added to the tip bar */ public void addTipBarItem(TipItemInterface tipBarItem) { tipBarPanel.setVisible(true); Label dashLabel = new Label(); dashLabel.setText("- "); dashLabel.setStyleName(resources.tipBarStyle().dashStyle()); HorizontalPanel horPanel = new HorizontalPanel(); horPanel.add(dashLabel); FlowPanel flowPanel = new FlowPanel(); final TipItemInterface currentItem = tipBarItem; Label label = new Label(); label.setText(currentItem.getLabel()); label.setStyleName(resources.tipBarStyle().fontStyle()); Label actionLabel = new Label(); actionLabel.setText(currentItem.getActionLabel()); actionLabel.setStyleName(resources.tipBarStyle().linkStyle()); actionLabel.addClickHandler(new ClickHandler() { /** * Will add the callback function for the action label click * * @author Dmitri De Klerk <dmitri.deklerk@a24group.com> * @since 9 June 2014 * * @param event - The click event that fires the callback */ public void onClick(ClickEvent event) { currentItem.getCallBack().onClickAction(); } }); flowPanel.add(label); flowPanel.add(actionLabel); horPanel.add(flowPanel); tipBar.add(horPanel); }
From source file:org.tagaprice.client.desktopView.UIDesktop.java
License:Creative Commons License
private void init() { loginPres = new LoginPresenter(_clientFactory); vePa1.setWidth("100%"); vePa1.add(iVePa);//from ww w. j av a 2s.c o m iVePa.setStyleName("main"); vePa1.setCellHorizontalAlignment(iVePa, HorizontalPanel.ALIGN_CENTER); //infobox _infoBox.setWidth("100%"); _infoBox.getElement().getStyle().setZIndex(2000); //menu //menu.setSize("100%", "30px"); menu.setStyleName("header"); menu.setWidth("100%"); iVePa.add(menu); //vePa1.setCellHorizontalAlignment(menu, HorizontalPanel.ALIGN_CENTER); // Logo Image logo = new Image("logo.png"); logo.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { _clientFactory.getPlaceController().goTo(new StartPlace()); } }); logo.setStyleName("logo"); menu.add(logo); menu.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); menu.setCellWidth(logo, "1%"); //SearchText Label searchLink = new Label("Search"); searchLink.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { _clientFactory.getPlaceController().goTo(new SearchPlace()); } }); searchLink.setStyleName("login"); menu.add(searchLink); //empty SimplePanel empty = new SimplePanel(); empty.setWidth("100%"); menu.add(empty); menu.setCellWidth(empty, "100%"); //final Label add Receipt final Label addReceipt = new Label("add Receipt"); addReceipt.setStyleName("login"); menu.add(addReceipt); menu.setCellHorizontalAlignment(addReceipt, HorizontalPanel.ALIGN_RIGHT); menu.setCellWidth(addReceipt, "1%"); addReceipt.setVisible(false); addReceipt.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { _clientFactory.getPlaceController().goTo(new CreateReceiptPlace()); } }); //invite me final Label inviteMe = new Label("Request Invitation"); inviteMe.setStyleName("menuInviteButton"); menu.add(inviteMe); inviteMe.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { _clientFactory.getEventBus().fireEvent(new DisplayLoginEvent(LoginType.invite)); } }); //login final Label login = new Label("Sign in"); login.setStyleName("login"); //Button login = new Button("Sign in"); //$(login).as(gwtquery.plugins.ui.Ui.Ui).button(gwtquery.plugins.ui.widgets.Button.Options.create().icons(gwtquery.plugins.ui.widgets.Button.Icons.create().secondary("ui-icon-triangle-1-s"))); // menu.add(login); menu.setCellHorizontalAlignment(login, HorizontalPanel.ALIGN_RIGHT); menu.setCellWidth(login, "1%"); //create poptup Image close = new Image("desktopView/close_cross.png"); close.setStyleName("loginPop-close"); close.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { loginPop.hide(); } }); AbsolutePanel aPop = new AbsolutePanel(); loginPres.setLoginView(); aPop.add(loginPres.getView()); aPop.add(close); aPop.setWidgetPosition(close, 0, 0); loginPop.setWidget(aPop); loginPop.getElement().getStyle().setZIndex(2000); loginPop.setGlassEnabled(true); loginPop.setAnimationEnabled(true); loginPop.setGlassStyleName("loginPopGlass"); login.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { if (_clientFactory.getAccountPersistor().isLoggedIn()) { _clientFactory.getPlaceController().goTo(new ListReceiptsPlace()); } else { //loginPop.showRelativeTo(login); _clientFactory.getEventBus().fireEvent(new DisplayLoginEvent(LoginType.login)); } } }); _clientFactory.getEventBus().addHandler(LoginChangeEvent.TYPE, new LoginChangeEventHandler() { @Override public void onLoginChange(LoginChangeEvent event) { if (_clientFactory.getAccountPersistor().isLoggedIn()) { login.setText("Dashboard"); addReceipt.setVisible(true); inviteMe.setVisible(false); } else { login.setText("Sign in"); addReceipt.setVisible(false); inviteMe.setVisible(true); } } }); //center center.setStyleName("center"); center.setWidth("100%"); iVePa.add(center); //vePa1.setCellHorizontalAlignment(center, VerticalPanel.ALIGN_CENTER); //center.setHeight((Window.getClientHeight()-240-120)+"px"); //vePa1.setCellHeight(center, "100%"); //bottom bottom.setStyleName("bottom"); vePa1.add(bottom); //bottom Text HorizontalPanel bottomText = new HorizontalPanel(); bottomText.setStyleName("bottom-text"); HTML lefthtml = new HTML("" + "<h2>Licence</h2> " + "<a href=\"http://creativecommons.org/licenses/by-sa/3.0/\">Creative Commons Attribution-ShareAlike 3.0 Unported License</a> <br /> " + "<a href=\"http://www.gnu.org/licenses/agpl.html\">AGPLv3</a> " + "<h2>Blog</h2> " + "<a href=\"http://blog.tagaprice.org/\">blog.tagaprice.org</a> " + "<h2>Development</h2> " + "<a href=\"http://github.com/tagaprice\">api.tagaprice.org</a> <br /> " + "<a href=\"http://github.com/tagaprice\">http://github.com/tagaprice</a>"); HTML righthtml = new HTML("" + "<h2>Email</h2> " + "team[at]tagaprice[dot]org " + "<h2>Twitter</h2> " + "<a href=\"http://twitter.com/tagaprice\">@tagaprice</a>"); HTML labels = new HTML("" + "<h2>Labels</h2> " + "<a rel=\"license\" href=\"http://creativecommons.org/licenses/by-sa/3.0/\"><img alt=\"Creative Commons License\" style=\"border-width:0\" src=\"desktopView/cc.png\" /></a>" + "<br /><br /><a rel=\"license\" href=\"http://www.gnu.org/licenses/agpl.html\"><img alt=\"GNU Affero General Public License\" style=\"border-width:0\" src=\"desktopView/agplv3.png\" /></a>" + "<br /><br /><a href=\"http://www.w3.org/html/logo/\"><img src=\"desktopView/html5.png\" alt=\"HTML5 Powered with CSS3 / Styling, Device Access, and Semantics\" title=\"HTML5 Powered with CSS3 / Styling, Device Access, and Semantics\"></a>"); bottomText.add(lefthtml); bottomText.add(righthtml); bottomText.add(labels); bottom.add(bottomText); bottom.setCellHorizontalAlignment(bottomText, HorizontalPanel.ALIGN_CENTER); //Set Popvisilb _clientFactory.getEventBus().addHandler(LoginChangeEvent.TYPE, new LoginChangeEventHandler() { @Override public void onLoginChange(LoginChangeEvent event) { if (event.isLoggedIn()) loginPop.hide(); } }); //ShopLogin _clientFactory.getEventBus().addHandler(DisplayLoginEvent.TYPE, new DisplayLoginEventHandler() { @Override public void onDisplayLogin(DisplayLoginEvent event) { if (event.getLoginType().equals(LoginType.login)) { Log.debug("Pop Login"); loginPres.setLoginView(); loginPop.center(); loginPop.show(); } else if (event.getLoginType().equals(LoginType.invite)) { loginPres.setInviteMeView(); Log.debug("open invite"); loginPop.center(); loginPop.show(); } else if (event.getLoginType().equals(LoginType.register)) { loginPres.setRegisterView(event.getInviteKey()); Log.debug("open setRegisterView"); loginPop.center(); loginPop.show(); } } }); _activityManager.setDisplay(center); }
From source file:org.talend.mdm.webapp.welcomeportal.client.widget.ChartPortlet.java
License:Open Source License
protected void addPlotHovering() { final PopupPanel popup = new PopupPanel(); final Label hoverLabel = new Label(); popup.add(hoverLabel);//from w ww . j a v a2 s . com plot.addHoverListener(new PlotHoverListener() { @Override public void onPlotHover(Plot plotArg, PlotPosition position, PlotItem item) { if (item != null) { String text = getHoveringText(item); hoverLabel.setText(text); hoverLabel.setStyleName("welcomePieChartHover"); //$NON-NLS-1$ popup.setPopupPosition(item.getPageX() + 10, item.getPageY() - 25); popup.show(); } else { popup.hide(); } } }, false); }
From source file:org.talend.mdm.webapp.welcomeportal.client.widget.DataChart.java
License:Open Source License
@Override protected void addPlotHovering() { final PopupPanel popup = new PopupPanel(); final Label hoverLabel = new Label(); popup.add(hoverLabel);//from ww w .jav a2s . c o m plot.addHoverListener(new PlotHoverListener() { @Override public void onPlotHover(Plot plot, PlotPosition position, PlotItem item) { if (item != null) { hoveringTXT = (entityNamesSorted.get(item.getSeriesIndex()) + " : " //$NON-NLS-1$ + formatter.format(item.getSeries().getData().getY(0)) + " / " //$NON-NLS-1$ + formatter.format(percentageValueMap.get(item.getSeries().getLabel())) + "%"); //$NON-NLS-1$ hoverLabel.setText(hoveringTXT); hoverLabel.setStyleName("welcomePieChartHover"); //$NON-NLS-1$ popup.setPopupPosition(cursorX, cursorY); popup.show(); entityName = entityNamesSorted.get(item.getSeriesIndex()); portal.setStyleAttribute("cursor", "pointer"); //$NON-NLS-1$ //$NON-NLS-2$ } else { popup.hide(); entityName = ""; //$NON-NLS-1$ portal.setStyleAttribute("cursor", "default"); //$NON-NLS-1$//$NON-NLS-2$ } } }, false); }