List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setCellHorizontalAlignment
public void setCellHorizontalAlignment(IsWidget w, HorizontalAlignmentConstant align)
From source file:com.ephesoft.dcma.gwt.core.client.view.ExternalAppDialogBox.java
License:Open Source License
public ExternalAppDialogBox(String url, int xDimension, int yDimension, boolean showOkButton, boolean showCloseButton, boolean center, boolean isVisible) { setWidget(BINDER.createAndBindUi(this)); addStyleName(CSS_CONFIGURABLE_DIALOG_BOX); setWidth(xDimension + "px"); setHeight(yDimension + "px"); frame = new Frame(url); frame.setWidth(xDimension + "px"); frame.setHeight(yDimension + "px"); okButton = new Button("Ok", new ClickHandler() { @Override// w w w . j a va2s . c o m public void onClick(ClickEvent arg0) { listener.onOkClick(); hide(); } }); okButton.setTitle("Ctrl+a"); closeButton = new Button("Close", new ClickHandler() { @Override public void onClick(ClickEvent arg0) { listener.onCloseClick(); hide(); } }); closeButton.setTitle("Ctrl+z"); okButton.getElement().setAttribute("id", "okButtonElement"); closeButton.getElement().setAttribute("id", "closeButtonElement"); okButton.setVisible(showOkButton); closeButton.setVisible(showCloseButton); HorizontalPanel horizontalButtonPanel = new HorizontalPanel(); horizontalButtonPanel.setSpacing(5); if (showOkButton) { horizontalButtonPanel.add(okButton); horizontalButtonPanel.setCellHorizontalAlignment(okButton, HasHorizontalAlignment.ALIGN_CENTER); } if (showCloseButton) { horizontalButtonPanel.add(closeButton); horizontalButtonPanel.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_CENTER); } verticalPanel.add(frame); verticalPanel.setCellHorizontalAlignment(frame, HasHorizontalAlignment.ALIGN_CENTER); verticalPanel.setCellHorizontalAlignment(horizontalButtonPanel, HasHorizontalAlignment.ALIGN_CENTER); verticalPanel.add(horizontalButtonPanel); setModal(true); setVisible(true); if (center) { center(); } if (isVisible) { show(); } }
From source file:com.ephesoft.dcma.gwt.foldermanager.client.view.widget.DisplayDialogBox.java
License:Open Source License
public DisplayDialogBox(Map<Integer, String> fileIndexVsNameMap, final HandlerManager eventBus) { super();//from www . ja v a 2 s .c o m setWidget(BINDER.createAndBindUi(this)); this.eventBus = eventBus; final VerticalPanel labelPanel = new VerticalPanel(); if (fileIndexVsNameMap != null && !fileIndexVsNameMap.isEmpty()) { for (final Entry<Integer, String> labelString : fileIndexVsNameMap.entrySet()) { totalCounter++; final HorizontalPanel horizontalPanel = new HorizontalPanel(); HTML html = new HTML(FolderManagementConstants.REMOVE_ICON_FOLDER_GIF); Label label = new Label(labelString.getValue()); horizontalPanel.add(html); horizontalPanel.add(label); horizontalPanel.setSpacing(3); labelPanel.add(horizontalPanel); html.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { labelPanel.remove(horizontalPanel); if (--totalCounter == 0) { addNoFilesLabel(labelPanel); } eventBus.fireEvent(new RemoveAttachmentEvent(labelString.getKey())); } }); } } else { addNoFilesLabel(labelPanel); } addStyleName(FolderManagementConstants.CSS_CONFIGURABLE_DIALOG_BOX); Button closeButton = new Button(LocaleDictionary.get().getConstantValue(FolderManagementConstants.CLOSE), new ClickHandler() { @Override public void onClick(ClickEvent arg0) { hide(); } }); HorizontalPanel horizontalButtonPanel = new HorizontalPanel(); horizontalButtonPanel.add(closeButton); horizontalButtonPanel.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_CENTER); ScrollPanel scrollPanel = new ScrollPanel(); scrollPanel.add(labelPanel); scrollPanel.setWidth(_200PX); scrollPanel.setHeight(_200PX); scrollPanel.addStyleName(FolderManagementConstants.BORDER); setHeight(_100PX); verticalPanel.add(scrollPanel); verticalPanel.add(horizontalButtonPanel); verticalPanel.setCellHorizontalAlignment(horizontalButtonPanel, HasHorizontalAlignment.ALIGN_CENTER); setModal(true); setVisible(true); show(); center(); closeButton.setFocus(true); }
From source file:com.ephesoft.dcma.gwt.home.client.view.LandingView.java
License:Open Source License
/** * To build the Landing Page./*from w w w . jav a 2 s. c om*/ * * @return FocusPanel */ public FocusPanel buildLandingPage() { focusPanel = new FocusPanel(); flowpanel = new DockLayoutPanel(Unit.PCT); flowpanel.setHeight(HUNDRED_PERCENT); flowpanel.addStyleName(CoreCommonConstants.MAIN_CONTAINER_CSS); HorizontalPanel horCapPanel = new HorizontalPanel(); VerticalPanel innerVerPanel = new VerticalPanel(); innerVerPanel.setWidth(CoreCommonConstants._100_PERCENTAGE); VerticalPanel capPanel = new VerticalPanel(); capPanel.setStyleName(CoreCommonConstants.TOP_PANEL_CSS); HorizontalPanel title = new HorizontalPanel(); title.setBorderWidth(0); title.setSize(HUNDRED_PERCENT, HUNDRED_PERCENT); Label titleLabel = new Label( LocaleDictionary.get().getConstantValue(BatchListConstants.LABEL_BATCH_ALERTS)); title.add(titleLabel); titleLabel.addStyleName(CoreCommonConstants.HEADER_BOLD_TEXT_CSS); capPanel.add(titleLabel); HorizontalPanel simPanel = new HorizontalPanel(); simPanel.setSize(HUNDRED_PERCENT, HUNDRED_PERCENT); Label pendingForReviewLabel = new Label( LocaleDictionary.get().getConstantValue(BatchListConstants.LABEL_PEND_FOR_REVIEW) + ": "); pendingForReviewLabel.addStyleName(CoreCommonConstants.BOLD_TEXT_CSS); pendingForReviewLabelValue = new Label(""); Label pendingForValidationLabel = new Label( LocaleDictionary.get().getConstantValue(BatchListConstants.LABEL_PEND_FOR_VALIDATION) + ": "); pendingForValidationLabel.addStyleName(CoreCommonConstants.BOLD_TEXT_CSS); pendingForValidationLabelValue = new Label(""); Label totalBatchCount = new Label( LocaleDictionary.get().getConstantValue(BatchListConstants.LABEL_TOTAL_BATCHES) + ": "); totalBatchCount.addStyleName(CoreCommonConstants.BOLD_TEXT_CSS); totalBatchValue = new Label(BatchListConstants.EMPTY_STRING); Label pipe = new Label(BatchListConstants.EMPTY_STRING); pipe.setStyleName("pipe"); simPanel.add(totalBatchCount); simPanel.add(totalBatchValue); simPanel.add(pipe); simPanel.add(pendingForReviewLabel); simPanel.add(pendingForReviewLabelValue); simPanel.add(pendingForValidationLabel); simPanel.add(pendingForValidationLabelValue); simPanel.setCellWidth(pendingForReviewLabel, "7%"); simPanel.setCellWidth(pendingForReviewLabelValue, "2%"); simPanel.setCellWidth(pendingForValidationLabel, "7%"); simPanel.setCellWidth(pendingForValidationLabelValue, "20%"); simPanel.setCellWidth(totalBatchCount, "5%"); simPanel.setCellWidth(totalBatchValue, "2%"); simPanel.setCellWidth(pipe, "1%"); capPanel.add(simPanel); capPanel.setWidth(HUNDRED_PERCENT); innerVerPanel.add(capPanel); Label dummyLabel = new Label(); dummyLabel.setHeight("40px"); innerVerPanel.add(dummyLabel); HorizontalPanel buttonTextPanel = new HorizontalPanel(); buttonTextPanel.add(dummyLabel); buttonTextPanel.setCellWidth(dummyLabel, "20%"); innerVerPanel.add(buttonTextPanel); horCapPanel.add(innerVerPanel); horCapPanel.setCellHorizontalAlignment(innerVerPanel, HasAlignment.ALIGN_LEFT); horCapPanel.setWidth(HUNDRED_PERCENT); flowpanel.addNorth(horCapPanel, BatchListConstants.FIFTEEN); reviewTable = new ReviewValidateTable(true); reviewValidateTabLayoutPanel = new TabLayoutPanel(BatchListConstants.FIVE, Unit.PCT); reviewValidateTabLayoutPanel.setWidth(CoreCommonConstants._100_PERCENTAGE); reviewValidateTabLayoutPanel.add(reviewTable.getMainPanel()); validateTable = new ReviewValidateTable(false); reviewValidateTabLayoutPanel.add(validateTable.getMainPanel(), ""); flowpanel.add(reviewValidateTabLayoutPanel); focusPanel.add(flowpanel); focusPanel.addKeyDownHandler(new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent arg0) { presenter.getController().getEventBus().fireEvent(new BatchListKeyDownEvent(arg0)); } }); return focusPanel; }
From source file:com.ephesoft.dcma.gwt.home.client.view.reviewtable.ReviewValidateTable.java
License:Open Source License
/** * Constructor.//from w w w.j a v a2 s. c o m */ public ReviewValidateTable() { super(); mainPanel = new DockLayoutPanel(Unit.PCT); searchAndFilterContanier = new FlowPanel(); filterAndSearchPanel = new HorizontalPanel(); searchAndFilterContanier.addStyleName(CoreCommonConstants.OPTIONS_PANEL); filterAndSearchPanel.setWidth(CoreCommonConstants._100_PERCENTAGE); priorityListBox = createPriorityListBox(); searchPanel = new HorizontalPanel(); listView = new ListView(); listView.setTableRowCount(BatchListConstants.FIFTEEN); addHeaders(); HorizontalPanel listBoxPanel; listBoxPanel = new HorizontalPanel(); searchBatchButton = new Button(); searchBatchLabel = new Label(); searchBatchTextBox = new TextBox(); searchPanel.add(searchBatchLabel); searchPanel.add(searchBatchTextBox); searchPanel.add(searchBatchButton); searchPanel.setCellVerticalAlignment(searchBatchLabel, HasVerticalAlignment.ALIGN_MIDDLE); searchPanel.setCellVerticalAlignment(searchBatchTextBox, HasVerticalAlignment.ALIGN_MIDDLE); searchPanel.setCellVerticalAlignment(searchBatchButton, HasVerticalAlignment.ALIGN_MIDDLE); searchPanel.addStyleName(CoreCommonConstants.LAST_GRP_PANEL_NORMAL_CSS); searchBatchLabel.setText(LocaleDictionary.get().getConstantValue(BatchListConstants.LABEL_SEARCH_BATCH) + BatchListConstants.COLON); searchBatchButton.setText(LocaleDictionary.get().getConstantValue(BatchListConstants.BUTTON_SEARCH_BATCH)); listBoxPanel.addStyleName(CoreCommonConstants.GRP_PANEL_NORMAL_CSS); searchAndFilterContanier.add(filterAndSearchPanel); mainPanel.addNorth(searchAndFilterContanier, BatchListConstants.FIFTEEN); mainPanel.addStyleName("padding0"); mainPanel.add(listView); Label priorityLabel = new Label( LocaleDictionary.get().getConstantValue(BatchListConstants.LABEL_PRIORITY_LISTBOX)); refreshButton = new Button( LocaleDictionary.get().getConstantValue(BatchListConstants.LABEL_REFRESH_BUTTON)); listBoxPanel.add(priorityLabel); listBoxPanel.add(priorityListBox); listBoxPanel.add(refreshButton); listBoxPanel.setCellHorizontalAlignment(priorityLabel, HasHorizontalAlignment.ALIGN_RIGHT); listBoxPanel.setCellHorizontalAlignment(refreshButton, HasHorizontalAlignment.ALIGN_LEFT); listBoxPanel.setWidth(CoreCommonConstants._100_PERCENTAGE); filterAndSearchPanel.add(listBoxPanel); filterAndSearchPanel.add(searchPanel); filterAndSearchPanel.setCellHorizontalAlignment(listBoxPanel, HasHorizontalAlignment.ALIGN_LEFT); filterAndSearchPanel.setCellWidth(listBoxPanel, CoreCommonConstants._20_PERCENTAGE); filterAndSearchPanel.setCellHorizontalAlignment(searchPanel, HasHorizontalAlignment.ALIGN_LEFT); searchBatchTextBox.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { if (event.getCharCode() == KeyCodes.KEY_ENTER) { searchBatchButton.click(); } } }); searchBatchTextBox.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { searchBatchTextBox.setText(BatchListConstants.EMPTY_STRING); } }); }
From source file:com.ephesoft.dcma.gwt.login.client.LoginEntryPoint.java
License:Open Source License
@Override public void onLoad() { Document.get().setTitle(LocaleDictionary.get().getConstantValue(LoginConstants.LOGIN_TITLE)); Label userName = new Label(LocaleDictionary.get().getConstantValue(LoginConstants.LOGIN_USERNAME)); userName.setStyleName("text_bold"); Label password = new Label(LocaleDictionary.get().getConstantValue(LoginConstants.LOGIN_PASSWORD)); password.setStyleName("text_bold"); /*/*ww w. j a v a2 s.c o m*/ * CheckBox remMe = new CheckBox(LocaleDictionary.get().getConstantValue( LoginConstants.login_remember_me)); * remMe.setEnabled(false); Label forgPwd = new Label(LocaleDictionary.get().getConstantValue(LoginConstants * .login_forgot_pwd)); */ Label version = new Label(LocaleDictionary.get().getConstantValue(LoginConstants.VERSION_TEXT)); final Label versionNumber = new Label(); RootPanel.get("userName").add(userName); RootPanel.get("password").add(password); /* * RootPanel.get("remMe").add(remMe); RootPanel.get("forgPwd").add(forgPwd); */ RootPanel.get("version").add(version); ((LoginRemoteServiceAsync) createRpcService()).getProductVersion(new EphesoftAsyncCallback<String>() { @Override public void onSuccess(String version) { versionNumber.setText(version); } @Override public void customFailure(Throwable arg0) { ConfirmationDialogUtil.showConfirmationDialogError( LocaleDictionary.get().getMessageValue(LoginConstants.UNABLE_TO_RETRIVE_VERSION_INFO)); } }); RootPanel.get("versionLabel").add(versionNumber); SubmitButton submitButton = new SubmitButton(); submitButton.setFocus(true); submitButton.setText(LocaleDictionary.get().getConstantValue(LoginConstants.LOGIN_BUTTON_TEXT)); submitButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { login(); } }); submitButton.setStyleName("btn_blue"); RootPanel.get("buttonLogin").add(submitButton); final Label expiryMsg = new Label(); ((LoginRemoteServiceAsync) createRpcService()).getLicenseExpiryMsg(new EphesoftAsyncCallback<Void>() { @Override public void customFailure(Throwable arg0) { String alertMsg = arg0.getLocalizedMessage(); int indexOfDelimiter = alertMsg.indexOf('@'); String days = alertMsg.substring(0, indexOfDelimiter); int remainingDays = Integer.parseInt(days); String dateString = alertMsg.substring(indexOfDelimiter + 1); if (remainingDays != 0) { expiryMsg.setText(LocaleDictionary.get().getMessageValue(LoginMessages.LICENSE_EXPIRY_MSG, days, dateString)); } else { expiryMsg.setText( LocaleDictionary.get().getMessageValue(LoginMessages.LICENSE_EXPIRY_MSG_TODAY)); } } @Override public void onSuccess(Void arg0) { // Nothing to do .. on success of RPC call } }); expiryMsg.setStyleName(LICENSE_TEXT); RootPanel.get(EXPIRY_MSG_LEBEL).add(expiryMsg); final HorizontalPanel horPanel = new HorizontalPanel(); horPanel.setWidth("100%"); RootPanel.get().add(horPanel); ScreenMaskUtility.maskScreen("Loading"); rpcService.getFooterProperties(new EphesoftAsyncCallback<Map<String, String>>() { @Override public void onSuccess(Map<String, String> footerProperties) { String footerText = footerProperties.get(CoreCommonConstants.FOOTER_TEXT_KEY); String footerLink = footerProperties.get(CoreCommonConstants.FOOTER_LINK_KEY); final Anchor footerInfo = new Anchor(footerText, footerLink); horPanel.add(footerInfo); horPanel.setCellHorizontalAlignment(footerInfo, HasHorizontalAlignment.ALIGN_CENTER); ScreenMaskUtility.unmaskScreen(); } @Override public void customFailure(Throwable arg0) { ScreenMaskUtility.unmaskScreen(); ConfirmationDialogUtil .showConfirmationDialogError("Application could not be authorized. Please try again."); } }); }
From source file:com.ephesoft.dcma.gwt.rv.client.view.ExternalAppDialogBox.java
License:Open Source License
public ExternalAppDialogBox(String url, java.util.Map<String, String> dimensionsOfPopUpMap) { super();/*from ww w.j a v a2s .com*/ setWidget(BINDER.createAndBindUi(this)); addStyleName(ReviewValidateConstants.CONFIGURED_DIMENSIONS_DIALOG); int xDimension; int yDimension; try { xDimension = Integer.parseInt(dimensionsOfPopUpMap.get(ReviewValidateConstants.POP_UP_X_DIMENSION)); if (xDimension < 0) { xDimension = DEFAULT_X_DIMENSION; } } catch (Exception e) { xDimension = DEFAULT_X_DIMENSION; } try { yDimension = Integer.parseInt(dimensionsOfPopUpMap.get(ReviewValidateConstants.POP_UP_Y_DIMENSION)); if (yDimension < 0) { yDimension = DEFAULT_Y_DIMENSION; } } catch (Exception e) { yDimension = DEFAULT_Y_DIMENSION; } setWidth(xDimension + "px"); setHeight(yDimension + "px"); Frame frame = new Frame(url); frame.setWidth(xDimension + "px"); frame.setHeight(yDimension + "px"); okButton = new Button("Ok", new ClickHandler() { @Override public void onClick(ClickEvent arg0) { listener.onOkClick(); hide(); } }); okButton.setTitle("Ctrl+a"); closeButton = new Button("Close", new ClickHandler() { @Override public void onClick(ClickEvent arg0) { listener.onCloseClick(); hide(); } }); closeButton.setTitle("Ctrl+z"); okButton.getElement().setAttribute("id", "okButtonElement"); closeButton.getElement().setAttribute("id", "closeButtonElement"); okButton.setVisible(false); closeButton.setVisible(false); HorizontalPanel horizontalButtonPanel = new HorizontalPanel(); horizontalButtonPanel.setSpacing(5); horizontalButtonPanel.add(okButton); horizontalButtonPanel.add(closeButton); horizontalButtonPanel.setCellHorizontalAlignment(okButton, HasHorizontalAlignment.ALIGN_CENTER); horizontalButtonPanel.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_CENTER); verticalPanel.add(frame); verticalPanel.setCellHorizontalAlignment(frame, HasHorizontalAlignment.ALIGN_CENTER); verticalPanel.setCellHorizontalAlignment(horizontalButtonPanel, HasHorizontalAlignment.ALIGN_CENTER); verticalPanel.add(horizontalButtonPanel); setModal(true); setVisible(true); show(); }
From source file:com.ephesoft.gxt.login.client.LoginEntryPoint.java
License:Open Source License
@Override public void onLoad() { Window.setTitle(LocaleDictionary.getConstantValue(LoginConstants.LOGIN_TITLE)); Label userName = new Label(LocaleDictionary.getConstantValue(LoginConstants.login_username)); Label password = new Label(LocaleDictionary.getConstantValue(LoginConstants.login_password)); RootPanel.get("loginHeader").getElement() .setInnerText(LocaleDictionary.getConstantValue(LoginConstants.login_button_text)); RootPanel.get("j_username").getElement().setAttribute("placeholder", userName.getText()); RootPanel.get("j_username").getElement().focus(); RootPanel.get("j_password").getElement().setAttribute("placeholder", password.getText()); final Label versionNumber = new Label(); ((LoginRemoteServiceAsync) createRpcService()).getProductVersion(new AsyncCallback<String>() { @Override/*ww w .j a va 2 s . c o m*/ public void onSuccess(String version) { versionNumber.setText(version); RootPanel.get("versionLabel").getElement().setInnerText(versionNumber.getText()); } @Override public void onFailure(Throwable arg0) { DialogUtil.showMessageDialog(LocaleDictionary.getConstantValue(LocaleCommonConstants.ERROR_TITLE), LocaleDictionary.getConstantValue(LoginConstants.UNABLE_TO_RETRIVE_VERSION_INFO), DialogIcon.ERROR); } }); final Label expiryMsg = new Label(); final Label failOverMsg = new Label(); ((LoginRemoteServiceAsync) createRpcService()).getLicenseExpiryMsg(new AsyncCallback<Void>() { @Override public void onFailure(Throwable arg0) { String alertMsg = arg0.getLocalizedMessage(); int indexOfDelimiter = alertMsg.indexOf('@'); String days = alertMsg.substring(0, indexOfDelimiter); int remainingDays = Integer.parseInt(days); String dateString = alertMsg.substring(indexOfDelimiter + 1); if (remainingDays != 0) { expiryMsg.setText( LocaleDictionary.getMessageValue(LoginMessages.LICENSE_EXPIRY_MSG, days, dateString)); } else { expiryMsg.setText(LocaleDictionary.getMessageValue(LoginMessages.LICENSE_EXPIRY_MSG_TODAY)); } expiryMsg.addStyleName(FONT_RED_CSS); expiryMsg.addStyleName(BOLD_TEXT_CSS); RootPanel.get(EXPIRY_MSG_LEBEL).getElement().setInnerText(expiryMsg.getText()); RootPanel.get(EXPIRY_MSG_LEBEL).addStyleName(expiryMsg.getStyleName()); } @Override public void onSuccess(Void arg0) { } }); ((LoginRemoteServiceAsync) createRpcService()).getFailOverMessage(new AsyncCallback<Boolean>() { @Override public void onSuccess(Boolean result) { if (true == result) { // failOverMsg.setText(""); } else { failOverMsg.setText(LocaleDictionary.getMessageValue(LoginMessages.FAILOVER_MSG)); failOverMsg.addStyleName(FONT_RED_CSS); failOverMsg.addStyleName(BOLD_TEXT_CSS); RootPanel.get(FAIL_OVER_LABEL).getElement().setInnerText(failOverMsg.getText()); RootPanel.get(FAIL_OVER_LABEL).addStyleName(failOverMsg.getStyleName()); } } @Override public void onFailure(Throwable arg0) { } }); final HorizontalPanel horPanel = new HorizontalPanel(); horPanel.addStyleName("horizontalPanel"); RootPanel.get().add(horPanel); ScreenMaskUtility.maskScreen(LocaleDictionary.getMessageValue(LoginMessages.LOADING)); rpcService.getFooterProperties(new AsyncCallback<Map<String, String>>() { @Override public void onSuccess(Map<String, String> footerProperties) { footerText = footerProperties.get(CoreCommonConstants.FOOTER_TEXT_KEY); footerLink = footerProperties.get(CoreCommonConstants.FOOTER_LINK_KEY); final Anchor footerInfo = new Anchor(footerText, footerLink); horPanel.addStyleName("loginFooter"); horPanel.add(footerInfo); horPanel.setCellHorizontalAlignment(footerInfo, HasHorizontalAlignment.ALIGN_CENTER); ScreenMaskUtility.unmaskScreen(); } @Override public void onFailure(Throwable arg0) { ScreenMaskUtility.unmaskScreen(); DialogUtil.showMessageDialog(LocaleDictionary.getConstantValue(LocaleCommonConstants.ERROR_TITLE), LocaleDictionary.getMessageValue(LoginMessages.APPLICATION_NOT_AUTHORIZED), DialogIcon.ERROR); } }); RootPanel.get("error").getElement() .setInnerText(LocaleDictionary.getConstantValue(LoginConstants.INVALID_CREDENTIALS)); RootPanel.get("error").addStyleName(FONT_RED_CSS); SubmitButton submitButton = new SubmitButton(); // (SubmitButton) SubmitButton.wrap(RootPanel.get("button").getElement()); // submitButton.setFocus(true); submitButton.getElement().setTitle(LocaleDictionary.getConstantValue(LoginConstants.login_button_text)); submitButton.getElement().setInnerHTML("<i class=\"icon-arrow-right icon-large\"></i>"); submitButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { login(); } }); submitButton.setStyleName("gwt-Button"); RootPanel.get("button").getElement().addClassName("submit"); RootPanel.get("button").add(submitButton); }
From source file:com.google.appinventor.client.editor.simple.palette.SimplePaletteItem.java
License:Open Source License
/** * Creates a new palette item./*w ww. j a va 2 s. c o m*/ * * @param scd component descriptor for palette item * @param dropTargetProvider provider of targets that palette items can be dropped on */ public SimplePaletteItem(SimpleComponentDescriptor scd, DropTargetProvider dropTargetProvider) { this.dropTargetProvider = dropTargetProvider; this.scd = scd; componentPrototype = null; // Initialize palette item UI HorizontalPanel panel = new HorizontalPanel(); panel.setStylePrimaryName("ode-SimplePaletteItem"); Image image = scd.getImage(); image.setStylePrimaryName("ode-SimplePaletteItem-icon"); panel.add(image); panel.setCellHorizontalAlignment(image, HorizontalPanel.ALIGN_LEFT); panel.setCellWidth(image, "30px"); Label label = new Label(TranslationDesignerPallete.getCorrespondingString(scd.getName())); label.setHorizontalAlignment(Label.ALIGN_LEFT); label.addStyleName("ode-SimplePaletteItem-caption"); panel.add(label); HorizontalPanel optPanel = new HorizontalPanel(); ComponentHelpWidget helpImage = new ComponentHelpWidget(scd); helpImage.addStyleName("ode-SimplePalleteItem-button"); optPanel.add(helpImage); optPanel.setCellHorizontalAlignment(helpImage, HorizontalPanel.ALIGN_LEFT); if (scd.getExternal()) { ComponentRemoveWidget deleteImage = new ComponentRemoveWidget(scd); deleteImage.addStyleName("ode-SimplePalleteItem-button"); optPanel.add(deleteImage); optPanel.setCellHorizontalAlignment(deleteImage, HorizontalPanel.ALIGN_RIGHT); } panel.add(optPanel); panel.setCellHorizontalAlignment(optPanel, HorizontalPanel.ALIGN_RIGHT); panel.setWidth("100%"); add(panel); setWidth("100%"); }
From source file:com.google.appinventor.client.explorer.SourceStructureExplorer.java
License:Open Source License
/** * Creates a new source structure explorer. *//*from w w w . j av a 2 s . c o m*/ public SourceStructureExplorer() { // Initialize UI elements tree = new Tree(Ode.getImageBundle()); tree.setAnimationEnabled(true); tree.addCloseHandler(new CloseHandler<TreeItem>() { @Override public void onClose(CloseEvent<TreeItem> event) { TreeItem treeItem = event.getTarget(); if (treeItem != null) { Object userObject = treeItem.getUserObject(); if (userObject instanceof SourceStructureExplorerItem) { SourceStructureExplorerItem item = (SourceStructureExplorerItem) userObject; item.onStateChange(false); } } } }); tree.addOpenHandler(new OpenHandler<TreeItem>() { @Override public void onOpen(OpenEvent<TreeItem> event) { TreeItem treeItem = event.getTarget(); if (treeItem != null) { Object userObject = treeItem.getUserObject(); if (userObject instanceof SourceStructureExplorerItem) { SourceStructureExplorerItem item = (SourceStructureExplorerItem) userObject; item.onStateChange(true); } } } }); tree.addSelectionHandler(new SelectionHandler<TreeItem>() { @Override public void onSelection(SelectionEvent<TreeItem> event) { TreeItem treeItem = event.getSelectedItem(); if (treeItem != null) { Object userObject = treeItem.getUserObject(); if (userObject instanceof SourceStructureExplorerItem) { SourceStructureExplorerItem item = (SourceStructureExplorerItem) userObject; enableButtons(item); //showBlocks(item); item.onSelected(); } else { disableButtons(); //hideComponent(); } } else { disableButtons(); } } }); tree.addKeyDownHandler(new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { int keyCode = event.getNativeKeyCode(); if (keyCode == KeyCodes.KEY_DELETE || keyCode == KeyCodes.KEY_BACKSPACE) { event.preventDefault(); deleteItemFromTree(); } } }); // Put a ScrollPanel around the tree. ScrollPanel scrollPanel = new ScrollPanel(tree); scrollPanel.setWidth("200px"); // wide enough to avoid a horizontal scrollbar most of the time scrollPanel.setHeight("480px"); // approximately the same height as the viewer HorizontalPanel buttonPanel = new HorizontalPanel(); buttonPanel.setStyleName("ode-PanelButtons"); buttonPanel.setSpacing(4); renameButton = new TextButton(MESSAGES.renameButton()); renameButton.setEnabled(false); renameButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { TreeItem treeItem = tree.getSelectedItem(); if (treeItem != null) { Object userObject = treeItem.getUserObject(); if (userObject instanceof SourceStructureExplorerItem) { SourceStructureExplorerItem item = (SourceStructureExplorerItem) userObject; item.rename(); } } } }); buttonPanel.add(renameButton); buttonPanel.setCellHorizontalAlignment(renameButton, HorizontalPanel.ALIGN_RIGHT); deleteButton = new TextButton(MESSAGES.deleteButton()); deleteButton.setEnabled(false); deleteButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { deleteItemFromTree(); } }); buttonPanel.add(deleteButton); buttonPanel.setCellHorizontalAlignment(deleteButton, HorizontalPanel.ALIGN_LEFT); VerticalPanel panel = new VerticalPanel(); panel.add(scrollPanel); panel.add(new Label()); panel.add(buttonPanel); panel.setCellHorizontalAlignment(buttonPanel, HorizontalPanel.ALIGN_CENTER); initWidget(panel); }
From source file:com.google.appinventor.client.TopPanel.java
License:Open Source License
/** * Initializes and assembles all UI elements shown in the top panel. *///w w w . j a v a2 s . c o m public TopPanel() { /* * The layout of the top panel is as follows: * * +-- topPanel ------------------------------------+ * |+-- logo --++-----tools-----++--links/account--+| * || || || || * |+----------++---------------++-----------------+| * +------------------------------------------------+ */ HorizontalPanel topPanel = new HorizontalPanel(); topPanel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); // Create the Tools TopToolbar tools = new TopToolbar(); ode.setTopToolbar(tools); // Create the Links HorizontalPanel links = new HorizontalPanel(); links.setStyleName("ode-TopPanelLinks"); links.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); if (Ode.getInstance().isReadOnly()) { Label readOnly = new Label(MESSAGES.readOnlyMode()); readOnly.setStyleName("ode-TopPanelWarningLabel"); links.add(readOnly); } // My Projects Link TextButton myProjects = new TextButton(MESSAGES.myProjectsTabName()); myProjects.setStyleName("ode-TopPanelButton"); myProjects.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { ode.switchToProjectsView(); } }); myProjects.setStyleName("ode-TopPanelButton"); links.add(myProjects); // Code on gallerydev branch // Gallery Link gallery = new TextButton(MESSAGES.tabNameGallery()); gallery.setStyleName("ode-TopPanelButton"); gallery.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { ode.switchToGalleryView(); } }); links.add(gallery); Config config = ode.getSystemConfig(); String guideUrl = config.getGuideUrl(); if (!Strings.isNullOrEmpty(guideUrl)) { TextButton guideLink = new TextButton(MESSAGES.guideTabName()); guideLink.addClickHandler(new WindowOpenClickHandler(guideUrl)); guideLink.setStyleName("ode-TopPanelButton"); links.add(guideLink); } // Feedback Link String feedbackUrl = config.getFeedbackUrl(); if (!Strings.isNullOrEmpty(feedbackUrl)) { TextButton feedbackLink = new TextButton(MESSAGES.feedbackTabName()); feedbackLink.addClickHandler(new WindowOpenClickHandler(feedbackUrl)); feedbackLink.setStyleName("ode-TopPanelButton"); links.add(feedbackLink); } /* // Code on master branch // Gallery Link if (Ode.getInstance().getUser().getIsAdmin()) { TextButton gallery = new TextButton(MESSAGES.galleryTabName()); gallery.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { Window.open("http://gallery.appinventor.mit.edu", "_blank", "scrollbars=1"); } }); gallery.setStyleName("ode-TopPanelButton"); links.add(gallery); } */ moderation = new TextButton(MESSAGES.tabNameModeration()); moderation.setStyleName("ode-TopPanelButton"); moderation.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { ode.switchToModerationPageView(); } }); moderation.setVisible(false); links.add(moderation); // Create the Account Information rightPanel = new VerticalPanel(); rightPanel.setHeight("100%"); rightPanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); HorizontalPanel account = new HorizontalPanel(); account.setStyleName("ode-TopPanelAccount"); // Account Drop Down Button List<DropDownItem> userItems = Lists.newArrayList(); // Sign Out userItems.add(new DropDownItem(WIDGET_NAME_SIGN_OUT, MESSAGES.signOutLink(), new SignOutAction())); accountButton = new DropDownButton(WIDGET_NAME_USER, " ", userItems, true); accountButton.setItemEnabled(WIDGET_NAME_MESSAGES, false); accountButton.setStyleName("ode-TopPanelButton"); // Language List<DropDownItem> languageItems = Lists.newArrayList(); String[] localeNames = LocaleInfo.getAvailableLocaleNames(); String nativeName; for (String localeName : localeNames) { if (!localeName.equals("default")) { SelectLanguage lang = new SelectLanguage(); lang.setLocale(localeName); nativeName = getDisplayName(localeName); languageItems.add(new DropDownItem(WIDGET_NAME_LANGUAGE, nativeName, lang)); } } String currentLang = LocaleInfo.getCurrentLocale().getLocaleName(); String nativeDisplayName = getDisplayName(currentLang); languageDropDown = new DropDownButton(WIDGET_NAME_LANGUAGE, nativeDisplayName, languageItems, true); languageDropDown.setStyleName("ode-TopPanelButton"); account.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); account.add(links); account.add(languageDropDown); account.add(accountButton); rightPanel.add(account); // Add the Logo, Tools, Links to the TopPanel addLogo(topPanel); topPanel.add(tools); topPanel.add(rightPanel); topPanel.setCellVerticalAlignment(rightPanel, HorizontalPanel.ALIGN_MIDDLE); rightPanel.setCellHorizontalAlignment(account, HorizontalPanel.ALIGN_RIGHT); topPanel.setCellHorizontalAlignment(rightPanel, HorizontalPanel.ALIGN_RIGHT); initWidget(topPanel); setStyleName("ode-TopPanel"); setWidth("100%"); }