Example usage for com.google.gwt.user.client.ui HTMLPanel createUniqueId

List of usage examples for com.google.gwt.user.client.ui HTMLPanel createUniqueId

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui HTMLPanel createUniqueId.

Prototype

public static String createUniqueId() 

Source Link

Document

A helper method for creating unique IDs for elements within dynamically- generated HTML.

Usage

From source file:org.kuali.student.common.ui.client.widgets.field.layout.element.FieldElement.java

License:Educational Community License

private void generateLayout(String key, String title, String helpText, String instructText, String examplesText,
        String constraintText, Widget widget) {
    this.setKey(key);
    fieldName = title;/* w w  w.  j  a  va 2  s  .  co  m*/
    fieldHTMLId = HTMLPanel.createUniqueId();
    fieldTitle = new LabelPanel(title, fieldHTMLId);
    required.setVisible(false);
    fieldTitle.add(required);
    if (helpText != null) {
        this.setHelp(helpText);
    } else {
        help.setVisible(false);
    }
    fieldTitle.add(help);
    layout.add(fieldTitle);
    if (instructText != null) {
        this.setInstructions(instructText);
    } else {
        instructions.setVisible(false);
    }
    if (examplesText != null) {
        this.setExamples(examplesText);
    } else {
        examplesButton.setVisible(false);
    }
    if (constraintText != null) {
        this.setConstraintText(constraintText);
    } else {
        constraints.setVisible(false);
    }
    instructions.setStyleName("ks-form-module-elements-instruction");
    layout.add(instructions);
    instructions.add(examplesButton);
    layout.add(widgetSpan);
    constraints.setStyleName("ks-form-module-elements-help-text");
    layout.add(constraints);
    initWidget(layout);
    layout.addStyleName("ks-form-module-elements");
    layout.addStyleName("ks-form-module-single-line-margin");
    layout.ensureDebugId(DebugIdUtils.createWebDriverSafeDebugId(key != null ? key : title));
    //Set the widget here to ensure the debug Ids are set properly
    if (widget != null) {
        this.setWidget(widget);
    }
}

From source file:org.kuali.student.common.ui.client.widgets.field.layout.element.FieldElement.java

License:Educational Community License

@Override
public void setKey(String key) {
    if (key == null) {
        //TODO better way to generate unique id here?
        key = HTMLPanel.createUniqueId();
    }//from  w ww. j  a  v  a 2  s .  co m
    this.fieldKey = key;
}

From source file:org.kuali.student.common.ui.client.widgets.StylishDropDown.java

License:Educational Community License

protected void init() {
    layout.clear();/*  w w  w . ja  v  a2s.  c o  m*/
    layout.setWidth("100%");
    layout.add(titleLayout);
    layout.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    layout.add(defaultArrow);

    namePanel.setWidget(layout);
    menu.addGlobalMenuItemSelectCallback(new Callback<KSMenuItemData>() {

        @Override
        public void exec(KSMenuItemData item) {
            if (item.getClickHandler() != null) {
                StylishDropDown.this.hideMenu();
                if (showSelectedItem) {
                    titleLabel.setText(item.getLabel());
                    if (item.getShownIcon() != null && showTitleIcon) {
                        titleLayout.remove(titleImage);
                        Image image = item.getShownIcon();
                        titleImage = new Image(image.getUrl(), image.getOriginLeft(), image.getOriginTop(),
                                image.getWidth(), image.getHeight());
                        if (imgLoc == MenuImageLocation.RIGHT) {
                            titleLayout.add(titleImage);
                        } else {
                            titleLayout.insert(titleImage, 0);
                        }

                    }
                }
            }
        }
    });
    menuPanel.setWidget(menu);
    namePanel.addClickHandler(panelHandler);
    namePanel.addKeyDownHandler(downHandler);
    namePanel.addFocusHandler(focusHandler);
    namePanel.addMouseOverHandler(mouseOverHandler);
    namePanel.addMouseOutHandler(mouseOutHandler);
    namePanel.setTabIndex(1);
    menuPanel.setAutoHideEnabled(true);
    menuPanel.addAutoHidePartner(namePanel.getElement());
    namePanel.getElement().setAttribute("id", HTMLPanel.createUniqueId());
    parentPanel.add(namePanel);
    this.initWidget(parentPanel);
    titleLabel.addStyleName("KS-CustomDropDown-TitleLabel");
    layout.addStyleName("KS-CustomDropDown-TitlePanel");
    defaultArrow.addStyleName("KS-CustomDropDown-Arrow");
}

