use of com.servoy.j2db.ui.IStylePropertyChanges in project servoy-client by Servoy.
the class WebImageBeanHolder method getStylePropertyChanges.
/**
* @see com.servoy.j2db.server.headlessclient.dataui.WebBaseButton#getStylePropertyChanges()
*/
@Override
public IStylePropertyChanges getStylePropertyChanges() {
IStylePropertyChanges changes = super.getStylePropertyChanges();
if (!lastChanged) {
testChanged();
if (!changes.isChanged() && lastChanged) {
changes.setChanged();
}
} else {
changes.setChanged();
}
// $NON-NLS-1$
boolean useAnchors = Utils.getAsBoolean(application.getRuntimeProperties().get("enableAnchors"));
if (useAnchors) {
// $NON-NLS-1$
if ((anchoring & (IAnchorConstants.EAST | IAnchorConstants.WEST)) != 0)
changes.getChanges().remove("width");
// $NON-NLS-1$
if ((anchoring & (IAnchorConstants.NORTH | IAnchorConstants.SOUTH)) != 0)
changes.getChanges().remove("height");
}
return changes;
}
use of com.servoy.j2db.ui.IStylePropertyChanges in project servoy-client by Servoy.
the class ScrollResponseHeaderContainer method checkForValueChanges.
protected void checkForValueChanges(Object cell) {
IStylePropertyChanges spc = ((IProviderStylePropertyChanges) cell).getStylePropertyChanges();
if (!spc.isChanged() && !spc.isValueChanged()) {
IModel innermostModel = ((Component) cell).getInnermostModel();
if (innermostModel instanceof RecordItemModel) {
Object lastRenderedValue = ((RecordItemModel) innermostModel).getLastRenderedValue((Component) cell);
Object object = ((Component) cell).getDefaultModelObject();
if (!Utils.equalObjects(lastRenderedValue, object)) {
spc.setValueChanged();
}
} else {
spc.setChanged();
}
}
}
use of com.servoy.j2db.ui.IStylePropertyChanges in project servoy-client by Servoy.
the class WebForm method getStylePropertyChanges.
/**
* @see com.servoy.j2db.ui.IProviderStylePropertyChanges#getStylePropertyChanges()
*/
public IStylePropertyChanges getStylePropertyChanges() {
if (jsChangeRecorder == null)
jsChangeRecorder = new IStylePropertyChanges() {
private boolean changed = false;
public void setValueChanged() {
}
public void setRendered() {
uiRecreated = false;
changed = false;
}
public void setChanges(Properties changes) {
}
public void setChanged() {
// plugins can call this (see WebClientUtils)
changed = true;
}
public boolean isValueChanged() {
return false;
}
public boolean isChanged() {
if (changed || (enableChanged != null && enableChanged.booleanValue())) {
return true;
}
if (!uiRecreated) {
if (designModeBehavior != null && designModeBehavior.isEnabled(WebForm.this)) {
Object retValue = visitChildren(IProviderStylePropertyChanges.class, new Component.IVisitor() {
public Object component(Component component) {
IStylePropertyChanges stylePropertyChanges = ((IProviderStylePropertyChanges) component).getStylePropertyChanges();
if (stylePropertyChanges.isValueChanged() || stylePropertyChanges.isChanged()) {
return Boolean.TRUE;
}
return IVisitor.CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
}
});
if (retValue instanceof Boolean && ((Boolean) retValue).booleanValue()) {
return true;
}
}
return false;
}
return true;
}
public Properties getChanges() {
return null;
}
public String getJSProperty(String key) {
return null;
}
};
return jsChangeRecorder;
}
use of com.servoy.j2db.ui.IStylePropertyChanges in project servoy-client by Servoy.
the class WebOnRenderHelper method doRender.
/**
* Calls onRender for the renderComponent and clears its changed flag if
* the callback did not change any properties and the value did not change
*
* @param renderComponent
* @return true if properties were changed during onRender, otherwise returns false
*/
public static boolean doRender(ISupportOnRender renderComponent) {
if (renderComponent instanceof IProviderStylePropertyChanges) {
IStylePropertyChanges spc = ((IProviderStylePropertyChanges) renderComponent).getStylePropertyChanges();
Properties changesBeforeOnRender = (Properties) spc.getChanges().clone();
renderComponent.fireOnRender(false);
Properties changesAfterOnRender = spc.getChanges();
if (changesBeforeOnRender.equals(changesAfterOnRender)) {
if (!spc.isValueChanged())
spc.setRendered();
return false;
}
}
return true;
}
Aggregations