Java 类com.google.gwt.user.client.ui.UIObject 实例源码

项目:unitimes    文件:FilterBox.java   
private void position(final UIObject relativeObject, int offsetWidth, int offsetHeight) {
    int textBoxOffsetWidth = relativeObject.getOffsetWidth();
    int offsetWidthDiff = offsetWidth - textBoxOffsetWidth;
    int left = relativeObject.getAbsoluteLeft();
    if (offsetWidthDiff > 0) {
        int windowRight = Window.getClientWidth() + Window.getScrollLeft();
        int windowLeft = Window.getScrollLeft();
        int distanceToWindowRight = windowRight - left;
        int distanceFromWindowLeft = left - windowLeft;
        if (distanceToWindowRight < offsetWidth && distanceFromWindowLeft >= offsetWidthDiff) {
            left -= offsetWidthDiff;
        }
    }
    int top = relativeObject.getAbsoluteTop();
    int windowTop = Window.getScrollTop();
    int windowBottom = Window.getScrollTop() + Window.getClientHeight();
    int distanceFromWindowTop = top - windowTop;
    int distanceToWindowBottom = windowBottom - (top + relativeObject.getOffsetHeight());
    if (distanceToWindowBottom < offsetHeight && distanceFromWindowTop >= offsetHeight) {
        top -= offsetHeight;
    } else {
        top += relativeObject.getOffsetHeight();
    }
    setPopupPosition(left, top);
}
项目:walkaround    文件:UploadFormPopup.java   
/**
 * Creates an upload popup.
 */