From source file:org.kuali.student.lum.common.client.lo.LOCategoryBuilder.java

License:Educational Community License

public LOCategoryBuilder(String messageGroup, String type, String state, String loRepoKey) {
    super();//from ww  w  .j  a  v  a  2s  .c om

    this.type = type;
    this.state = state;
    this.repoKey = loRepoKey;
    this.messageGroup = messageGroup;

    loCatRpcServiceAsync = GWT.create(LoCategoryRpcService.class);
    picker = new LOCategoryPicker();
    categoryList = new LOCategoryListNew();

    initWidget(root);

    final FlowPanel selectedPanel = new FlowPanel();
    selectedPanel.setStyleName("KS-LOSelectedCategories");
    addButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            addEnteredCategory();
        }
    });
    browseCategoryLink = new Anchor(getLabelText(LUUIConstants.LO_CATEGORY_BROWSE_LABEL_KEY));
    browseCategoryLink.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            // Filter out any categories already in the picker
            List<LoCategoryInfo> categoriesInPicker = categoryList.getValue();
            /*Category Management has a CategoryManagementTable -> has a DefaultTableModel -> has rowList 
             *                                                                      of category rows that go in mainPanel FlowPanel
             *                                                                                      in 'Select Categories' pop KSLightBox*/
            final CategoryManagement categoryManagement = new CategoryManagement(true, true,
                    categoriesInPicker);
            categoryManagement.setDeleteButtonEnabled(false);
            categoryManagement.setInsertButtonEnabled(false);
            categoryManagement.setUpdateButtonEnabled(false);

            final KSLightBox pop = new KSLightBox();
            pop.setMaxWidth(600);
            pop.setMaxHeight(750);
            KSButton addButton = new KSButton("Add");
            KSButton cancelButton = new KSButton("Cancel", ButtonStyle.ANCHOR_LARGE_CENTERED);

            pop.addButton(addButton);
            pop.addButton(cancelButton);

            pop.setNonCaptionHeader(SectionTitle
                    .generateH2Title(getLabelText(LUUIConstants.LO_CATEGORY_BROWSE_POPUP_LABEL_KEY)));
            FlowPanel mainPanel = new FlowPanel();
            mainPanel.add(categoryManagement);

            addButton.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    List<LoCategoryInfo> list = categoryManagement.getSelectedCategoryList();
                    for (LoCategoryInfo info : list) {
                        addCategory(info); //I think this adds categories selected from choices in 'Select Categories' pop KSLightBox to an LO
                    }
                    pop.hide();
                }
            });

            cancelButton.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    pop.hide();
                }
            });

            pop.setWidget(mainPanel);
            pop.show();

        }
    });

    VerticalPanel main = new VerticalPanel();
    HorizontalPanel suggestPanel = new HorizontalPanel();
    suggestPanel.add(picker);
    suggestPanel.add(addButton);

    VerticalPanel suggestAndBrowsePanel = new VerticalPanel();
    suggestAndBrowsePanel.add(suggestPanel);
    suggestAndBrowsePanel.add(browseCategoryLink);

    selectedPanel.add(categoryList);

    String fieldHTMLId = HTMLPanel.createUniqueId();
    String title = getLabelText(LUUIConstants.LO_CATEGORY_KEY);
    String helpText = getLabelText(LUUIConstants.LO_CATEGORY_KEY + FieldLayoutComponent.HELP_MESSAGE_KEY);
    LabelPanel fieldTitle = new LabelPanel(title, fieldHTMLId);

    if (helpText != null) {
        setHelp(helpText);
    } else {
        help.setVisible(false);
    }

    fieldTitle.add(help);
    main.add(fieldTitle);
    main.add(suggestAndBrowsePanel);
    main.add(selectedPanel);
    root.add(main);

    main.addStyleName("KS-LOCategoryPicker");
    addButton.addStyleName("KS-LOCategoryPicker-Button");

}

