public void setValue(Component cmp, String style) { ((HtmlBasedComponent) cmp).setStyle(style); }
public Object clone() { final Borderlayout clone = (Borderlayout) super.clone(); clone.afterUnmarshal(); return clone; } private void afterUnmarshal() {
/** * Sets vertical flexibility hint of this component. * <p>Number flex indicates how * this component's container distributes remaining empty space among its * children vertically. Flexible component grow and shrink to fit their * given space. Flexible components with larger flex values will be made * larger than components with lower flex values, at the ratio determined by * all flexible components. The actual flex value is not relevant unless * there are other flexible components within the same container. Once the * default sizes of components in a container are calculated, the remaining * space in the container is divided among the flexible components, * according to their flex ratios.</p> * <p>Specify a flex value of negative value, 0, * or "false" has the same effect as leaving the flex attribute out entirely. * Specify a flex value of "true" has the same effect as a flex value of 1.</p> * <p>Special flex hint, <b>"min"</b>, indicates that the minimum space shall be * given to this flexible component to enclose all of its children components. * That is, the flexible component grow and shrink to fit its children components.</p> * * @param flex the vertical flex hint. * @since 5.0.0 * @see #setHflex * @see #getVflex */ public void setVflex(String flex) { if (getHeight() != null && !(flex == null || "min".equals(flex))) { throw new UiException("Not allowed to set vflex and height at the same time except vflex=\"min\""); } setVflex0(flex); }
/** Sets the width. If null, the best fit is used. * @see #setWidthDirectly * @see #disableClientUpdate */ public void setWidth(String width) { if (getHflex() != null && !(width == null || getHflex().equals("min"))) { throw new UiException("Not allowed to set hflex and width at the same time except hflex=\"min\""); } setWidth0(width); }
/*package*/ static boolean matchClasses(Component component, Set<String> classes){ if(classes == null || classes.isEmpty()) return true; if(!(component instanceof HtmlBasedComponent)) return false; String scls = ((HtmlBasedComponent) component).getSclass(); String zcls = ((HtmlBasedComponent) component).getZclass(); for(String c : classes) if(scls == null || !scls.matches("(?:^|.*\\s)"+c+"(?:\\s.*|$)") && !Objects.equals(zcls, c)) return false; return true; }
/** * Sets horizontal flex hint of this component. * <p>Number flex indicates how * this component's container distributes remaining empty space among its * children horizontally. Flexible component grow and shrink to fit their * given space. Flexible components with larger flex values will be made * larger than components with lower flex values, at the ratio determined by * all flexible components. The actual flex value is not relevant unless * there are other flexible components within the same container. Once the * default sizes of components in a container are calculated, the remaining * space in the container is divided among the flexible components, * according to their flex ratios.</p> * <p>Specify a flex value of negative value, 0, or "false" has the same * effect as leaving the flex attribute out entirely. * Specify a flex value of "true" has the same effect as a flex value of 1.</p> * <p>Special flex hint, <b>"min"</b>, indicates that the minimum space shall be * given to this flexible component to enclose all of its children components. * That is, the flexible component grow and shrink to fit its children components.</p> * @param flex horizontal flex hint of this component. * @since 5.0.0 * @see #setVflex * @see #getHflex */ public void setHflex(String flex) { if (getWidth() != null && !(flex == null || "min".equals(flex))) { throw new UiException("Not allowed to set hflex and width at the same time except hflex=\"min\""); } setHflex0(flex); }
protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws java.io.IOException { super.renderProperties(renderer); if (!"0.3em".equals(_spacing)) renderer.render("spacing", _spacing); } }
/** * Create a drilldown event listener for the specified component. * * @param component The component to which the event listener will be attached. * @param dataObject Data object for the drilldown. * @param drillDownDisplayClass Dialog class for the drilldown display. */ public DrillDownListener(Component component, T dataObject, Class<?> drillDownDisplayClass) { super(); this.component = component; this.dataObject = dataObject; this.drillDownDisplayClass = drillDownDisplayClass; component.addEventListener(Events.ON_CLICK, this); if (component instanceof HtmlBasedComponent) { ((HtmlBasedComponent) component).setStyle(StringUtils.trimToEmpty(((HtmlBasedComponent) component).getStyle()) .concat("cursor:pointer;")); } }
/** * Adds a menu item to the panel's menu bar. * * @param menuitem The menu item to register. * @param path The menu path under which the item should appear. * @see org.carewebframework.ui.infopanel.model.IInfoPanel#registerMenuItem(Menuitem, String) */ @Override public void registerMenuItem(Menuitem menuitem, String path) { MenuUtil.addMenuItem(path + "\\" + menuitem.getLabel(), menuitem, menubar, null); menuPanel.setVisible(true); if (log.isDebugEnabled()) { log.debug("Registered menu item: " + menuitem); } }
/** * Applies one or more theme classes to a component. * * @param component Component to receive the theme classes. * @param baseClass A base theme class (may be null). * @param themeClasses A list of theme classes to apply. */ public static void applyThemeClass(HtmlBasedComponent component, String baseClass, IThemeClass... themeClasses) { StringBuilder sb = new StringBuilder(); if (baseClass != null) { component.setZclass(baseClass); } for (IThemeClass themeClass : themeClasses) { String cls = themeClass == null ? null : themeClass.getThemeClass(); if (cls != null) { sb.append(sb.length() > 0 ? " " : "").append(themeClass.getThemeClass()); } } component.setSclass(sb.toString()); }
protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws java.io.IOException { super.renderProperties(renderer); for (Component child = getFirstChild(); child != null; child = child.getNextSibling()) { if (child instanceof HtmlBasedComponent && (((HtmlBasedComponent) child).getHflex() != null || ((HtmlBasedComponent) child).getVflex() != null)) log.warn("Using hflex/vflex inside NoDOM component is not supported"); } } }
public void render(Component comp, Writer out) throws IOException { final SmartWriter wh = new SmartWriter(out); final Menubar self = (Menubar)comp; final String uuid = self.getUuid(); wh.write("<div id=\"").write(uuid).write("\" z.type=\"zul.menu2.Menubar2\""); wh.write(self.getOuterAttrs()).write(self.getInnerAttrs()).write(">"); wh.write("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" id=\"").write(uuid).writeln("!cave\">"); for (Iterator it = self.getChildren().iterator(); it.hasNext();) { final HtmlBasedComponent child = (HtmlBasedComponent)it.next(); wh.write("<tr id=\"").write(child.getUuid()).write("!chdextr\""); wh.writeAttr("height",child.getHeight()).writeln(">"); child.redraw(out); wh.writeln("</tr>"); } wh.write("</table></div>"); } }
public String getValue(Component cmp) { return ((HtmlBasedComponent) cmp).getWidth(); } });
/** Sets the CSS class. This method is a bit confused with Java's class, * but we provide it for XUL compatibility. * The same as {@link #setSclass}. */ public void setClass(String sclass) { setSclass(sclass); }
public String getValue(Component cmp) { return ((HtmlBasedComponent) cmp).getZclass(); } });
public String getValue(Component cmp) { return ((HtmlBasedComponent) cmp).getHeight(); } });
public void beforeChildAdded(Component child, Component refChild) { if (!(child instanceof LayoutRegion)) throw new UiException("Unsupported child for Borderlayout: " + child); if (child instanceof North) { if (_north != null && child != _north) throw new UiException("Only one north child is allowed: " + this); } else if (child instanceof South) { if (_south != null && child != _south) throw new UiException("Only one south child is allowed: " + this); } else if (child instanceof West) { if (_west != null && child != _west) throw new UiException("Only one west child is allowed: " + this); } else if (child instanceof East) { if (_east != null && child != _east) throw new UiException("Only one east child is allowed: " + this); } else if (child instanceof Center) { if (_center != null && child != _center) throw new UiException("Only one center child is allowed: " + this); } super.beforeChildAdded(child, refChild); }
public String getValue(Component cmp) { return ((HtmlBasedComponent) cmp).getHflex(); } });
public void minimize(boolean minimized) { if(!isMinimizable()){ throw new AgentException(target + " is not minimizable"); } HtmlBasedComponent comp = target.as(HtmlBasedComponent.class); String cmd = Events.ON_MINIMIZE; MinimizeEvent event = new MinimizeEvent(cmd, comp, "", "", comp.getWidth(), comp.getHeight(), minimized); Map<String, Object> data = EventDataManager.getInstance().build(event); String desktopId = target.getDesktop().getId(); ((ClientCtrl) getClient()).postUpdate(desktopId, target.getUuid(), cmd, data, false); ((ClientCtrl) getClient()).flush(desktopId); }