@Override public void setComponent(SComponent newComponent) { if (this.component != newComponent) { if (this.component != null && this.component.getBorder() == this) { final SComponent origOwner = this.component; this.component = newComponent; // avoid loopback origOwner.setBorder(null); } else { this.component = newComponent; } } }
/** * Install the appropriate CG for <code>component</code>. * * @param component the component */ @Override public void installCG(COMPONENT_TYPE component) { Class clazz = component.getClass(); while (clazz.getPackage() == null || !("org.wings".equals(clazz.getPackage().getName()) || "org.wingx".equals(clazz.getPackage().getName()))) clazz = clazz.getSuperclass(); String style = clazz.getName(); style = style.substring(style.lastIndexOf('.') + 1); component.setStyle(style); // set default style name to component class (ie. SLabel). component.setBorder(SDefaultBorder.INSTANCE); // the default style writes _no_ attributes, thus the stylesheet is in effect if (Utils.isMSIE(component)) { final CGManager manager = component.getSession().getCGManager(); Object value = manager.getObject(style + ".verticalOversize", Integer.class); int verticalOversize = 0; if (value != null) verticalOversize = (Integer) value; value = manager.getObject(style + ".horizontalOversize", Integer.class); int horizontalOversize = 0; if (value != null) horizontalOversize = (Integer) value; if (verticalOversize != 0 || horizontalOversize != 0) component.putClientProperty("oversize", new SEmptyBorder(verticalOversize, horizontalOversize, verticalOversize, horizontalOversize)); } }
/** * {@inheritDoc} */ @Override protected void decorateWithBorder(IView<SComponent> view, ITranslationProvider translationProvider, Locale locale) { switch (view.getDescriptor().getBorderType()) { case SIMPLE: view.getPeer().setBorder(new SEtchedBorder()); break; case TITLED: decorateWithTitle(view, translationProvider, locale); break; default: break; } }
/** * Decorates the created view with the apropriate border. * * @param view * the view to descorate. * @param locale * the locale to use. */ protected void decorateWithBorder(IView<SComponent> view, Locale locale) { switch (view.getDescriptor().getBorderType()) { case IViewDescriptor.SIMPLE: view.getPeer().setBorder(new SEtchedBorder()); break; case IViewDescriptor.TITLED: decorateWithTitle(view, locale); break; default: break; } }