From source file:org.opencms.ade.containerpage.client.ui.CmsGroupcontainerEditor.java

License:Open Source License

/**
 * Constructor.<p>/*  w ww.  j  a  v  a  2  s.  c  om*/
 * 
 * @param groupContainer the group-container
 * @param controller the container-page controller
 * @param handler the container-page handler
 */
private CmsGroupcontainerEditor(CmsGroupContainerElementPanel groupContainer,
        CmsContainerpageController controller, CmsContainerpageHandler handler) {

    m_controller = controller;
    m_editorWidget = uiBinder.createAndBindUi(this);
    initWidget(m_editorWidget);
    m_overlayDiv.getStyle().setZIndex(I_CmsLayoutBundle.INSTANCE.constants().css().zIndexHighlighting());
    m_labelDescription.setText(Messages.get().key(Messages.GUI_GROUPCONTAINER_LABEL_DESCRIPTION_0));
    m_labelTitle.setText(Messages.get().key(Messages.GUI_GROUPCONTAINER_LABEL_TITLE_0));
    m_editorId = HTMLPanel.createUniqueId();
    m_editorWidget.getElement().setId(m_editorId);
    m_groupContainer = groupContainer;
    m_backUpElements = new ArrayList<CmsContainerPageElementPanel>();
    Iterator<Widget> it = m_groupContainer.iterator();
    while (it.hasNext()) {
        Widget w = it.next();
        if (w instanceof CmsContainerPageElementPanel) {
            m_backUpElements.add((CmsContainerPageElementPanel) w);
        }
    }
    m_parentContainer = (CmsContainerPageContainer) m_groupContainer.getParentTarget();
    m_groupContainerPosition = CmsPositionBean.generatePositionInfo(m_groupContainer);
    m_editingPlaceholder = createPlaceholder(m_groupContainer.getElement());
    m_groupContainer.setEditingPlaceholder(m_editingPlaceholder);
    m_groupContainer.setEditingMarker(m_containerMarker);
    m_indexPosition = m_parentContainer.getWidgetIndex(m_groupContainer);
    // inserting placeholder element
    m_parentContainer.getElement().insertBefore(m_editingPlaceholder, m_groupContainer.getElement());
    m_editorWidget.add(m_groupContainer, m_editorId);
    Style style = m_groupContainer.getElement().getStyle();
    style.setPosition(Position.ABSOLUTE);
    style.setLeft(m_groupContainerPosition.getLeft(), Unit.PX);
    style.setTop(m_groupContainerPosition.getTop(), Unit.PX);
    style.setWidth(m_groupContainerPosition.getWidth(), Unit.PX);
    style.setZIndex(I_CmsLayoutBundle.INSTANCE.constants().css().zIndexGroupContainer());
    m_containerMarker.getStyle().setLeft(m_groupContainerPosition.getLeft() - 3, Unit.PX);
    m_containerMarker.getStyle().setTop(m_groupContainerPosition.getTop() - 4, Unit.PX);
    m_containerMarker.getStyle().setWidth(m_groupContainerPosition.getWidth() + 4, Unit.PX);
    m_containerMarker.getStyle().setHeight(m_groupContainerPosition.getHeight() + 4, Unit.PX);
    m_groupContainer.getElementOptionBar().setVisible(false);
    m_groupContainer.getElementOptionBar()
            .removeStyleName(I_CmsToolbarButtonLayoutBundle.INSTANCE.toolbarButtonCss().cmsHovering());

    RootPanel.get().addStyleName(I_CmsLayoutBundle.INSTANCE.containerpageCss().groupcontainerEditing());

    // Loading data of all contained elements including group-container element
    m_controller.getElements(getElementIds(), new I_CmsSimpleCallback<Map<String, CmsContainerElementData>>() {

        public void execute(Map<String, CmsContainerElementData> arg) {

            setGroupContainerData(arg);
        }
    });
}