public UploadFormPopup() {
  form = BINDER.createAndBindUi(this);

  PopupChrome chrome = PopupChromeFactory.createPopupChrome();
  chrome.enableTitleBar();
  popup = PopupFactory.createPopup(null, new CenterPopupPositioner(), chrome, false);
  popup.getTitleBar().setTitleText("Upload attachment");
  popup.add(form);

  iframe = Document.get().createIFrameElement();
  iframe.setName("_uploadform" + iframeId++);
  // HACK(danilatos): Prevent browser from caching due to whatever reason
  iframe.setSrc("/uploadform?nocache=" + Duration.currentTimeMillis());
  form.getElement().setAttribute("target", iframe.getName());

  onloadRegistration =
      DomHelper.registerEventHandler(iframe, "load", new JavaScriptEventListener() {
        @Override
        public void onJavaScriptEvent(String name, Event event) {
          onIframeLoad();
        }
      });
  UIObject.setVisible(iframe, false);
}
项目:Wiab.pro    文件:WebClient.java   
private void setupWavePanel() {
  // Hide the frame until waves start getting opened
  UIObject.setVisible(waveFrame.getElement(), false);

  Document.get().getElementById(SIGNOUT_ELEMENT_ID).setInnerText(messages.signout());

  // Handles opening waves.
  ClientEvents.get().addWaveSelectionEventHandler(new WaveSelectionEventHandler() {

    @Override
    public void onSelection(WaveRef waveRef, boolean ctrlDown, boolean altDown) {
      // Ctrl or Alt isn't pressed => open wave with diffs
      closeAndOpenWave(new OpenWaveData(waveRef, false, null, !ctrlDown && !altDown));
    }
  });

  waveFrame.getElement().setId(WAVE_ELEMENT_ID);
}
项目:gwt-material    文件:MaterialWidgetTestCase.java   
protected <H extends UIObject & HasEnabled> void checkEnabled(HasEnabled widget, H target, boolean checkElement) {
    final Element element = target.getElement();
    if(checkElement) {
        assertFalse(element.hasClassName(CssName.DISABLED));
        assertFalse(element.hasAttribute(CssName.DISABLED));
    }
    widget.setEnabled(true);
    if(checkElement) {
        assertFalse(element.hasClassName(CssName.DISABLED));
        assertFalse(element.hasAttribute(CssName.DISABLED));
    }
    assertEquals(widget.isEnabled(), true);
    widget.setEnabled(false);
    if(checkElement) {
        assertTrue(element.hasClassName(CssName.DISABLED));
        assertTrue(element.hasAttribute(CssName.DISABLED));
    }
    assertEquals(target.isEnabled(), false);
}
项目:che    文件:CategoryNodeElement.java   
@SuppressWarnings("unchecked")
private void renderChildren() {
  elementsMap = new HashMap<>();
  CategoryRenderer categoryRenderer = category.getRenderer();
  for (Object o : category.getData()) {
    ListItem<?> element =
        ListItem.create(categoryRenderer, resources.defaultCategoriesListCss(), o);
    categoryRenderer.renderElement(element, o);
    elementsMap.put(o, element);
    if (element.getId().isEmpty()) {
      UIObject.ensureDebugId(element, "projectWizard-" + element.getInnerText());
    }
    container.getElement().appendChild(element);
  }
  if (elementsMap.isEmpty()) {
    expandControl.getStyle().setVisibility(Style.Visibility.HIDDEN);
  } else {
    expandControl.getStyle().setVisibility(Style.Visibility.VISIBLE);
  }
}
项目:che    文件:BreakpointConfigurationViewImpl.java   
@Inject
public BreakpointConfigurationViewImpl(DebuggerLocalizationConstant locale) {
  Widget widget = uiBinder.createAndBindUi(this);

  this.setWidget(widget);
  this.setTitle(locale.breakpointConfigurationTitle());
  ensureDebugId("breakpoint-configuration-window");

  Button closeButton =
      createButton(
          locale.evaluateExpressionViewCloseButtonTitle(),
          UIObject.DEBUG_ID_PREFIX + "close-btn",
          clickEvent -> delegate.onCloseClicked());
  addButtonToFooter(closeButton);

  Button applyButton =
      createButton(
          locale.viewBreakpointConfigurationApplyButton(),
          UIObject.DEBUG_ID_PREFIX + "apply-btn",
          clickEvent -> delegate.onApplyClicked());
  addButtonToFooter(applyButton);
}
项目:gerrit    文件:Message.java   
void setOpen(boolean open) {
  if (open && info._revisionNumber() > 0 && !commentList.isEmpty()) {
    renderComments(commentList);
    commentList = Collections.emptyList();
  }
  setName(open);

  UIObject.setVisible(summary, !open);
  UIObject.setVisible(message, open);
  comments.setVisible(open && comments.getWidgetCount() > 0);
  if (open) {
    removeStyleName(style.closed());
  } else {
    addStyleName(style.closed());
  }
}
项目:gerrit    文件:Hashtags.java   
private void addHashtag(String hashtags) {
  ChangeApi.hashtags(project.get(), changeId.get())
      .post(
          PostInput.create(hashtags, null),
          new GerritCallback<JsArrayString>() {
            @Override
            public void onSuccess(JsArrayString result) {
              Gerrit.display(
                  PageLinks.toChange(project, psId.getParentKey(), String.valueOf(psId.get())));
            }

            @Override
            public void onFailure(Throwable err) {
              UIObject.setVisible(error, true);
              error.setInnerText(
                  err instanceof StatusCodeException
                      ? ((StatusCodeException) err).getEncodedResponse()
                      : err.getMessage());
              hashtagTextBox.setEnabled(true);
            }
          });
}
项目:unitime    文件:FilterBox.java   
private void position(final UIObject relativeObject, int offsetWidth, int offsetHeight) {
    int textBoxOffsetWidth = relativeObject.getOffsetWidth();
    int offsetWidthDiff = offsetWidth - textBoxOffsetWidth;
    int left = relativeObject.getAbsoluteLeft();
    if (offsetWidthDiff > 0) {
        int windowRight = Window.getClientWidth() + Window.getScrollLeft();
        int windowLeft = Window.getScrollLeft();
        int distanceToWindowRight = windowRight - left;
        int distanceFromWindowLeft = left - windowLeft;
        if (distanceToWindowRight < offsetWidth && distanceFromWindowLeft >= offsetWidthDiff) {
            left -= offsetWidthDiff;
        }
    }
    int top = relativeObject.getAbsoluteTop();
    int windowTop = Window.getScrollTop();
    int windowBottom = Window.getScrollTop() + Window.getClientHeight();
    int distanceFromWindowTop = top - windowTop;
    int distanceToWindowBottom = windowBottom - (top + relativeObject.getOffsetHeight());
    if (distanceToWindowBottom < offsetHeight && distanceFromWindowTop >= offsetHeight) {
        top -= offsetHeight;
    } else {
        top += relativeObject.getOffsetHeight();
    }
    setPopupPosition(left, top);
}
项目:vaadin-stackpanel    文件:StackPanelConnector.java   
public void refresh() {
    UIObject.setVisible(panel.contentNode, getState().isOpen());
    updateStyleName(panel);

    if (getState().isToggleIconEnabled()) {
        updateToggleIcon(getState().isOpen());
    }

    if (getState().isToggleEnabled()) {
        if (clickHandlerRegistration != null) {
            clickHandlerRegistration.removeHandler();
        }
        clickHandlerRegistration = panel.addDomHandler(toggleClickHandler, ClickEvent.getType());
    } else {
        if (clickHandlerRegistration != null) {
            clickHandlerRegistration.removeHandler();
        }
        clickHandlerRegistration = panel.addDomHandler(toggleDisabledClickHandler, ClickEvent.getType());
    }
}
项目:google-apis-explorer    文件:EmbeddedHistoryItemView.java   
/**
 * Complete the partially filled history item with the response data.
 *
 * @param response Response data.
 * @param timeMillis Time that execution took in milliseconds.
 * @param linkFactory Link factory that is used to generate hyperlink and menu links in the
 *        response view.
 */
