List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setCellWidth
public void setCellWidth(IsWidget w, String width)
From source file:com.gwttest.client.Events.java
License:Open Source License
public void onModuleLoad() { SimplePanel main = new SimplePanel(); main.setHeight("100%"); main.setWidth("100%"); HorizontalPanel hp = new HorizontalPanel(); hp.setSpacing(10);/*from w w w .j a v a 2 s . c om*/ VerticalPanel vp = new VerticalPanel(); // add home page HTML homeText = new HTML( "<h2>Welcome to OFCGWT</h2>" + "<i>....the OpenFlashChart GWT Library</i></br></br>" + "This demonstration showcases the events \"onClick\" feature with a drill-down effect."); vp.add(homeText); vp.setCellHeight(homeText, "300"); hp.add(vp); hp.setCellWidth(vp, "300"); // add chart DecoratorPanel dp = new DecoratorPanel(); SimplePanel pieSp = new SimplePanel(); chart = new ChartWidget(); chart.setSize("400", "300"); pieSp.add(chart); dp.add(pieSp); hp.add(dp); VerticalPanel chartlist = new VerticalPanel(); chartlist.setSpacing(5); resetBut = new Button("Reset", new ClickHandler() { @Override public void onClick(ClickEvent event) { chart.setChartData(getPieChartLayer1()); } }); chartlist.add(chartLabel); chartlist.add(resetBut); ChartData cd = getPieChartLayer1(); chart.setChartData(cd); hp.add(chartlist); hp.setCellWidth(chartlist, "300"); RootPanel.get().add(hp); }
From source file:com.ikon.frontend.client.util.validator.ValidatorBuilder.java
License:Open Source License
public static void addValidator(ValidationProcessor validationProcessor, FocusAction focusAction, HorizontalPanel hPanel, String name, GWTValidator validator, Widget widget) { String type = validator.getType(); if (type.equals("req")) { HTML space = new HTML(""); Label errorLabel = new Label(Main.i18n("validation.required.field")); errorLabel.setStyleName("okm-validationFailedText"); hPanel.add(space);// w ww. j a v a 2 s . c o m hPanel.add(errorLabel); hPanel.setCellWidth(space, "5"); if (widget instanceof TextBox) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_MIDDLE); validationProcessor.addValidators(name + "_req", new NotEmptyValidator((TextBox) widget).addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } else if (widget instanceof TextArea) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_TOP); validationProcessor.addValidators(name + "_req", new NotEmptyValidator((TextArea) widget).addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } else if (widget instanceof ListBox) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_MIDDLE); validationProcessor.addValidators(name + "_req", new ListBoxValidator((ListBox) widget, "").addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } else if (widget instanceof FlexTable) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_TOP); validationProcessor.addValidators(name + "_req", new NotEmptyFlextTableValidator((FlexTable) widget) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } else if (widget instanceof FileUpload) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_TOP); validationProcessor.addValidators(name + "_req", new NotEmptyFileUploadValidator((FileUpload) widget) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } } else if (type.equals("email")) { HTML space = new HTML(""); Label errorLabel = new Label(Main.i18n("validation.mail.required.field")); errorLabel.setStyleName("okm-validationFailedText"); hPanel.add(space); hPanel.add(errorLabel); hPanel.setCellWidth(space, "5"); if (widget instanceof TextBox) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_MIDDLE); validationProcessor.addValidators(name + "_email", new EmailValidator((TextBox) widget).addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } } else if (type.equals("url")) { HTML space = new HTML(""); Label errorLabel = new Label(Main.i18n("validation.url.required.field")); errorLabel.setStyleName("okm-validationFailedText"); hPanel.add(space); hPanel.add(errorLabel); hPanel.setCellWidth(space, "5"); if (widget instanceof TextBox) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_MIDDLE); validationProcessor.addValidators(name + "_url", new URLValidator((TextBox) widget).addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } } else if (type.equals("minlen")) { HTML space = new HTML(""); Label errorLabel = new Label( Main.i18n("validation.minlen.required") + " - (" + validator.getParameter() + ")"); errorLabel.setStyleName("okm-validationFailedText"); hPanel.add(space); hPanel.add(errorLabel); hPanel.setCellWidth(space, "5"); if (widget instanceof TextBox) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_MIDDLE); validationProcessor.addValidators(name + "_minlen", new StringMinLengthValidator((TextBox) widget, Integer.parseInt(validator.getParameter())) .addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } else if (widget instanceof TextArea) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_TOP); validationProcessor.addValidators(name + "_minlen", new StringMinLengthValidator((TextArea) widget, Integer.parseInt(validator.getParameter())) .addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } } else if (type.equals("maxlen")) { HTML space = new HTML(""); Label errorLabel = new Label( Main.i18n("validation.maxlen.required") + " - (" + validator.getParameter() + ")"); errorLabel.setStyleName("okm-validationFailedText"); hPanel.add(space); hPanel.add(errorLabel); hPanel.setCellWidth(space, "5"); if (widget instanceof TextBox) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_MIDDLE); validationProcessor.addValidators(name + "_maxlen", new StringMaxLengthValidator((TextBox) widget, Integer.parseInt(validator.getParameter())) .addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } else if (widget instanceof TextArea) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_TOP); validationProcessor.addValidators(name + "_maxlen", new StringMaxLengthValidator((TextArea) widget, Integer.parseInt(validator.getParameter())) .addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } } else if (type.equals("lt")) { HTML space = new HTML(""); Label errorLabel = new Label( Main.i18n("validation.lt.required") + " - (" + validator.getParameter() + ")"); errorLabel.setStyleName("okm-validationFailedText"); hPanel.add(space); hPanel.add(errorLabel); hPanel.setCellWidth(space, "5"); if (widget instanceof TextBox) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_MIDDLE); validationProcessor.addValidators(name + "_lt", new StringLtValidator((TextBox) widget, validator.getParameter()) .addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } else if (widget instanceof TextArea) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_TOP); validationProcessor.addValidators(name + "_lt", new StringLtValidator((TextArea) widget, validator.getParameter()) .addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } } else if (type.equals("gt")) { HTML space = new HTML(""); Label errorLabel = new Label( Main.i18n("validation.gt.required") + " - (" + validator.getParameter() + ")"); errorLabel.setStyleName("okm-validationFailedText"); hPanel.add(space); hPanel.add(errorLabel); hPanel.setCellWidth(space, "5"); if (widget instanceof TextBox) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_MIDDLE); validationProcessor.addValidators(name + "_gt", new StringGtValidator((TextBox) widget, validator.getParameter()) .addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } else if (widget instanceof TextArea) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_TOP); validationProcessor.addValidators(name + "_gt", new StringGtValidator((TextArea) widget, validator.getParameter()) .addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } } else if (type.equals("min")) { HTML space = new HTML(""); Label errorLabel = new Label( Main.i18n("validation.min.required") + " - (" + validator.getParameter() + ")"); errorLabel.setStyleName("okm-validationFailedText"); hPanel.add(space); hPanel.add(errorLabel); hPanel.setCellWidth(space, "5"); if (widget instanceof TextBox) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_MIDDLE); validationProcessor.addValidators(name + "_min", new IntegerMinValidator((TextBox) widget, Integer.parseInt(validator.getParameter())) .addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } else if (widget instanceof TextArea) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_TOP); validationProcessor.addValidators(name + "_min", new IntegerMinValidator((TextArea) widget, Integer.parseInt(validator.getParameter())) .addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } } else if (type.equals("max")) { HTML space = new HTML(""); Label errorLabel = new Label( Main.i18n("validation.max.required") + " - (" + validator.getParameter() + ")"); errorLabel.setStyleName("okm-validationFailedText"); hPanel.add(space); hPanel.add(errorLabel); hPanel.setCellWidth(space, "5"); if (widget instanceof TextBox) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_MIDDLE); validationProcessor.addValidators(name + "_max", new IntegerMaxValidator((TextBox) widget, Integer.parseInt(validator.getParameter())) .addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } else if (widget instanceof TextArea) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_TOP); validationProcessor.addValidators(name + "_max", new IntegerMaxValidator((TextArea) widget, Integer.parseInt(validator.getParameter())) .addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } } else if (type.equals("regexp")) { HTML space = new HTML(""); Label errorLabel = new Label( Main.i18n("validation.regexp.required") + " - (" + validator.getParameter() + ")"); errorLabel.setStyleName("okm-validationFailedText"); hPanel.add(space); hPanel.add(errorLabel); hPanel.setCellWidth(space, "5"); if (widget instanceof TextBox) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_MIDDLE); validationProcessor.addValidators(name + "_regexp", new RegularExpressionValidator((TextBox) widget, validator.getParameter()) .addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } else if (widget instanceof TextArea) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_TOP); validationProcessor.addValidators(name + "_regexp", new RegularExpressionValidator((TextArea) widget, validator.getParameter()) .addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } } else if (type.equals("alpha")) { HTML space = new HTML(""); Label errorLabel = new Label(Main.i18n("validation.alphanumeric.required")); errorLabel.setStyleName("okm-validationFailedText"); hPanel.add(space); hPanel.add(errorLabel); hPanel.setCellWidth(space, "5"); if (widget instanceof TextBox) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_MIDDLE); validationProcessor.addValidators(name + "_alpha", new AlphaNumericValidator((TextBox) widget).addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } else if (widget instanceof TextArea) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_TOP); validationProcessor.addValidators(name + "_alpha", new AlphaNumericValidator((TextArea) widget).addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } } else if (type.equals("num")) { HTML space = new HTML(""); Label errorLabel = new Label(Main.i18n("validation.numeric.required")); errorLabel.setStyleName("okm-validationFailedText"); hPanel.add(space); hPanel.add(errorLabel); hPanel.setCellWidth(space, "5"); if (widget instanceof TextBox) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_MIDDLE); validationProcessor.addValidators(name + "_num", new NumericValidator((TextBox) widget).addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } else if (widget instanceof TextArea) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_TOP); validationProcessor.addValidators(name + "_num", new NumericValidator((TextArea) widget).addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } } else if (type.equals("dec")) { HTML space = new HTML(""); Label errorLabel = new Label(Main.i18n("validation.decimal.required") + " - (000" + Main.i18n("general.decimal.pattern") + "00)"); errorLabel.setStyleName("okm-validationFailedText"); hPanel.add(space); hPanel.add(errorLabel); hPanel.setCellWidth(space, "5"); if (widget instanceof TextBox) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_MIDDLE); validationProcessor.addValidators(name + "_dec", new DecimalValidator((TextBox) widget).addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } else if (widget instanceof TextArea) { hPanel.setCellVerticalAlignment(errorLabel, HasAlignment.ALIGN_TOP); validationProcessor.addValidators(name + "_dec", new DecimalValidator((TextArea) widget).addActionForFailure(focusAction) .addActionForFailure(new StyleAction("okm-validationFailedBorder")) .addActionForFailure(new ErrorMsgLabelTextAction(errorLabel))); } } }
From source file:com.ikon.frontend.client.widget.dashboard.keymap.KeyMapDashboard.java
License:Open Source License
/** * KeyMapDashboard//www . j a va 2 s . co m */ public KeyMapDashboard() { horizontalSplitPanel = new HorizontalSplitPanel(); keyAllTable = new KeywordWidget(Main.i18n("dashboard.keyword.all")); keyTopTable = new KeywordWidget(Main.i18n("dashboard.keyword.top")); keyRelatedTable = new KeywordWidget(Main.i18n("dashboard.keyword.related")); allKeywordList = new ArrayList<GWTKeyword>(); relatedKeywordList = new ArrayList<GWTKeyword>(); rateMap = new HashMap<String, String>(); HTML space = new HTML(" "); flowPanelDivisor = new HTML(" "); tagCloud = new TagCloud(); table = new KeyMapTable(); VerticalPanel contentPanel = new VerticalPanel(); contentPanel.add(tagCloud); contentPanel.add(space); contentPanel.add(flowPanelDivisor); contentPanel.add(table); contentPanel.setWidth("100%"); tagCloud.setWidth("100%"); space.setWidth("100%"); space.setHeight("10"); flowPanelDivisor.setWidth("100%"); flowPanelDivisor.setHeight("5"); scrollTable = new ScrollPanel(contentPanel); tagCloud.setStylePrimaryName("okm-cloudWrap"); flowPanelDivisor.setStyleName("okm-cloudSeparator"); table.addStyleName("okm-DisableSelect"); vPanel = new VerticalPanel(); controlPanel = new HorizontalPanel(); paginationPanel = new HorizontalPanel(); selectedKeyMap = new HashMap<String, Widget>(); multiWordSuggestKey = new MultiWordSuggestOracle(); keywordList = new ArrayList<String>(); suggestKey = new SuggestBox(multiWordSuggestKey); suggestKey.setHeight("20"); suggestKey.setText(Main.i18n("dashboard.keyword.suggest")); suggestKey.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { if ((char) KeyCodes.KEY_ENTER == event.getNativeKeyCode()) { selectKey(suggestKey.getText()); suggestKey.setText(""); } } }); suggestKey.getTextBox().addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (suggestKey.getText().equals(Main.i18n("dashboard.keyword.suggest"))) { suggestKey.setText(""); } } }); vPanel.add(controlPanel); vPanel.add(scrollTable); vPanel.add(paginationPanel); // Image control HorizontalPanel imageControlPanel = new HorizontalPanel(); HTML space1 = new HTML(); HTML space2 = new HTML(); small = new Image("img/icon/actions/description_small_disabled.gif"); small.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (table.getActualDetail() != KeyMapTable.VISIBLE_SMALL) { disableAllDetailIcons(); table.changeVisibilityDetail(KeyMapTable.VISIBLE_SMALL); small.setUrl("img/icon/actions/description_small.gif"); } } }); medium = new Image("img/icon/actions/description_medium.gif"); // It's enabled view by default medium.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (table.getActualDetail() != KeyMapTable.VISIBLE_MEDIUM) { disableAllDetailIcons(); table.changeVisibilityDetail(KeyMapTable.VISIBLE_MEDIUM); medium.setUrl("img/icon/actions/description_medium.gif"); } } }); big = new Image("img/icon/actions/description_big_disabled.gif"); big.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (table.getActualDetail() != KeyMapTable.VISIBLE_BIG) { disableAllDetailIcons(); table.changeVisibilityDetail(KeyMapTable.VISIBLE_BIG); big.setUrl("img/icon/actions/description_big.gif"); } } }); imageControlPanel.add(space1); imageControlPanel.add(small); imageControlPanel.add(medium); imageControlPanel.add(big); imageControlPanel.add(space2); imageControlPanel.setCellWidth(space1, "8"); imageControlPanel.setCellWidth(small, "21"); imageControlPanel.setCellWidth(medium, "21"); imageControlPanel.setCellWidth(big, "21"); imageControlPanel.setCellHeight(small, "20"); imageControlPanel.setCellHeight(medium, "20"); imageControlPanel.setCellHeight(big, "20"); imageControlPanel.setCellWidth(space2, "8"); imageControlPanel.setCellHorizontalAlignment(small, HasAlignment.ALIGN_CENTER); imageControlPanel.setCellHorizontalAlignment(medium, HasAlignment.ALIGN_CENTER); imageControlPanel.setCellHorizontalAlignment(big, HasAlignment.ALIGN_CENTER); imageControlPanel.setCellVerticalAlignment(small, HasAlignment.ALIGN_MIDDLE); imageControlPanel.setCellVerticalAlignment(medium, HasAlignment.ALIGN_MIDDLE); imageControlPanel.setCellVerticalAlignment(big, HasAlignment.ALIGN_MIDDLE); // KeyWords text keywordsTXT = new HTML(); keywordsTXT.setHTML("<b>" + Main.i18n("dashboard.keyword") + "</b>"); HTML space3 = new HTML(); HorizontalPanel hPanel = new HorizontalPanel(); hPanel.add(keywordsTXT); hPanel.add(space3); hPanel.setCellWidth(space3, "8"); hPanel.setCellVerticalAlignment(keywordsTXT, HasAlignment.ALIGN_MIDDLE); selectedKeyPanel = new HorizontalPanel(); suggestKeyPanel = new HorizontalPanel(); HTML space4 = new HTML(); clean = new Image("img/icon/actions/clean_disabled.gif"); clean.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (selectedKeyMap.keySet().size() > 0) { // Resets keywordPanel for (String key : selectedKeyMap.keySet()) { selectedKeyPanel.remove((Widget) selectedKeyMap.get(key)); } selectedKeyMap = new HashMap<String, Widget>(); keyAllTable.unselectAllRows(); keyTopTable.unselectAllRows(); keyRelatedTable.unselectAllRows(); keyRelatedTable.setVisible(false); table.reset(); context.setSelectedIndex(posAllContext); controlSearchIn.refreshControl(0); getKeywordMap(); // Gets related keyMap refreshClean(); } } }); clean.setTitle(Main.i18n("dashboard.keyword.clean.keywords")); suggestKeyPanel.add(suggestKey); // Always must be the last suggestKeyPanel.add(space4); suggestKeyPanel.add(clean); suggestKeyPanel.setCellWidth(space4, "8"); suggestKeyPanel.setCellWidth(clean, "21"); suggestKeyPanel.setCellHorizontalAlignment(space4, HasAlignment.ALIGN_RIGHT); suggestKeyPanel.setCellVerticalAlignment(suggestKey, HasAlignment.ALIGN_MIDDLE); suggestKeyPanel.setCellVerticalAlignment(clean, HasAlignment.ALIGN_MIDDLE); selectedKeyPanel.add(hPanel); selectedKeyPanel.add(suggestKeyPanel); // Always must be the last selectedKeyPanel.setCellVerticalAlignment(hPanel, HasAlignment.ALIGN_MIDDLE); selectedKeyPanel.setCellVerticalAlignment(suggestKeyPanel, HasAlignment.ALIGN_MIDDLE); controlPanel.add(imageControlPanel); controlPanel.add(selectedKeyPanel); controlPanel.setCellWidth(imageControlPanel, "80"); controlPanel.setCellVerticalAlignment(imageControlPanel, HasAlignment.ALIGN_MIDDLE); controlPanel.setCellVerticalAlignment(selectedKeyPanel, HasAlignment.ALIGN_MIDDLE); // Pagination HorizontalPanel internalPaginationPanel = new HorizontalPanel(); context = new ListBox(); context.setStyleName("okm-Select"); int count = 0; posTaxonomy = count++; context.addItem(Main.i18n("leftpanel.label.taxonomy"), ""); if (templatesVisible) { posTemplates = count++; context.addItem(Main.i18n("leftpanel.label.templates"), ""); } if (personalVisible) { posPersonal = count++; context.addItem(Main.i18n("leftpanel.label.my.documents"), ""); } if (mailVisible) { posMail = count++; context.addItem(Main.i18n("leftpanel.label.mail"), ""); } if (trashVisible) { posTrash = count++; context.addItem(Main.i18n("leftpanel.label.trash"), ""); } posAllContext = count++; context.addItem(Main.i18n("leftpanel.label.all.repository"), ""); context.setSelectedIndex(posAllContext); context.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { controlSearchIn.executeSearch(limit); } }); resultPage = new ListBox(); resultPage.addItem("10", "10"); resultPage.addItem("20", "20"); resultPage.addItem("30", "30"); resultPage.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { limit = Integer.valueOf(resultPage.getValue(resultPage.getSelectedIndex())); controlSearchIn.executeSearch(limit); } }); HTML space5 = new HTML(); HTML space6 = new HTML(); HTML space7 = new HTML(); resultPageTXT = new HTML(Main.i18n("search.page.results")); controlSearchIn = new ControlSearchIn(); controlSearchIn.refreshControl(0); internalPaginationPanel.add(space5); internalPaginationPanel.add(context); internalPaginationPanel.add(space6); internalPaginationPanel.add(resultPageTXT); internalPaginationPanel.add(space7); internalPaginationPanel.add(resultPage); internalPaginationPanel.setCellWidth(space5, "8"); internalPaginationPanel.setCellWidth(space6, "8"); internalPaginationPanel.setCellWidth(space7, "8"); internalPaginationPanel.setCellHorizontalAlignment(context, HasAlignment.ALIGN_LEFT); internalPaginationPanel.setCellVerticalAlignment(context, HasAlignment.ALIGN_MIDDLE); internalPaginationPanel.setCellVerticalAlignment(resultPageTXT, HasAlignment.ALIGN_MIDDLE); internalPaginationPanel.setCellVerticalAlignment(resultPage, HasAlignment.ALIGN_MIDDLE); HTML space8 = new HTML(); HTML space9 = new HTML(); paginationPanel.add(internalPaginationPanel); paginationPanel.add(space8); paginationPanel.add(controlSearchIn); paginationPanel.add(space9); paginationPanel.setCellWidth(space8, "8"); paginationPanel.setCellWidth(space9, "8"); paginationPanel.setCellHorizontalAlignment(internalPaginationPanel, HasAlignment.ALIGN_LEFT); paginationPanel.setCellVerticalAlignment(internalPaginationPanel, HasAlignment.ALIGN_MIDDLE); paginationPanel.setCellVerticalAlignment(controlSearchIn, HasAlignment.ALIGN_MIDDLE); paginationPanel.setCellHorizontalAlignment(controlSearchIn, HasAlignment.ALIGN_RIGHT); suggestKey.setStyleName("okm-KeyMap-Suggest"); suggestKey.addStyleName("okm-Input"); controlPanel.setStyleName("okm-KeyMapControl"); controlPanel.addStyleName("okm-NoWrap"); imageControlPanel.addStyleName("okm-NoWrap"); selectedKeyPanel.addStyleName("okm-NoWrap"); paginationPanel.setStyleName("okm-PaginationControl"); paginationPanel.addStyleName("okm-NoWrap"); internalPaginationPanel.addStyleName("okm-NoWrap"); keywordsTXT.addStyleName("okm-NoWrap"); resultPage.setStyleName("okm-Input"); resultPageTXT.addStyleName("okm-NoWrap"); hPanel.addStyleName("okm-NoWrap"); clean.setStyleName("okm-KeyMap-ImageHover"); small.setStyleName("okm-KeyMap-ImageHover"); medium.setStyleName("okm-KeyMap-ImageHover"); big.setStyleName("okm-KeyMap-ImageHover"); tagCloud.setStylePrimaryName("okm-cloudWrap"); VerticalPanel vKeyPanel = new VerticalPanel(); vKeyPanel.setWidth("100%"); vKeyPanel.add(keyRelatedTable); vKeyPanel.add(keyTopTable); vKeyPanel.add(keyAllTable); keyRelatedTable.setVisible(false); // By default related table is only visible when has some content horizontalSplitPanel.setRightWidget(vKeyPanel); horizontalSplitPanel.setLeftWidget(vPanel); initWidget(horizontalSplitPanel); }
From source file:com.ikon.frontend.client.widget.dashboard.keymap.KeyMapDashboard.java
License:Open Source License
/** * selects a key// w w w . jav a 2s . c o m * * @param keyword the key */ public void selectKey(final String keyword) { // Only adds keyword if not exist if (!selectedKeyMap.keySet().contains(keyword) && keyword.length() > 0 && dashboardVisible) { selectedKeyPanel.remove(suggestKeyPanel); // Always is setting the last, must be removed HorizontalPanel externalPanel = new HorizontalPanel(); HorizontalPanel hPanel = new HorizontalPanel(); HTML html = new HTML(); HTML space = new HTML(); ImageHover remove = new ImageHover("img/icon/actions/delete_disabled.gif", "img/icon/actions/delete.gif"); remove.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // remove keyword on all keyword panels keyAllTable.unselectRow(keyword); keyTopTable.unselectRow(keyword); keyRelatedTable.unselectRow(keyword); removeKey(keyword); } }); remove.setStyleName("okm-KeyMap-ImageHover"); html.setHTML(keyword); hPanel.add(html); hPanel.add(space); hPanel.add(remove); hPanel.setCellWidth(space, "6"); hPanel.setStyleName("okm-KeyMap-Selected"); hPanel.addStyleName("okm-NoWrap"); HTML space1 = new HTML(); externalPanel.add(hPanel); externalPanel.add(space1); externalPanel.setCellWidth(space1, "6"); externalPanel.addStyleName("okm-NoWrap"); selectedKeyPanel.add(externalPanel); selectedKeyPanel.add(suggestKeyPanel); // Always is setting the last selectedKeyPanel.setCellVerticalAlignment(externalPanel, HasAlignment.ALIGN_MIDDLE); selectedKeyMap.put(keyword, externalPanel); // Selects keyword on all keyword panels keyAllTable.selectRow(keyword); keyTopTable.selectRow(keyword); keyRelatedTable.selectRow(keyword); controlSearchIn.executeSearch(limit); getKeywordMap(getFiltering()); // Gets related keyMap refreshClean(); } }
From source file:com.ikon.frontend.client.widget.dashboard.keymap.KeyMapTable.java
License:Open Source License
/** * addKeywords/*from w w w .ja va2s .co m*/ * * @param table * @param keywords * @param selectedKeyList * @return */ private HorizontalPanel addKeywords(FlexTable table, Set<String> keywords, Collection<String> selectedKeyList) { int rows = table.getRowCount(); // Writing keys rows++; // Next row line HorizontalPanel hKeyPanel = new HorizontalPanel(); table.setWidget(rows, 0, hKeyPanel); table.getFlexCellFormatter().setColSpan(rows, 0, 3); table.getCellFormatter().setHorizontalAlignment(rows, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().addStyleName(rows, 0, "okm-Table-BottomBorder"); for (final String keyword : keywords) { // First adds only new keywords if (!selectedKeyList.contains(keyword)) { HorizontalPanel externalPanel = new HorizontalPanel(); HorizontalPanel hPanel = new HorizontalPanel(); HTML space = new HTML(); ImageHover add = new ImageHover("img/icon/actions/add_disabled.gif", "img/icon/actions/add.gif"); add.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // remove keyword on all keyword panels Main.get().mainPanel.dashboard.keyMapDashboard.selectKey(keyword); } }); add.setStyleName("okm-KeyMap-ImageHover"); hPanel.add(new HTML(keyword)); hPanel.add(space); hPanel.add(add); hPanel.setCellWidth(space, "6"); hPanel.setStyleName("okm-KeyMap-Gray"); HTML space1 = new HTML(); externalPanel.add(hPanel); externalPanel.add(space1); externalPanel.setCellWidth(space1, "6"); hKeyPanel.add(externalPanel); } } for (final String keyword : selectedKeyList) { // Last adding selected keywords HorizontalPanel externalPanel = new HorizontalPanel(); HorizontalPanel hPanel = new HorizontalPanel(); HTML space = new HTML(); ImageHover add = new ImageHover("img/icon/actions/delete_disabled.gif", "img/icon/actions/delete.gif"); add.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // remove keyword on all keyword panels Main.get().mainPanel.dashboard.keyMapDashboard.removeKey(keyword); } }); add.setStyleName("okm-KeyMap-ImageHover"); hPanel.add(new HTML(keyword)); hPanel.add(space); hPanel.add(add); hPanel.setCellWidth(space, "6"); hPanel.setStyleName("okm-KeyMap-Selected"); HTML space1 = new HTML(); externalPanel.add(hPanel); externalPanel.add(space1); externalPanel.setCellWidth(space1, "6"); hKeyPanel.add(externalPanel); } return hKeyPanel; }
From source file:com.ikon.frontend.client.widget.form.FormManager.java
License:Open Source License
/** * drawFormElement//ww w . jav a2 s .c om */ private void drawFormElement(int row, final GWTFormElement gwtFormElement, boolean readOnly, boolean searchView) { final String propertyName = gwtFormElement.getName(); if (gwtFormElement instanceof GWTButton) { final GWTButton gWTButton = (GWTButton) gwtFormElement; if (submitForm != null) { submitForm.setVisible(false); // Always set form hidden because there's new buttons } Button transButton = new Button(gWTButton.getLabel()); String style = Character.toUpperCase(gWTButton.getStyle().charAt(0)) + gWTButton.getStyle().substring(1); transButton.setStyleName("okm-" + style + "Button"); HTML space = new HTML(" "); submitButtonPanel.add(transButton); submitButtonPanel.add(space); submitButtonPanel.setCellWidth(space, "5px"); // Setting submit button transButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (gWTButton.getConfirmation() != null && !gWTButton.getConfirmation().equals("")) { Main.get().confirmPopup.setConfirm(ConfirmPopup.CONFIRM_WORKFLOW_ACTION); Main.get().confirmPopup.setConfirmationText(gWTButton.getConfirmation()); ValidationButton validationButton = new ValidationButton(gWTButton, singleton); Main.get().confirmPopup.setValue(validationButton); Main.get().confirmPopup.center(); } else { if (gWTButton.isValidate()) { if (validationProcessor.validate()) { if (gWTButton.getTransition().equals("")) { workflow.setTaskInstanceValues(taskInstance.getId(), null); } else { workflow.setTaskInstanceValues(taskInstance.getId(), gWTButton.getTransition()); } disableAllButtonList(); } } else { if (gWTButton.getTransition().equals("")) { workflow.setTaskInstanceValues(taskInstance.getId(), null); } else { workflow.setTaskInstanceValues(taskInstance.getId(), gWTButton.getTransition()); } disableAllButtonList(); } } } }); // Adding button to control list if (!buttonControlList.contains(transButton)) { buttonControlList.add(transButton); } } else if (gwtFormElement instanceof GWTTextArea) { HorizontalPanel hPanel = new HorizontalPanel(); TextArea textArea = new TextArea(); textArea.setEnabled((!readOnly && !((GWTTextArea) gwtFormElement).isReadonly()) || isSearchView); // read only hPanel.add(textArea); textArea.setStyleName("okm-TextArea"); textArea.setText(((GWTTextArea) gwtFormElement).getValue()); textArea.setSize(gwtFormElement.getWidth(), gwtFormElement.getHeight()); HTML text = new HTML(); // Create a widget for this property text.setHTML(((GWTTextArea) gwtFormElement).getValue().replaceAll("\n", "<br>")); hWidgetProperties.put(propertyName, hPanel); table.setHTML(row, 0, "<b>" + gwtFormElement.getLabel() + "</b>"); table.setWidget(row, 1, text); table.getCellFormatter().setVerticalAlignment(row, 0, VerticalPanel.ALIGN_TOP); table.getCellFormatter().setWidth(row, 1, "100%"); if (searchView) { final Image removeImage = new Image(OKMBundleResources.INSTANCE.deleteIcon()); removeImage.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { for (int row = 0; row < table.getRowCount(); row++) { if (table.getWidget(row, 2).equals(removeImage)) { table.removeRow(row); break; } } hWidgetProperties.remove(propertyName); hPropertyParams.remove(propertyName); formElementList.remove(gwtFormElement); search.propertyRemoved(); } }); removeImage.addStyleName("okm-Hyperlink"); table.setWidget(row, 2, removeImage); table.getCellFormatter().setVerticalAlignment(row, 2, HasAlignment.ALIGN_TOP); if (search != null) { textArea.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { search.metadataValueChanged(); } }); } setRowWordWarp(row, 3, true); } else { setRowWordWarp(row, 2, true); } } else if (gwtFormElement instanceof GWTInput) { final HorizontalPanel hPanel = new HorizontalPanel(); final TextBox textBox = new TextBox(); // Create a widget for this property textBox.setEnabled((!readOnly && !((GWTInput) gwtFormElement).isReadonly()) || isSearchView); // read only hPanel.add(textBox); String value = ""; if (((GWTInput) gwtFormElement).getType().equals(GWTInput.TYPE_TEXT) || ((GWTInput) gwtFormElement).getType().equals(GWTInput.TYPE_LINK) || ((GWTInput) gwtFormElement).getType().equals(GWTInput.TYPE_FOLDER)) { textBox.setText(((GWTInput) gwtFormElement).getValue()); value = ((GWTInput) gwtFormElement).getValue(); } else if (((GWTInput) gwtFormElement).getType().equals(GWTInput.TYPE_DATE)) { if (((GWTInput) gwtFormElement).getDate() != null) { DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.day.pattern")); textBox.setText(dtf.format(((GWTInput) gwtFormElement).getDate())); value = dtf.format(((GWTInput) gwtFormElement).getDate()); } } textBox.setWidth(gwtFormElement.getWidth()); textBox.setStyleName("okm-Input"); hWidgetProperties.put(propertyName, hPanel); table.setHTML(row, 0, "<b>" + gwtFormElement.getLabel() + "</b>"); table.setHTML(row, 1, value); if (((GWTInput) gwtFormElement).getType().equals(GWTInput.TYPE_DATE)) { final PopupPanel calendarPopup = new PopupPanel(true); final CalendarWidget calendar = new CalendarWidget(); calendar.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { calendarPopup.hide(); DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.day.pattern")); textBox.setText(dtf.format(calendar.getDate())); ((GWTInput) gwtFormElement).setDate(calendar.getDate()); if (search != null) { search.metadataValueChanged(); } } }); calendarPopup.add(calendar); final Image calendarIcon = new Image(OKMBundleResources.INSTANCE.calendar()); if (readOnly || ((GWTInput) gwtFormElement).isReadonly()) { // read only calendarIcon.setResource(OKMBundleResources.INSTANCE.calendarDisabled()); } else { calendarIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { calendarPopup.setPopupPosition(calendarIcon.getAbsoluteLeft(), calendarIcon.getAbsoluteTop() - 2); if (calendar.getDate() != null) { calendar.setNow((Date) calendar.getDate().clone()); } else { calendar.setNow(null); } calendarPopup.show(); } }); } calendarIcon.setStyleName("okm-Hyperlink"); hPanel.add(Util.hSpace("5")); hPanel.add(calendarIcon); textBox.setEnabled(false); } else if (((GWTInput) gwtFormElement).getType().equals(GWTInput.TYPE_LINK)) { if (!value.equals("")) { HorizontalPanel hLinkPanel = new HorizontalPanel(); Anchor anchor = new Anchor(value, true); final String url = value; anchor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Window.open(url, url, ""); } }); anchor.setStyleName("okm-Hyperlink"); String containerName = ((GWTInput) gwtFormElement).getName() + "ContainerName"; hLinkPanel.add(new HTML("<div id=\"" + containerName + "\"></div>\n")); HTML space = new HTML(""); hLinkPanel.add(space); hLinkPanel.add(anchor); hLinkPanel.setCellWidth(space, "5px"); table.setWidget(row, 1, hLinkPanel); Util.createLinkClipboardButton(url, containerName); } else { table.setHTML(row, 1, ""); } } else if (((GWTInput) gwtFormElement).getType().equals(GWTInput.TYPE_FOLDER)) { if (!value.equals("")) { Anchor anchor = new Anchor(); final GWTFolder folder = ((GWTInput) gwtFormElement).getFolder(); // remove first ocurrence String path = value.substring(value.indexOf("/", 1) + 1); // Looks if must change icon on parent if now has no childs and properties with user security // atention if (folder.isHasChildren()) { anchor.setHTML(Util.imageItemHTML("img/menuitem_childs.gif", path, "top")); } else { anchor.setHTML(Util.imageItemHTML("img/menuitem_empty.gif", path, "top")); } anchor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { CommonUI.openPath(folder.getPath(), null); } }); anchor.setStyleName("okm-KeyMap-ImageHover"); table.setWidget(row, 1, anchor); } else { table.setHTML(row, 1, ""); } Image pathExplorer = new Image(OKMBundleResources.INSTANCE.folderExplorer()); pathExplorer.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // when any changes is done is fired search.metadataValueChanged(); folderSelectPopup.show(textBox, search); } }); pathExplorer.setStyleName("okm-KeyMap-ImageHover"); hPanel.add(Util.hSpace("5")); hPanel.add(pathExplorer); hPanel.setCellVerticalAlignment(pathExplorer, HasAlignment.ALIGN_MIDDLE); pathExplorer.setVisible((!readOnly && !((GWTInput) gwtFormElement).isReadonly()) || isSearchView); // read only textBox.setEnabled(false); } table.getCellFormatter().setVerticalAlignment(row, 0, VerticalPanel.ALIGN_TOP); table.getCellFormatter().setWidth(row, 1, "100%"); if (searchView) { // Second date input if (((GWTInput) gwtFormElement).getType().equals(GWTInput.TYPE_DATE)) { final TextBox textBoxTo = new TextBox(); textBoxTo.setWidth(gwtFormElement.getWidth()); textBoxTo.setStyleName("okm-Input"); hPanel.add(new HTML(" ↔ ")); hPanel.add(textBoxTo); if (((GWTInput) gwtFormElement).getDateTo() != null) { DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.day.pattern")); textBoxTo.setText(dtf.format(((GWTInput) gwtFormElement).getDateTo())); } final PopupPanel calendarPopup = new PopupPanel(true); final CalendarWidget calendar = new CalendarWidget(); calendar.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { calendarPopup.hide(); DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.day.pattern")); textBoxTo.setText(dtf.format(calendar.getDate())); ((GWTInput) gwtFormElement).setDateTo(calendar.getDate()); if (search != null) { search.metadataValueChanged(); } } }); calendarPopup.add(calendar); final Image calendarIcon = new Image(OKMBundleResources.INSTANCE.calendar()); calendarIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { calendarPopup.setPopupPosition(calendarIcon.getAbsoluteLeft(), calendarIcon.getAbsoluteTop() - 2); calendarPopup.show(); } }); calendarIcon.setStyleName("okm-Hyperlink"); hPanel.add(Util.hSpace("5")); hPanel.add(calendarIcon); textBoxTo.setEnabled(false); // Clean final Image cleanIcon = new Image(OKMBundleResources.INSTANCE.cleanIcon()); cleanIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { TextBox textBox = (TextBox) hPanel.getWidget(0); textBox.setText(""); textBoxTo.setText(""); ((GWTInput) gwtFormElement).setDate(null); ((GWTInput) gwtFormElement).setDateTo(null); } }); cleanIcon.setStyleName("okm-Hyperlink"); hPanel.add(Util.hSpace("5")); hPanel.add(cleanIcon); } // Delete final Image removeImage = new Image(OKMBundleResources.INSTANCE.deleteIcon()); removeImage.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { for (int row = 0; row < table.getRowCount(); row++) { if (table.getWidget(row, 2).equals(removeImage)) { table.removeRow(row); break; } } hWidgetProperties.remove(propertyName); hPropertyParams.remove(propertyName); formElementList.remove(gwtFormElement); search.propertyRemoved(); } }); removeImage.addStyleName("okm-Hyperlink"); table.setWidget(row, 2, removeImage); table.getCellFormatter().setVerticalAlignment(row, 2, HasAlignment.ALIGN_TOP); if (search != null) { textBox.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { search.metadataValueChanged(); } }); } setRowWordWarp(row, 3, true); } else { // Clean icon ( case is not readonly ) final Image cleanIcon = new Image(OKMBundleResources.INSTANCE.cleanIcon()); cleanIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { TextBox textBox = (TextBox) hPanel.getWidget(0); textBox.setText(""); ((GWTInput) gwtFormElement).setDate(null); ((GWTInput) gwtFormElement).setFolder(new GWTFolder()); } }); cleanIcon.setStyleName("okm-Hyperlink"); hPanel.add(Util.hSpace("5")); hPanel.add(cleanIcon); cleanIcon.setVisible((!readOnly && !((GWTInput) gwtFormElement).isReadonly())); // read only setRowWordWarp(row, 2, true); } } else if (gwtFormElement instanceof GWTSuggestBox) { HorizontalPanel hPanel = new HorizontalPanel(); final GWTSuggestBox suggestBox = (GWTSuggestBox) gwtFormElement; final TextBox textBox = new TextBox(); // Create a widget for this property textBox.setWidth(gwtFormElement.getWidth()); textBox.setStyleName("okm-Input"); textBox.setReadOnly(true); textBox.setEnabled((!readOnly && !suggestBox.isReadonly()) || isSearchView); // read only final HTML hiddenKey = new HTML(""); hiddenKey.setVisible(false); if (suggestBox.getValue() != null) { hiddenKey.setHTML(suggestBox.getValue()); } hPanel.add(textBox); hPanel.add(hiddenKey); final HTML value = new HTML(""); table.setHTML(row, 0, "<b>" + gwtFormElement.getLabel() + "</b>"); table.setWidget(row, 1, value); table.getCellFormatter().setVerticalAlignment(row, 0, VerticalPanel.ALIGN_TOP); table.getCellFormatter().setWidth(row, 1, "100%"); if (textBox.isEnabled()) { final Image databaseRecordImage = new Image(OKMBundleResources.INSTANCE.databaseRecord()); databaseRecordImage.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { List<String> tables = new ArrayList<String>(); if (suggestBox.getTable() != null) { tables.add(suggestBox.getTable()); } DatabaseRecord databaseRecord = new DatabaseRecord(hiddenKey, textBox); // when any changes is done is fired search.metadataValueChanged(); DatabaseRecordSelectPopup drsPopup = new DatabaseRecordSelectPopup(suggestBox, databaseRecord, search); drsPopup.setWidth("300"); drsPopup.setHeight("220"); drsPopup.setStyleName("okm-Popup"); drsPopup.setPopupPosition(databaseRecordImage.getAbsoluteLeft(), databaseRecordImage.getAbsoluteTop() - 2); drsPopup.show(); } }); databaseRecordImage.setStyleName("okm-Hyperlink"); hPanel.add(new HTML(" ")); hPanel.add(databaseRecordImage); } hWidgetProperties.put(propertyName, hPanel); if (!suggestBox.getValue().equals("")) { textBox.setValue(suggestBox.getText()); value.setHTML(suggestBox.getText()); hiddenKey.setHTML(suggestBox.getValue()); /*List<String> tables = new ArrayList<String>(); if (suggestBox.getTable() != null) { tables.add(suggestBox.getTable()); } String formatedQuery = MessageFormat.format(suggestBox.getValueQuery(), suggestBox.getValue()); keyValueService.getKeyValues(tables, formatedQuery, new AsyncCallback<List<GWTKeyValue>>() { @Override public void onSuccess(List<GWTKeyValue> result) { if (!result.isEmpty()) { GWTKeyValue keyValue = result.get(0); textBox.setValue(keyValue.getValue()); value.setHTML(keyValue.getValue()); hiddenKey.setHTML(keyValue.getKey()); } } @Override public void onFailure(Throwable caught) { Main.get().showError("getKeyValues", caught); } }); */ } if (searchView) { final Image removeImage = new Image(OKMBundleResources.INSTANCE.deleteIcon()); removeImage.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { for (int row = 0; row < table.getRowCount(); row++) { if (table.getWidget(row, 2).equals(removeImage)) { table.removeRow(row); break; } } hWidgetProperties.remove(propertyName); hPropertyParams.remove(propertyName); formElementList.remove(gwtFormElement); search.propertyRemoved(); } }); removeImage.addStyleName("okm-Hyperlink"); table.setWidget(row, 2, removeImage); table.getCellFormatter().setVerticalAlignment(row, 2, HasAlignment.ALIGN_TOP); textBox.addKeyUpHandler( Main.get().mainPanel.search.searchBrowser.searchIn.searchControl.keyUpHandler); setRowWordWarp(row, 3, true); } else { setRowWordWarp(row, 2, true); } } else if (gwtFormElement instanceof GWTCheckBox) { CheckBox checkBox = new CheckBox(); checkBox.setEnabled((!readOnly && !((GWTCheckBox) gwtFormElement).isReadonly()) || isSearchView); // read only checkBox.setValue(((GWTCheckBox) gwtFormElement).getValue()); hWidgetProperties.put(propertyName, checkBox); table.setHTML(row, 0, "<b>" + gwtFormElement.getLabel() + "</b>"); if (checkBox.getValue()) { table.setWidget(row, 1, new Image(OKMBundleResources.INSTANCE.yes())); } else { table.setWidget(row, 1, new Image(OKMBundleResources.INSTANCE.no())); } table.getCellFormatter().setVerticalAlignment(row, 0, VerticalPanel.ALIGN_TOP); table.getCellFormatter().setWidth(row, 1, "100%"); if (searchView) { final Image removeImage = new Image(OKMBundleResources.INSTANCE.deleteIcon()); removeImage.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { for (int row = 0; row < table.getRowCount(); row++) { if (table.getWidget(row, 2).equals(removeImage)) { table.removeRow(row); break; } } hWidgetProperties.remove(propertyName); hPropertyParams.remove(propertyName); formElementList.remove(gwtFormElement); search.propertyRemoved(); } }); removeImage.addStyleName("okm-Hyperlink"); table.setWidget(row, 2, removeImage); table.getCellFormatter().setVerticalAlignment(row, 2, HasAlignment.ALIGN_TOP); if (search != null) { checkBox.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { search.metadataValueChanged(); } }); } setRowWordWarp(row, 3, true); } else { setRowWordWarp(row, 2, true); } } else if (gwtFormElement instanceof GWTSelect) { final GWTSelect gwtSelect = (GWTSelect) gwtFormElement; if (!gwtSelect.getOptionsData().equals("") && workflowVarMap.keySet().contains(gwtSelect.getOptionsData())) { gwtSelect.setOptions(getOptionsFromVariable(workflowVarMap.get(gwtSelect.getOptionsData()))); } if (gwtSelect.getType().equals(GWTSelect.TYPE_SIMPLE)) { String selectedLabel = ""; HorizontalPanel hPanel = new HorizontalPanel(); ListBox listBox = new ListBox(); listBox.setEnabled((!readOnly && !gwtSelect.isReadonly()) || isSearchView); // read only hPanel.add(listBox); listBox.setStyleName("okm-Select"); listBox.addItem("", ""); // Always we set and empty value for (GWTOption option : gwtSelect.getOptions()) { listBox.addItem(option.getLabel(), option.getValue()); if (option.isSelected()) { listBox.setItemSelected(listBox.getItemCount() - 1, true); selectedLabel = option.getLabel(); } } hWidgetProperties.put(propertyName, hPanel); table.setHTML(row, 0, "<b>" + gwtFormElement.getLabel() + "</b>"); table.setHTML(row, 1, selectedLabel); table.getCellFormatter().setWidth(row, 1, "100%"); if (searchView) { final Image removeImage = new Image(OKMBundleResources.INSTANCE.deleteIcon()); removeImage.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { for (int row = 0; row < table.getRowCount(); row++) { if (table.getWidget(row, 2).equals(removeImage)) { table.removeRow(row); break; } } hWidgetProperties.remove(propertyName); hPropertyParams.remove(propertyName); formElementList.remove(gwtFormElement); search.propertyRemoved(); } }); removeImage.addStyleName("okm-Hyperlink"); table.setWidget(row, 2, removeImage); table.getCellFormatter().setVerticalAlignment(row, 2, HasAlignment.ALIGN_TOP); if (search != null) { listBox.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { search.metadataValueChanged(); } }); } setRowWordWarp(row, 3, true); } else { setRowWordWarp(row, 2, true); } } else if (gwtSelect.getType().equals(GWTSelect.TYPE_MULTIPLE)) { final HorizontalPanel hPanel = new HorizontalPanel(); ListBox listMulti = new ListBox(); listMulti.setEnabled((!readOnly && !gwtSelect.isReadonly()) || isSearchView); // read only listMulti.setStyleName("okm-Select"); listMulti.addItem("", ""); // Always we set and empty value // Table for values FlexTable tableMulti = new FlexTable(); Button addButton = new Button(Main.i18n("button.add"), new ClickHandler() { @Override public void onClick(ClickEvent event) { HorizontalPanel hPanel = (HorizontalPanel) hWidgetProperties.get(propertyName); FlexTable tableMulti = (FlexTable) hPanel.getWidget(0); ListBox listMulti = (ListBox) hPanel.getWidget(2); Button addButton = (Button) hPanel.getWidget(4); if (listMulti.getSelectedIndex() > 0) { final HTML htmlValue = new HTML(listMulti.getValue(listMulti.getSelectedIndex())); int rowTableMulti = tableMulti.getRowCount(); Image removeImage = new Image(OKMBundleResources.INSTANCE.deleteIcon()); removeImage.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Widget sender = (Widget) event.getSource(); HorizontalPanel hPanel = (HorizontalPanel) hWidgetProperties.get(propertyName); FlexTable tableMulti = (FlexTable) hPanel.getWidget(0); ListBox listMulti = (ListBox) hPanel.getWidget(2); Button addButton = (Button) hPanel.getWidget(4); String value = htmlValue.getText(); String optionLabel = ""; for (Iterator<GWTOption> itOptions = gwtSelect.getOptions() .iterator(); itOptions.hasNext();) { GWTOption option = itOptions.next(); if (option.getValue().equals(htmlValue.getText())) { optionLabel = option.getLabel(); break; } } listMulti.addItem(optionLabel, value); listMulti.setVisible(true); addButton.setVisible(true); // Looking for row to delete for (int i = 0; i < tableMulti.getRowCount(); i++) { if (tableMulti.getWidget(i, 1).equals(sender)) { tableMulti.removeRow(i); } } if (search != null) { search.metadataValueChanged(); } } }); removeImage.setStyleName("okm-Hyperlink"); tableMulti.setWidget(rowTableMulti, 0, htmlValue); tableMulti.setWidget(rowTableMulti, 1, removeImage); tableMulti.setHTML(rowTableMulti, 2, listMulti.getItemText(listMulti.getSelectedIndex())); setRowWordWarp(tableMulti, rowTableMulti, 2, true); listMulti.removeItem(listMulti.getSelectedIndex()); htmlValue.setVisible(false); if (listMulti.getItemCount() <= 1) { listMulti.setVisible(false); addButton.setVisible(false); } if (search != null) { search.metadataValueChanged(); } } } }); addButton.setEnabled((!readOnly && !gwtSelect.isReadonly()) || isSearchView); // read only addButton.setStyleName("okm-AddButton"); hPanel.add(tableMulti); hPanel.add(new HTML(" ")); hPanel.add(listMulti); hPanel.add(new HTML(" ")); hPanel.add(addButton); hPanel.setVisible(true); listMulti.setVisible(false); addButton.setVisible(false); hPanel.setCellVerticalAlignment(tableMulti, VerticalPanel.ALIGN_TOP); hPanel.setCellVerticalAlignment(listMulti, VerticalPanel.ALIGN_TOP); hPanel.setCellVerticalAlignment(addButton, VerticalPanel.ALIGN_TOP); hPanel.setHeight("100%"); table.setHTML(row, 0, "<b>" + gwtFormElement.getLabel() + "</b>"); table.setWidget(row, 1, hPanel); table.getCellFormatter().setVerticalAlignment(row, 0, VerticalPanel.ALIGN_TOP); table.getCellFormatter().setVerticalAlignment(row, 1, VerticalPanel.ALIGN_TOP); table.getCellFormatter().setWidth(row, 1, "100%"); for (Iterator<GWTOption> itData = gwtSelect.getOptions().iterator(); itData.hasNext();) { final GWTOption option = itData.next(); // Looks if there's some selected value if (option.isSelected()) { int rowTableMulti = tableMulti.getRowCount(); HTML htmlValue = new HTML(option.getValue()); Image removeImage = new Image(OKMBundleResources.INSTANCE.deleteIcon()); // read only for this element goes at edit() logic removeImage.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Widget sender = (Widget) event.getSource(); HorizontalPanel hPanel = (HorizontalPanel) hWidgetProperties.get(propertyName); FlexTable tableMulti = (FlexTable) hPanel.getWidget(0); ListBox listMulti = (ListBox) hPanel.getWidget(2); Button addButton = (Button) hPanel.getWidget(4); listMulti.addItem(option.getLabel(), option.getValue()); listMulti.setVisible(true); addButton.setVisible(true); // Looking for row to delete for (int i = 0; i < tableMulti.getRowCount(); i++) { if (tableMulti.getWidget(i, 1).equals(sender)) { tableMulti.removeRow(i); } } if (search != null) { search.metadataValueChanged(); } } }); removeImage.setStyleName("okm-Hyperlink"); tableMulti.setWidget(rowTableMulti, 0, htmlValue); tableMulti.setWidget(rowTableMulti, 1, removeImage); tableMulti.setHTML(rowTableMulti, 2, option.getLabel()); setRowWordWarp(tableMulti, rowTableMulti, 2, true); htmlValue.setVisible(false); removeImage.setVisible(false); } else { listMulti.addItem(option.getLabel(), option.getValue()); } } // Save panel hWidgetProperties.put(propertyName, hPanel); if (searchView) { final Image removeImage = new Image(OKMBundleResources.INSTANCE.deleteIcon()); removeImage.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { for (int row = 0; row < table.getRowCount(); row++) { if (table.getWidget(row, 2).equals(removeImage)) { table.removeRow(row); break; } } hWidgetProperties.remove(propertyName); hPropertyParams.remove(propertyName); formElementList.remove(gwtFormElement); search.propertyRemoved(); } }); removeImage.addStyleName("okm-Hyperlink"); table.setWidget(row, 2, removeImage); table.getCellFormatter().setVerticalAlignment(row, 2, HasAlignment.ALIGN_TOP); // not implemented // textBox.addKeyUpHandler(Main.get().mainPanel.search.searchBrowser.searchIn.searchControl.keyUpHandler); setRowWordWarp(row, 3, true); } else { setRowWordWarp(row, 2, true); } } } else if (gwtFormElement instanceof GWTUpload) { final GWTUpload upload = (GWTUpload) gwtFormElement; HorizontalPanel hPanel = new HorizontalPanel(); FileUpload fileUpload = new FileUpload(); fileUpload.setStyleName("okm-Input"); fileUpload.getElement().setAttribute("size", "" + upload.getWidth()); final Anchor documentLink = new Anchor(); // Setting document link by uuid if (upload.getDocumentUuid() != null && !upload.getDocumentUuid().equals("")) { repositoryService.getPathByUUID(upload.getDocumentUuid(), new AsyncCallback<String>() { @Override public void onSuccess(String result) { documentService.get(result, new AsyncCallback<GWTDocument>() { @Override public void onSuccess(GWTDocument result) { final String docPath = result.getPath(); documentLink.setText(result.getName()); documentLink.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { String path = docPath.substring(0, docPath.lastIndexOf("/")); CommonUI.openPath(path, docPath); } }); } @Override public void onFailure(Throwable caught) { Main.get().showError("getDocument", caught); } }); } @Override public void onFailure(Throwable caught) { Main.get().showError("getPathByUUID", caught); } }); } documentLink.setStyleName("okm-Hyperlink"); hPanel.add(documentLink); hPanel.add(fileUpload); hWidgetProperties.put(propertyName, hPanel); table.setHTML(row, 0, "<b>" + gwtFormElement.getLabel() + "</b>"); table.setWidget(row, 1, new HTML("")); table.getCellFormatter().setVerticalAlignment(row, 0, VerticalPanel.ALIGN_TOP); table.getCellFormatter().setWidth(row, 1, "100%"); setRowWordWarp(row, 2, true); // If folderPath is null must initialize value if (upload.getFolderPath() == null || upload.getFolderPath().equals("") && upload.getFolderUuid() != null && !upload.getFolderUuid().equals("")) { repositoryService.getPathByUUID(upload.getFolderUuid(), new AsyncCallback<String>() { @Override public void onSuccess(String result) { upload.setFolderPath(result); } @Override public void onFailure(Throwable caught) { Main.get().showError("getPathByUUID", caught); } }); } } else if (gwtFormElement instanceof GWTText) { HorizontalPanel hPanel = new HorizontalPanel(); HTML title = new HTML(" " + ((GWTText) gwtFormElement).getLabel() + " "); title.setStyleName("okm-NoWrap"); hPanel.add(Util.hSpace("10")); hPanel.add(title); hPanel.setCellWidth(title, ((GWTText) gwtFormElement).getWidth()); hWidgetProperties.put(propertyName, hPanel); table.setWidget(row, 0, hPanel); table.getFlexCellFormatter().setColSpan(row, 0, 2); } else if (gwtFormElement instanceof GWTSeparator) { HorizontalPanel hPanel = new HorizontalPanel(); Image horizontalLine = new Image("img/transparent_pixel.gif"); horizontalLine.setStyleName("okm-TopPanel-Line-Border"); horizontalLine.setSize("10", "2px"); Image horizontalLine2 = new Image("img/transparent_pixel.gif"); horizontalLine2.setStyleName("okm-TopPanel-Line-Border"); horizontalLine2.setSize("100%", "2px"); HTML title = new HTML(" " + ((GWTSeparator) gwtFormElement).getLabel() + " "); title.setStyleName("okm-NoWrap"); hPanel.add(horizontalLine); hPanel.add(title); hPanel.add(horizontalLine2); hPanel.setCellVerticalAlignment(horizontalLine, HasAlignment.ALIGN_MIDDLE); hPanel.setCellVerticalAlignment(horizontalLine2, HasAlignment.ALIGN_MIDDLE); hPanel.setCellWidth(horizontalLine2, ((GWTSeparator) gwtFormElement).getWidth()); hWidgetProperties.put(propertyName, hPanel); table.setWidget(row, 0, hPanel); table.getFlexCellFormatter().setColSpan(row, 0, 2); } else if (gwtFormElement instanceof GWTDownload) { HorizontalPanel hPanel = new HorizontalPanel(); hWidgetProperties.put(propertyName, hPanel); table.setWidget(row, 0, hPanel); table.getFlexCellFormatter().setColSpan(row, 0, 2); GWTDownload download = (GWTDownload) gwtFormElement; FlexTable downloadTable = new FlexTable(); HTML description = new HTML("<b>" + gwtFormElement.getLabel() + "</b>"); downloadTable.setWidget(0, 0, description); downloadTable.getFlexCellFormatter().setColSpan(0, 0, 2); for (final GWTNode node : download.getNodes()) { int downloadTableRow = downloadTable.getRowCount(); final Anchor anchor = new Anchor("<b>" + node.getLabel() + "</b>", true); if (!node.getUuid().equals("")) { repositoryService.getPathByUUID(node.getUuid(), new AsyncCallback<String>() { @Override public void onSuccess(String result) { folderService.isValid(result, new AsyncCallback<Boolean>() { @Override public void onSuccess(Boolean result) { final boolean isFolder = result; anchor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (isFolder) { Util.downloadFileByUUID(node.getUuid(), "export"); } else { Util.downloadFileByUUID(node.getUuid(), ""); } } }); } @Override public void onFailure(Throwable caught) { Main.get().showError("getPathByUUID", caught); } }); } @Override public void onFailure(Throwable caught) { Main.get().showError("getPathByUUID", caught); } }); } else if (!node.getPath().equals("")) { repositoryService.getUUIDByPath(node.getPath(), new AsyncCallback<String>() { @Override public void onSuccess(String result) { final String uuid = result; folderService.isValid(node.getPath(), new AsyncCallback<Boolean>() { @Override public void onSuccess(Boolean result) { final boolean isFolder = result; anchor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (isFolder) { Util.downloadFileByUUID(uuid, "export"); } else { Util.downloadFileByUUID(uuid, ""); } } }); } @Override public void onFailure(Throwable caught) { Main.get().showError("getPathByUUID", caught); } }); } @Override public void onFailure(Throwable caught) { Main.get().showError("getUUIDByPath", caught); } }); } anchor.setStyleName("okm-Hyperlink"); downloadTable.setWidget(downloadTableRow, 0, new HTML(" ")); downloadTable.setWidget(downloadTableRow, 1, anchor); } hPanel.add(downloadTable); } else if (gwtFormElement instanceof GWTPrint) { HorizontalPanel hPanel = new HorizontalPanel(); hWidgetProperties.put(propertyName, hPanel); table.setWidget(row, 0, hPanel); table.getFlexCellFormatter().setColSpan(row, 0, 2); GWTPrint print = (GWTPrint) gwtFormElement; FlexTable printTable = new FlexTable(); HTML description = new HTML("<b>" + gwtFormElement.getLabel() + "</b>"); printTable.setWidget(0, 0, description); printTable.getFlexCellFormatter().setColSpan(0, 0, 2); for (final GWTNode node : print.getNodes()) { int downloadTableRow = printTable.getRowCount(); final Button downloadButton = new Button(Main.i18n("button.print")); if (!node.getUuid().equals("")) { downloadButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Window.alert("Not available"); } }); } else if (!node.getPath().equals("")) { repositoryService.getUUIDByPath(node.getPath(), new AsyncCallback<String>() { @Override public void onSuccess(String result) { //final String uuid = result; downloadButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Window.alert("Not available"); } }); } @Override public void onFailure(Throwable caught) { Main.get().showError("getUUIDByPath", caught); } }); } downloadButton.setStyleName("okm-DownloadButton"); printTable.setWidget(downloadTableRow, 0, new HTML(" " + node.getLabel() + " ")); printTable.setWidget(downloadTableRow, 1, downloadButton); } hPanel.add(printTable); } }
From source file:com.ikon.frontend.client.widget.popup.KeywordsPopup.java
License:Open Source License
/** * Get a new widget keyword// ww w.j a v a2s . c o m * * @param keyword The keyword * @return The widget */ private HorizontalPanel getKeyWidget(final String keyword, boolean remove) { final HorizontalPanel externalPanel = new HorizontalPanel(); HorizontalPanel hPanel = new HorizontalPanel(); HTML space = new HTML(); ImageHover delete = new ImageHover("img/icon/actions/delete_disabled.gif", "img/icon/actions/delete.gif"); delete.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { removeKey(keyword); hKeyPanel.remove(externalPanel); } }); delete.setStyleName("okm-KeyMap-ImageHover"); hPanel.add(new HTML(keyword)); hPanel.add(space); if (remove) { hPanel.add(delete); } hPanel.setCellWidth(space, "6"); hPanel.setStyleName("okm-KeyMap-Gray"); HTML space1 = new HTML(); externalPanel.add(hPanel); externalPanel.add(space1); externalPanel.setCellWidth(space1, "6"); externalPanel.setStylePrimaryName("okm-cloudTags"); return externalPanel; }
From source file:com.ikon.frontend.client.widget.properties.KeywordManager.java
License:Open Source License
/** * Get a new widget keyword//from ww w.ja v a 2 s . c o m * * @param keyword The keyword * * @return The widget */ private HorizontalPanel getKeyWidget(final String keyword, boolean remove) { final HorizontalPanel externalPanel = new HorizontalPanel(); HorizontalPanel hPanel = new HorizontalPanel(); HTML space = new HTML(); ImageHover delete = new ImageHover("img/icon/actions/delete_disabled.gif", "img/icon/actions/delete.gif"); delete.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { KeywordToRemove ktr = new KeywordToRemove(externalPanel, keyword); if (object instanceof GWTDocument) { Main.get().confirmPopup.setConfirm(ConfirmPopup.CONFIRM_DELETE_KEYWORD_DOCUMENT); } else if (object instanceof GWTFolder) { Main.get().confirmPopup.setConfirm(ConfirmPopup.CONFIRM_DELETE_KEYWORD_FOLDER); } else if (object instanceof GWTMail) { Main.get().confirmPopup.setConfirm(ConfirmPopup.CONFIRM_DELETE_KEYWORD_MAIL); } Main.get().confirmPopup.setValue(ktr); Main.get().confirmPopup.show(); } }); delete.setStyleName("okm-KeyMap-ImageHover"); hPanel.add(new HTML(keyword)); hPanel.add(space); if (remove && removeKeywordEnabled) { hPanel.add(delete); } hPanel.setCellWidth(space, "6"); hPanel.setStyleName("okm-KeyMap-Gray"); HTML space1 = new HTML(); externalPanel.add(hPanel); externalPanel.add(space1); externalPanel.setCellWidth(space1, "6"); externalPanel.setStylePrimaryName("okm-cloudTags"); return externalPanel; }
From source file:com.ikon.frontend.client.widget.properties.Notes.java
License:Open Source License
/** * Writes the note /*from ww w. ja v a 2 s. c o m*/ * * @param note */ private void writeNote(final GWTNote note) { int row = tableNotes.getRowCount(); tableNotes.setHTML(row, 0, "<b>" + note.getUser().getUsername() + "</b>"); Image editNote = new Image(OKMBundleResources.INSTANCE.noteEdit()); Image deleteNote = new Image(OKMBundleResources.INSTANCE.noteDelete()); editNote.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { reset(); isEditingNote = true; addButton.setVisible(false); updateButton.setVisible(true); cancelButton.setVisible(true); editedNoteRow = tableNotes.getCellForEvent(event).getRowIndex() + 2; // The text row is + 2 editedNotePath = note.getPath(); setTextNoteToEditor(tableNotes.getHTML(editedNoteRow, 0)); } }); deleteNote.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { switch (type) { case DOCUMENT_NOTE: Main.get().confirmPopup.setConfirm(ConfirmPopup.CONFIRM_DELETE_NOTE_DOCUMENT); break; case FOLDER_NOTE: Main.get().confirmPopup.setConfirm(ConfirmPopup.CONFIRM_DELETE_NOTE_FOLDER); break; case MAIL_NOTE: Main.get().confirmPopup.setConfirm(ConfirmPopup.CONFIRM_DELETE_NOTE_MAIL); break; } NoteToDelete noteToDelete = new NoteToDelete(note.getPath(), tableNotes.getCellForEvent(event).getRowIndex()); Main.get().confirmPopup.setValue(noteToDelete); Main.get().confirmPopup.show(); } }); editNote.setStyleName("okm-Hyperlink"); deleteNote.setStyleName("okm-Hyperlink"); DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.date.pattern")); HTML space = new HTML(""); HTML space2 = new HTML(""); HTML date = new HTML(dtf.format(note.getDate())); HorizontalPanel hPanel = new HorizontalPanel(); hPanel.add(editNote); hPanel.add(space); if (removeNoteEnabled) { hPanel.add(deleteNote); } hPanel.add(space2); hPanel.add(date); hPanel.setCellWidth(space, "5"); hPanel.setCellWidth(space2, "5"); if (note.getAuthor().equals(Main.get().workspaceUserProperties.getUser().getId())) { if (visibleButtons || addNoteOption) { editNote.setVisible(true); } else { editNote.setVisible(false); } } else { editNote.setVisible(false); } if (note.getAuthor().equals(Main.get().workspaceUserProperties.getUser().getId()) || (Main.get().workspaceUserProperties.getWorkspace() != null && Main.get().workspaceUserProperties.getWorkspace().isAdminRole())) { if (visibleButtons || addNoteOption) { deleteNote.setVisible(true); } else { deleteNote.setVisible(false); } } else { deleteNote.setVisible(false); } tableNotes.setWidget(row, 1, hPanel); tableNotes.getCellFormatter().setHorizontalAlignment(row, 1, HasAlignment.ALIGN_RIGHT); tableNotes.getRowFormatter().setStyleName(row, "okm-Notes-Title"); tableNotes.getCellFormatter().setHeight(row, 1, "30"); tableNotes.getCellFormatter().setVerticalAlignment(row, 0, HasAlignment.ALIGN_BOTTOM); tableNotes.getCellFormatter().setVerticalAlignment(row, 1, HasAlignment.ALIGN_BOTTOM); row++; tableNotes.setHTML(row, 0, ""); tableNotes.getCellFormatter().setHeight(row, 0, "6"); tableNotes.getRowFormatter().setStyleName(row, "okm-Notes-Line"); tableNotes.getFlexCellFormatter().setColSpan(row, 0, 2); row++; tableNotes.setHTML(row, 0, note.getText()); tableNotes.getFlexCellFormatter().setColSpan(row, 0, 2); }
From source file:com.ikon.frontend.client.widget.searchresult.SearchFullResult.java
License:Open Source License
/** * drawPropertyGroups// w ww .j ava2 s . co m * * @param docPath * @param propertyGroups * @param propertyGroupsPanel */ private void drawPropertyGroups(final String docPath, final List<GWTPropertyGroup> propertyGroups, final HorizontalPanel propertyGroupsPanel) { if (propertyGroups.size() > 0) { Status status = Main.get().mainPanel.search.searchBrowser.searchResult.status; status.setFlag_refreshPropertyGroups(); final GWTPropertyGroup propertyGroup = propertyGroups.remove(0); propertyGroupService.getProperties(docPath, propertyGroup.getName(), new AsyncCallback<List<GWTFormElement>>() { @Override public void onSuccess(List<GWTFormElement> result) { if (propertyGroupsPanel.getWidgetCount() == 0) { HTML label = new HTML(""); label.setStyleName("okm-Security-Title"); label.setHeight("15"); Image verticalLine = new Image("img/transparent_pixel.gif"); verticalLine.setStyleName("okm-Vertical-Line-Border"); verticalLine.setSize("2", "100%"); VerticalPanel vlPanel = new VerticalPanel(); vlPanel.add(label); vlPanel.add(verticalLine); vlPanel.setCellWidth(verticalLine, "7"); vlPanel.setCellHeight(verticalLine, "100%"); vlPanel.setHeight("100%"); propertyGroupsPanel.add(vlPanel); propertyGroupsPanel.setCellHorizontalAlignment(vlPanel, HasAlignment.ALIGN_LEFT); propertyGroupsPanel.setCellWidth(vlPanel, "7"); propertyGroupsPanel.setCellHeight(vlPanel, "100%"); } Image verticalLine = new Image("img/transparent_pixel.gif"); verticalLine.setStyleName("okm-Vertical-Line-Border"); verticalLine.setSize("2", "100%"); FormManager manager = new FormManager(); manager.setFormElements(result); manager.draw(true); // read only ! VerticalPanel vPanel = new VerticalPanel(); HTML label = new HTML(propertyGroup.getLabel()); label.setStyleName("okm-Security-Title"); label.setHeight("15"); vPanel.add(label); vPanel.add(manager.getTable()); propertyGroupsPanel.add(vPanel); propertyGroupsPanel.add(verticalLine); propertyGroupsPanel.setCellVerticalAlignment(vPanel, HasAlignment.ALIGN_TOP); propertyGroupsPanel.setCellHorizontalAlignment(verticalLine, HasAlignment.ALIGN_CENTER); propertyGroupsPanel.setCellWidth(verticalLine, "12"); propertyGroupsPanel.setCellHeight(verticalLine, "100%"); drawPropertyGroups(docPath, propertyGroups, propertyGroupsPanel); } @Override public void onFailure(Throwable caught) { Main.get().showError("drawPropertyGroups", caught); } }); } else { Status status = Main.get().mainPanel.search.searchBrowser.searchResult.status; status.unsetFlag_refreshPropertyGroups(); } }