From source file:org.opencms.ade.containerpage.client.ui.groupeditor.A_CmsGroupEditor.java

License:Open Source License

/**
 * Constructor.<p>// w w  w .  ja v  a  2 s.c  o  m
 *
 * @param groupContainer the group-container
 * @param controller the container-page controller
 * @param handler the container-page handler
 */
protected A_CmsGroupEditor(CmsGroupContainerElementPanel groupContainer, CmsContainerpageController controller,
        CmsContainerpageHandler handler) {

    m_controller = controller;
    m_handler = handler;
    m_editorWidget = uiBinder.createAndBindUi(this);
    initWidget(m_editorWidget);
    m_editorId = HTMLPanel.createUniqueId();
    m_editorWidget.getElement().setId(m_editorId);
    m_groupContainer = groupContainer;
    m_backUpElements = new ArrayList<CmsContainerPageElementPanel>();
    Iterator<Widget> it = m_groupContainer.iterator();
    while (it.hasNext()) {
        Widget w = it.next();
        if (w instanceof CmsContainerPageElementPanel) {
            m_backUpElements.add((CmsContainerPageElementPanel) w);
        }
    }
    m_parentContainer = (CmsContainerPageContainer) m_groupContainer.getParentTarget();
    m_groupContainerPosition = CmsPositionBean.getBoundingClientRect(m_groupContainer.getElement());
    m_editingPlaceholder = createPlaceholder(m_groupContainer.getElement());
    m_groupContainer.setEditingPlaceholder(m_editingPlaceholder);
    m_groupContainer.setEditingMarker(m_containerMarker);
    m_indexPosition = m_parentContainer.getWidgetIndex(m_groupContainer);
    // inserting placeholder element
    m_parentContainer.getElement().insertBefore(m_editingPlaceholder, m_groupContainer.getElement());
    m_editorWidget.add(m_groupContainer, m_editorId);
    Style style = m_groupContainer.getElement().getStyle();
    style.setPosition(Position.ABSOLUTE);
    style.setLeft(m_groupContainerPosition.getLeft(), Unit.PX);
    style.setTop(m_groupContainerPosition.getTop(), Unit.PX);
    style.setWidth(m_groupContainerPosition.getWidth(), Unit.PX);
    style.setZIndex(I_CmsLayoutBundle.INSTANCE.constants().css().zIndexGroupContainer());
    m_containerMarker.getStyle().setLeft(m_groupContainerPosition.getLeft() - 3, Unit.PX);
    m_containerMarker.getStyle().setTop(m_groupContainerPosition.getTop() - 4, Unit.PX);
    m_containerMarker.getStyle().setWidth(m_groupContainerPosition.getWidth() + 4, Unit.PX);
    m_containerMarker.getStyle().setHeight(m_groupContainerPosition.getHeight() + 4, Unit.PX);
    m_containerMarker.getStyle()
            .setBackgroundColor(CmsDomUtil.getEffectiveBackgroundColor(m_parentContainer.getElement()));
    m_groupContainer.getElementOptionBar().setVisible(false);
    m_groupContainer.getElementOptionBar()
            .removeStyleName(I_CmsToolbarButtonLayoutBundle.INSTANCE.toolbarButtonCss().cmsHovering());

    RootPanel.get().addStyleName(I_CmsLayoutBundle.INSTANCE.containerpageCss().groupcontainerEditing());
    addInputFields();
    m_editorDialog = new CmsPopup();
    addButtons();
    if (m_saveButton != null) {
        m_saveButton.disable(Messages.get().key(Messages.GUI_GROUPCONTAINER_LOADING_DATA_0));
    }
    m_editorDialog.setGlassEnabled(false);
    m_editorDialog.setModal(false);
    m_editorDialog.addDialogClose(new Command() {

        /**
         * @see com.google.gwt.user.client.Command#execute()
         */
        public void execute() {

            cancelEdit();
        }
    });
}

From source file:org.opencms.ade.galleries.client.ui.CmsGalleryDialog.java

License:Open Source License

/**
 * The default constructor for the gallery dialog.<p>
 *  /*ww  w  .j  a  v  a  2s.  co  m*/
 * @param style the style for the panel
 */