public void complete(ApiResponse response, long timeMillis, PrettifierLinkFactory linkFactory) {
  executing.setVisible(false);
  wireContent.addStyleName(style.fadeIn());
  time.setInnerText("time to execute: " + timeMillis + " ms");
  statusDiv.setInnerText(response.getStatus() + " " + response.getStatusText());

  // Headers are hidden by default.
  UIObject.setVisible(responseHeadersDiv, false);
  responseHeadersDiv.setInnerText(getResponseHeadersString(response));
  try {
    JsonPrettifier.prettify(
        request.getService(), requestBodyDiv, request.getRequestBody(), linkFactory);
  } catch (JsonFormatException e) {
    // We should only be generating valid requests
    requestBodyDiv.add(new InlineLabel(request.getRequestBody()));
  }

  setResponseContent(request, response, realPathFragment, linkFactory);
}
项目:qafe-platform    文件:AbstractComponentRenderer.java   
protected void initSize(UIObject widget, String width, String height, String uuid, String parent, String context) {
    if (widget == null) {
        return;
    }
    if (!QAMLUtil.isEmpty(width)) {
        if (!width.startsWith("-")) {
            // Width is not negative
            if (QAMLUtil.isNumber(width)) {
                width = width + QAMLConstants.UNIT;
            }
            widget.setWidth(width);
        }
    }
    if (!QAMLUtil.isEmpty(height)) {
        if (!height.startsWith("-")) {
            // Height is not negative
            if (QAMLUtil.isNumber(height)) {
                height = height + QAMLConstants.UNIT;
            }
            widget.setHeight(height);
        }
    }
    if ("0".equals(width) && "0".equals(height)) {
        widget.setVisible(false);
    }
}
项目:qafe-platform    文件:ToggleExecute.java   
private void toggle(ToggleGVO toggleGVO, WindowActivity activity) {
    List<BuiltInComponentGVO> builtInComponents = toggleGVO.getComponents();
    if (builtInComponents == null) {
        return;
    }
    for (BuiltInComponentGVO builtInComponentGVO : builtInComponents) {
        List<UIObject> widgets = getWidgets(builtInComponentGVO, activity);         
        if (QAMLUtil.isEmpty(widgets)) {
            continue;
        }
        for (UIObject widget : widgets) {
            if (widget instanceof HasVisibility) {
                HasVisibility hasVisibility = (HasVisibility)widget;
                boolean visible = hasVisibility.isVisible();
                hasVisibility.setVisible(!visible);
            }
        }
    }
}
项目:qafe-platform    文件:ShowPanelComponent.java   
@Override
public void onDetach(){     
    if(resizeRegistration != null) {
        resizeRegistration.removeHandler();
    }

    // This is to clear all existing components from repository. showPanel.hide() will implicitly call this method.
    List<UIObject> uiObjects = ComponentRepository.getInstance().getComponent(this.getId());
    if(uiObjects != null){
        UIObject uiObject = uiObjects.iterator().next();
        if (uiObject instanceof ShowPanelComponent) {
            ShowPanelComponent showPanel = (ShowPanelComponent)uiObject;                
            Widget innerComponent = showPanel.getWidget();
            if (innerComponent != null) {
                ComponentRepository.getInstance().clearContainerComponent(innerComponent);
            }               
        }
    }

    ComponentRepository.getInstance().remove(this.getId());

    removeMaskForActivePanel();
    super.onDetach();
}
项目:qafe-platform    文件:TreeRenderer.java   
void processChildren(TreeItem rootItem, TreeItemGVO[] children, String uuid, String parent, String context) {
        if (children != null) {
            for (int i = 0; i < children.length; i++) {
                TreeItemGVO componentGVO = children[i];
                UIObject uiObject = renderChildComponent(componentGVO, null, uuid, parent, context, null);
//              if (uiObject instanceof QTreeItem) {
//                  QTreeItem treeItem = (QTreeItem) uiObject;
//                  treeItem.setState(componentGVO.getExpand().booleanValue());
//                  rootItem.addItem(treeItem);
//                  // TODO set Tree
//                  RendererHelper.fillIn(componentGVO, treeItem.getLabel(), uuid, parent, context);
//                  processChildren(treeItem, componentGVO.getChildren(), uuid, parent, context);
//              }
                RendererHelper.fillIn(componentGVO, uiObject, uuid, parent, context);
            }
        }
    }