public CmsGalleryDialog(CmsTabbedPanelStyle style) {

    initCss();

    m_isInitialSearch = false;
    // parent widget
    m_parentPanel = new FlowPanel();
    m_parentPanel.setStyleName(I_CmsLayoutBundle.INSTANCE.galleryDialogCss().parentPanel());
    m_dialogElementId = HTMLPanel.createUniqueId();
    m_parentPanel.getElement().setId(m_dialogElementId);
    // set the default height of the dialog
    m_parentPanel.getElement().getStyle().setHeight((DIALOG_HEIGHT), Unit.PX);
    // tabs
    m_tabbedPanel = new CmsTabbedPanel<A_CmsTab>(style);
    // add tabs to parent widget
    m_parentPanel.add(m_tabbedPanel);
    m_showPreview = new CmsPushButton();
    m_showPreview.setText(Messages.get().key(Messages.GUI_PREVIEW_BUTTON_SHOW_0));
    m_showPreview.addStyleName(I_CmsLayoutBundle.INSTANCE.galleryDialogCss().showPreview());
    m_showPreview.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {

            m_parentPanel.removeStyleName(I_CmsLayoutBundle.INSTANCE.previewDialogCss().hidePreview());
        }
    });
    m_showPreview.setVisible(false);
    m_parentPanel.add(m_showPreview);
    // All composites must call initWidget() in their constructors.
    initWidget(m_parentPanel);
    addResizeHandler(this);
}

From source file:org.opencms.ade.sitemap.client.ui.CmsPage.java

License:Open Source License

/**
 * Returns this panel's unique id.<p>
 * /*from  ww w . j  av a 2 s. c  o  m*/
 * @return this panel's unique id
 */
protected String ensureId() {

    if (m_id == null) {
        m_id = HTMLPanel.createUniqueId();
        m_panel.getElement().setId(m_id);
    }
    return m_id;
}

From source file:org.opencms.gwt.client.ui.input.location.CmsLocationPicker.java

License:Open Source License

/**
 * Constructor.<p>//from  w  w w  .ja va2  s . co m
 *
 * @param configuration the widget configuration
 **/
public CmsLocationPicker(String configuration) {

    I_CmsLayoutBundle.INSTANCE.locationPickerCss().ensureInjected();
    m_openerButton = new CmsPushButton();
    m_openerButton.setButtonStyle(ButtonStyle.FONT_ICON, null);
    m_openerButton.setImageClass(I_CmsButton.GALLERY);
    m_openerButton.setSize(Size.small);
    m_openerButton.setTitle(Messages.get().key(Messages.GUI_LOCATION_DIALOG_TITLE_0));
    initWidget(uiBinder.createAndBindUi(this));
    // disable input, the picker popup is used for editing the value
    m_textbox.setEnabled(false);
    m_locationInfoPanel.getStyle().setDisplay(Display.NONE);
    m_controller = new CmsLocationController(this, configuration);
    m_mapPreview.setId(HTMLPanel.createUniqueId());
}

From source file:org.opencms.gwt.client.ui.input.location.CmsLocationPopupContent.java

License:Open Source License

/**
 * Constructor.<p>/*from   w w  w .  j  a v a  2  s  .  c  om*/
 *
 * @param controller the location controller
 * @param addressOracle the address suggest oracle to use for the address suggest box
 * @param modeItems the available map modes
 * @param typeItems the available map types
 * @param zoomItems the available zoom levels
 */
public CmsLocationPopupContent(CmsLocationController controller, SuggestOracle addressOracle,
        Map<String, String> modeItems, Map<String, String> typeItems, Map<String, String> zoomItems) {

    // create fields annotated as provided before running the ui-binder
    m_addressField = new CmsSuggestBox(addressOracle);
    m_modeField = new CmsSelectBox(modeItems);
    m_typeField = new CmsSelectBox(typeItems);
    m_zoomField = new CmsSelectBox(zoomItems);
    initWidget(uiBinder.createAndBindUi(this));
    m_controller = controller;
    m_mapCanvas.setId(HTMLPanel.createUniqueId());
    initLabels();
    initFields();
}