项目:qafe-platform    文件:SetPanelHandler.java   
private void setPanel(SetPanelGVO setPanelGVO, String appId, String windowId, String eventSessionId) {
    String panelRefId = setPanelGVO.getTarget();
       String key = RendererHelper.generateId(panelRefId, windowId, appId);
       List<UIObject> uiObjects = ComponentRepository.getInstance().getComponent(key);
       if ((uiObjects != null) && (uiObjects.size() > 0)) {
        UIObject uiObject = uiObjects.get(0);
        if (uiObject instanceof SimplePanel) {
            SimplePanel simplePanel = (SimplePanel) uiObject;
            Widget innerComponent = simplePanel.getWidget();
            if (innerComponent != null) {
                ComponentRepository.getInstance().clearContainerComponent(innerComponent);
            }
            ComponentGVO panelDefinitionGVO = setPanelGVO.getSrc();
            UIObject panelDefinition = AnyComponentRenderer.getInstance().render(panelDefinitionGVO, eventSessionId, windowId, appId);
            if (panelDefinition instanceof Widget) {
                simplePanel.setWidget((Widget)panelDefinition);
            }
        }
       }
}
项目:qafe-platform    文件:PagingDataGridRenderer.java   
@Override
public UIObject render(ComponentGVO component, String uuid,String parent, String context) {
    UIObject uiObject = null;
    if (component != null) {
        if (component instanceof DataGridGVO) {
            DataGridGVO gvo = ((DataGridGVO)component).clone();
            DataGridColumnGVO[] columns = gvo.getColumns();
            if (columns!=null) {
                for(int i=0; i<columns.length; i++){
                    columns[i].setUuid(uuid);
                }
            }
            uiObject = DataGridFactory.createPagingDataGrid(gvo,uuid,parent);

            if(gvo.getOverflowGroup() != null) {
                UIObject datagrid = ((FlexTable)uiObject).getWidget(0, 0);
                registerRowSelectionChange(gvo, datagrid);
            }               
        }
    }
    return uiObject;
}
项目:qafe-platform    文件:RendererHelper.java   
private static Object getData(UIObject ui) {
        if (ui instanceof HasValue) {
            return ((HasValue)ui).getValue();
        } else if (ui instanceof HasText) {
            return ((HasText)ui).getText();
        } else if (ui instanceof HasData) {
            return ((HasData)ui).getData();         
        } else if (ui instanceof ListBox) {
            ListBox listBox = (ListBox) ui;
            if(listBox.getSelectedIndex() > 0) {
                return listBox.getValue(listBox.getSelectedIndex());                
            }
        } 
//      else if (ui instanceof ValueSpinner) {
//          ValueSpinner spinner = (ValueSpinner) ui;
//          return spinner.getTextBox().getValue();
//      }
        return null;
    }
项目:qafe-platform    文件:RendererHelper.java   
private static Object getData(UIObject ui) {
    if (ui instanceof HasValue) {
        return ((HasValue)ui).getValue();
    } else if (ui instanceof HasText) {
        return ((HasText)ui).getText();
    } else if (ui instanceof HasData) {
        return ((HasData)ui).getData();
    } else if (ui instanceof ListBox) {
        ListBox listBox = (ListBox) ui;
        if(listBox.getSelectedIndex() > 0) {
            return listBox.getValue(listBox.getSelectedIndex());
        }
    } else if (ui instanceof ValueSpinner) {
        ValueSpinner spinner = (ValueSpinner) ui;
        return spinner.getTextBox().getValue();
    }
    return null;
}
项目:qafe-platform    文件:BuiltinHandlerHelper.java   
private static Object getValue(HasData hasData) {
       Object data = hasData.getData();

       if (!(data instanceof String)) {
           DataContainerGVO dtc = DataContainerGVO.create(data);
           if (dtc != null) {
               return dtc;
           }
       }

       if (hasData instanceof UIObject) {
        handleSimpleValue((UIObject) hasData, data);
       }

       return data;
}
项目:qafe-platform    文件:TabPanelRenderer.java   
public static void setTabVisibility(TabPanel tabs, int index, boolean visible, UIObject tabUI) {
    try {
        if (index >= tabs.getTabBar().getTabCount() || index < 0)
            return;
        // Native Google implementation of TabBar uses an HorizontalPanel,
        // so, the DOM primary element is a table element (with just one tr)
        Element table = tabs.getTabBar().getElement();
        Element tr = DOM.getFirstChild(DOM.getFirstChild(table));
        // (index + 1) to account for 'first' placeholder td.
        Element td = DOM.getChild(tr, index + 1);
        UIObject.setVisible(td, visible);
        tabUI.setVisible(visible);
    } catch (Exception e) {
        LOG.log(Level.WARNING,
            "Not sure what can go wrong, but setting tab visibility might have failed", e);
    }
}
项目:qafe-platform    文件:TileListRenderer.java   
private void registerCellRender(final TileListGVO component, final QTileList widget, final String uuid, final String parent, final String context, final AbstractActivity activity) {
    widget.registerCellRenderHandler(new CellRenderHandler() {
        @Override
        public UIObject doCellRender(CellRenderEvent event) {
            Object cellModel = event.getModel();
            if (!(cellModel instanceof Map)) {
                return null;
            }
            int index = event.getIndex();
            String owner = component.getId() + QAMLConstants.INDEXING + index;
            UIObject cellWidget = renderChildComponent(component.getComponent(), owner, uuid, parent, context, activity);
            initCell(widget, cellWidget, cellModel, owner, parent, context, activity);
            return cellWidget;
        }
    });
}
项目:qafe-platform    文件:QEffects.java   
public static void fadeOut(final UIObject ui, final int delay,final int startIn, final boolean visibleAfterFadingOut){
    final Effects a = $(ui.getElement()).as(Effects.Effects);
    new Timer(){

        @Override
        public void run() {
            $(ui.getElement()).fadeOut(delay,new Function() {
                public void f(Element e) {
                    //a.fadeOut();
                    ui.setVisible(visibleAfterFadingOut);
                }
            });

        }

    }.schedule(startIn);
}
项目:socom    文件:AdministrationPresenter.java   
@SuppressWarnings({ "unchecked", "rawtypes" })
public void loadUsers(String startingWith, final UIObject parent) {
    // TODO: filter last treeitem (*) as it should receive 'all other' users
    getAppController().getRPCFactory().getAdministrationService()
            .getUsersStartingWith(startingWith, new AsyncCallback<List<SimpleUser>>() {

                @Override
                public void onSuccess(List<SimpleUser> result) {
                    view.updateInformation((List) result, parent);
                }

                @Override
                public void onFailure(Throwable caught) {
                    view.updateInformation(null, parent);
                    view.showError(new ErrorServerUnknownErrorView());
                }
            });
}
项目:qafe-platform    文件:BuiltinHandlerHelper.java   
public static void handleSize(ShowPanelGVO showPanelGVO, ShowPanelComponent showPanel, UIObject container) {
    // Obtained these values by measuring
    int intVScrollbarWidth = 16;
    int intHScrollbarHeight = 16;
    int offsetWidth = 34;
    int offsetHeight = 38;


    String height = showPanelGVO.getSrc().getHeight();
    if (height != null) {
        // The height of the panel-definition inside the container,
        // so the height of the popup panel should be bigger to avoid unnecessary scrollbar  
        int intHeight = Integer.valueOf(height);
        height = String.valueOf(intHeight + intHScrollbarHeight + offsetHeight);
        showPanel.setHeight(height);    
    }

    String width = showPanelGVO.getSrc().getWidth();
    if (width != null) {
        // The width of the panel-definition inside the container,
        // so the width of the popup panel should be bigger to avoid unnecessary scrollbar
        int intWidth = Integer.valueOf(width);
        width = String.valueOf(intWidth + intVScrollbarWidth + offsetWidth);
        showPanel.setWidth(width);
    }
}
项目:qafe-platform    文件:TextFieldSpinnerRenderer.java   
@Override
protected void init(ComponentGVO component, UIObject widget, String owner, String uuid, String parent, String context, AbstractActivity activity) {
    super.init(component, widget, owner, uuid, parent, context, activity);
    TextFieldGVO textFieldGVO = (TextFieldGVO)component;
    QTextFieldSpinner textField = (QTextFieldSpinner)widget;
    int minValue = TextFieldGVO.DEFAULT_MINIMUM;
    int maxValue = TextFieldGVO.DEFAULT_MAXIMUM;
    if (textFieldGVO.getMinValue() != null) {
        minValue = Integer.parseInt(textFieldGVO.getMinValue());
    }   
    if (textFieldGVO.getMaxValue() != null) {
        maxValue = Integer.parseInt(textFieldGVO.getMaxValue());
    }   
    textField.setMinValue(minValue);
    textField.setMaxValue(maxValue);
}
项目:qafe-platform    文件:AbstractComponentRenderer.java   
protected UIObject renderChildComponent(ComponentGVO component, String uuid, String parent, String context) {
    UIObject renderedComponent = null;
    if (component != null) {
        try {
            Object object = COMPONENT_RENDERER_MAP.get(component.getClassName());
            if (object != null && object instanceof GWTUIRenderer) {
                GWTUIRenderer renderer = (GWTUIRenderer) object;                    
                renderedComponent = renderer.render(component, uuid, parent, context);
            } else {
                ClientApplicationContext.getInstance().log("Unable to find renderer for class " + component.getClassName(), null);
            }
        } catch (Exception e) {
            ClientApplicationContext.getInstance().log("AbstractComponentRenderer:renderChildComponent", e);

        }
    }

    return renderedComponent;
}
项目:qafe-platform    文件:SetPropertyHandler.java   
private void collectComponents(UIObject sender, SetPropertyGVO setProperty, String appId, String windowId, String eventSessionId) {
    for (BuiltInComponentGVO builtInComponentGVO : setProperty.getComponents()) {
        String componentId = builtInComponentGVO.getComponentId();
        String componentUUID = generateId(componentId, windowId, appId, eventSessionId);
        List<UIObject> uiObjects = getUIObjects(componentUUID, setProperty);
        if (uiObjects == null) {
            uiObjects = getUIObjectsByName(componentUUID);
        }
        if (uiObjects == null) {
            if (componentUUID.contains(MENU) || componentUUID.contains(TOOLBAR)) {
                uiObjects = getUIObjectsForMenuOrToolbar(componentUUID);
            }
        }
        if (uiObjects != null){
            processSetProperty(appId, windowId, eventSessionId, setProperty, builtInComponentGVO, uiObjects);
        }
    }
}
项目:qafe-platform    文件:AbstractBuiltInExecute.java   
protected List<UIObject> collectCellUIObjects(String component, int rowIndex, List<UIObject> cellUIObjects) {
    if (cellUIObjects == null) {
        cellUIObjects = new ArrayList<UIObject>();
    }
    component = component.replaceFirst("\\[.+\\]", "");
    boolean rowSelection = (rowIndex > -1);
    while (true) {
        String cellUUID = QAMLConstants.TOKEN_INDEXING + rowIndex + QAMLConstants.TOKEN_INDEXING + component;  
        List<UIObject> uiObjects = RendererHelper.getComponent(cellUUID);
        if (uiObjects != null) {
            cellUIObjects.addAll(uiObjects);
        }
        if (rowSelection || (uiObjects == null)) {
            break;
        }
        rowIndex++;
    }
    return cellUIObjects;
}
项目:qafe-platform    文件:RendererHelper.java   
private static void addChangeListenerForWindowModified(final ComponentGVO vo, UIObject ui, final String uuid) {
    if (ui != null) {
        if (ui instanceof HasValueChangeHandlers) {
            HasValueChangeHandlers hasValueChangeHandlers = (HasValueChangeHandlers) ui;
            hasValueChangeHandlers.addValueChangeHandler(new ValueChangeHandler() {

                public void onValueChange(ValueChangeEvent event) {
                    WindowPanel window = ClientApplicationContext.getInstance().getWindow(vo.getWindow(), uuid);
                    if (window != null && window instanceof QWindowPanel) {
                        ((QWindowPanel) window).setModified(true);
                    }
                }
            });
        }
    }

}
项目:qafe-platform    文件:AbstractBuiltInHandler.java   
private AsyncCallback<?> createCallback(final UIObject sender, final String listenerType
        , final Map<String, String> mouseInfo, final EventItemDataGVO eventItemDataGVO
        , final String appId, final String windowId, final String eventSessionId) {

     return new AsyncCallback<Object>() {

         @Override
public void onSuccess(Object result) {
            setBusy(false);
             GEventItemDataObject data = (GEventItemDataObject) result;
             storeOutputValues(eventSessionId, data);
             EventHandler.getInstance().handleEvent(eventSessionId, sender, listenerType
                    , mouseInfo, appId, windowId);
         }

         @Override
public void onFailure(Throwable exception) {
            setBusy(false);
            Object currentBuiltIn = eventItemDataGVO.getBuiltInGVO();
            EventHandler.getInstance().handleException(exception, currentBuiltIn
                    , sender, listenerType, mouseInfo, appId, windowId, eventSessionId);
         }
     };
 }
项目:qafe-platform    文件:RendererHelper.java   
public static void addMenu(ComponentGVO vo, UIObject ui, String uuid, String parent) {
    if (vo != null && ui != null) {
        if (vo.getMenu() != null) {
            MenuBar menu = new MenuBar();
            menu.setAutoOpen(true);
            menu.setWidth("100%");
            UIObject renderedComponent = new MenuItemRenderer().render(vo.getMenu(), uuid, parent, vo.getContext());
            if (renderedComponent instanceof MenuBar) {
                menu.addItem(vo.getMenu().getDisplayname(), (MenuBar) renderedComponent);
            } else if (renderedComponent instanceof MenuItem) {
                menu.addItem((MenuItem) renderedComponent);
            }
            if (ui instanceof DockPanel) {
                ((DockPanel) ui).add(menu, DockPanel.NORTH);
            } else if (ui instanceof Grid || ui instanceof VerticalPanel || ui instanceof HorizontalPanel)
                ((Panel) ui).add(menu);
        }
    }

}
项目:qafe-platform    文件:QRadioButton.java   
public void onClick(ClickEvent event) {
    // Save current instance - you could just save the text to save
    // memory, but you might well want to add getters for other
    // attributes of the current instance

    if (event.getSource() instanceof RadioButton) {
        RadioButton rb = (RadioButton) event.getSource();
        String key = DOM.getElementAttribute(rb.getElement(), "id");
        if(key != null && key.length() > 0) {
            List<UIObject> components = ComponentRepository.getInstance().getComponent(key);
            for (UIObject object : components) {
                if (object == rb) {
                    DOM.setElementAttribute(object.getElement(), "isSelected", "true");
                } else {
                    DOM.setElementAttribute(object.getElement(), "isSelected","false");
                }
            }                   
        } 
    }
}
项目:qafe-platform    文件:RendererHelper.java   
public static void addMenu(ComponentGVO vo, UIObject ui, String uuid, String parent) {
    if (vo != null && ui != null) {
        if (vo.getMenu() != null) {
            MenuBar menu = new MenuBar();
            menu.setAutoOpen(true);
            menu.setWidth("100%");
            UIObject renderedComponent = new MenuItemRenderer().render(vo.getMenu(), null, uuid, parent, vo.getContext(), null);
            if (renderedComponent instanceof MenuBar) {
                menu.addItem(vo.getMenu().getDisplayname(), (MenuBar) renderedComponent);
            } else if (renderedComponent instanceof MenuItem) {
                menu.addItem((MenuItem) renderedComponent);
            }
            if (ui instanceof DockPanel) {
                ((DockPanel) ui).add(menu, DockPanel.NORTH);
            } else if (ui instanceof Grid || ui instanceof VerticalPanel || ui instanceof HorizontalPanel)
                ((Panel) ui).add(menu);
        }
    }

}
项目:qafe-platform    文件:SetPropertyHandler.java   
private void handleEnabled(UIObject uiObject, String propertyValue, String propertyType) {
    boolean value = Boolean.valueOf(propertyValue).booleanValue();
    if (QAMLConstants.PROPERTY_DISABLED.equals(propertyType)) {
        value = !value;
    }
    if (uiObject instanceof HasEnabled) {
        HasEnabled hasEnabled = (HasEnabled)uiObject;
        hasEnabled.setEnabled(value);
    } else if (uiObject instanceof HasWidgets) {
        SetMaskHelper.setMaskEnable(uiObject.getElement().getAttribute(QAMLConstants.PROPERTY_ID), value, true);
        DOM.setElementPropertyBoolean(uiObject.getElement(), QAMLConstants.PROPERTY_DISABLED, !value);
    } else if (uiObject instanceof QSuggestBox) {
        QSuggestBox suggestField = (QSuggestBox)uiObject;
        suggestField.getTextBox().setEnabled(value);
    } else if (uiObject instanceof SpreadsheetCell) {
        SpreadsheetCell cell = (SpreadsheetCell) uiObject;
        cell.setEditable(value);
    }
}
项目:unitimes    文件:WebTable.java   
public void setStyleName(String styleName) {
    super.setStyleName(styleName);
    for (UIObject c: iContent) {
        c.setStyleName(styleName);
        c.getElement().getStyle().setBorderWidth(0, Unit.PX);
    }
}
项目:cuba    文件:CubaRichTextToolbarWidget.java   
public void setLocaleMap(Map<String,String> localeMap) {
    Map<String, UIObject> locales = new HashMap<String, UIObject>();
    locales.put(CubaRichTextAreaState.RICH_TEXT_AREA_BOLD_LABEL, bold);
    locales.put(CubaRichTextAreaState.RICH_TEXT_AREA_ITALIC_LABEL, italic);
    locales.put(CubaRichTextAreaState.RICH_TEXT_AREA_UNDERLINE_LABEL, underline);
    locales.put(CubaRichTextAreaState.RICH_TEXT_AREA_SUBSCRIPT_LABEL, subscript);
    locales.put(CubaRichTextAreaState.RICH_TEXT_AREA_SUPERSCRIPT_LABEL, superscript);
    locales.put(CubaRichTextAreaState.RICH_TEXT_AREA_JUSTIFYCENTER_LABEL, justifyCenter);
    locales.put(CubaRichTextAreaState.RICH_TEXT_AREA_JUSTIFYRIGHT_LABEL, justifyRight);
    locales.put(CubaRichTextAreaState.RICH_TEXT_AREA_JUSTIFYLEFT_LABEL, justifyLeft);
    locales.put(CubaRichTextAreaState.RICH_TEXT_AREA_STRIKETHROUGH_LABEL, strikethrough);
    locales.put(CubaRichTextAreaState.RICH_TEXT_AREA_INDENT_LABEL, indent);
    locales.put(CubaRichTextAreaState.RICH_TEXT_AREA_OUTDENT_LABEL, outdent);
    locales.put(CubaRichTextAreaState.RICH_TEXT_AREA_HR_LABEL, hr);
    locales.put(CubaRichTextAreaState.RICH_TEXT_AREA_OL_LABEL, ol);
    locales.put(CubaRichTextAreaState.RICH_TEXT_AREA_UL_LABEL, ul);
    locales.put(CubaRichTextAreaState.RICH_TEXT_AREA_INSERTIMAGE_LABEL, insertImage);
    locales.put(CubaRichTextAreaState.RICH_TEXT_AREA_CREATELINK_LABEL, createLink);
    locales.put(CubaRichTextAreaState.RICH_TEXT_AREA_REMOVELINK_LABEL, removeLink);
    locales.put(CubaRichTextAreaState.RICH_TEXT_AREA_REMOVEFORMAT_LABEL, removeFormat);

    for (Map.Entry<String, UIObject> entry : locales.entrySet()) {
        entry.getValue().setTitle(localeMap.get(entry.getKey()));
        entry.getValue().getElement().setAttribute("icon-id", entry.getKey());
    }

    setBackgroundColorLocaleMap(localeMap);
    setForegroundColorLocaleMap(localeMap);
    setSizeLocaleMap(localeMap);
    setFontLocaleMap(localeMap);
}
项目:cuba    文件:SuggestionsContainer.java   
public void clearItems() {
    selectItem(null);

    container.removeAllChildren();

    for (UIObject item : suggestions) {
        item.getElement().setPropertyInt("colSpan", 1);
        ((SuggestionItem) item).setSuggestionsContainer(null);
    }

    suggestions.clear();
}
项目:gwt-material    文件:StyleHelper.java   
/**
 * Convenience method for first removing all enum style constants and then adding the single one.
 *
 * @see #removeEnumStyleNames(UIObject, Class)
 * @see #addEnumStyleName(UIObject, Style.HasCssName)
 */
public static <E extends Style.HasCssName, F extends Enum<? extends Style.HasCssName>> void addUniqueEnumStyleName(final UIObject uiObject,
                                                                                                                   final Class<F> enumClass,
                                                                                                                   final E style) {
    removeEnumStyleNames(uiObject, enumClass);
    addEnumStyleName(uiObject, style);
}
项目:gwt-material    文件:StyleHelper.java   
/**
 * Removes all CSS style names specified by an enum that implements {@link Style.HasCssName} from an UIObject.
 *
 * @param uiObject  Object to remove CSS class names from
 * @param enumClass Enum representing CSS class names
 * @param <E>       Enum type implementing {@link Style.HasCssName}
 */
public static <E extends Enum<? extends Style.HasCssName>> void removeEnumStyleNames(final UIObject uiObject,
                                                                                     final Class<E> enumClass) {

    for (final Enum<? extends Style.HasCssName> constant : enumClass.getEnumConstants()) {
        final String cssClass = ((Style.HasCssName) constant).getCssName();

        if (cssClass != null && !cssClass.isEmpty()) {
            uiObject.removeStyleName(cssClass);
        }
    }
}