use of com.servoy.j2db.persistence.ISupportName in project servoy-client by Servoy.
the class ScrollResponseHeaderContainer method getTabSeqComponentNames.
public List<String> getTabSeqComponentNames() {
// elementTabIndexes is not sorted. We have to sort the indexes of the tabs first.
SortedMap<Integer, IPersist> sortedTabIndexes = new TreeMap<Integer, IPersist>();
for (IPersist key : elementTabIndexes.keySet()) {
sortedTabIndexes.put(elementTabIndexes.get(key), key);
}
List<String> tabSeqNames = new ArrayList<String>();
for (int i : sortedTabIndexes.keySet()) {
IPersist key = sortedTabIndexes.get(i);
if (key instanceof ISupportName) {
String name = ((ISupportName) key).getName();
if (name != null) {
tabSeqNames.add(name);
}
}
}
return tabSeqNames;
}
use of com.servoy.j2db.persistence.ISupportName in project servoy-client by Servoy.
the class SortableCellViewHeader method setWidth.
public void setWidth(int width) {
int borderWidth = 0;
Iterator<IPersist> it2 = cellview.getAllObjects();
while (it2.hasNext()) {
IPersist element = it2.next();
if (id.equals(ComponentFactory.getWebID(form, element))) {
GraphicalComponent gc = (GraphicalComponent) view.labelsFor.get(((ISupportName) element).getName());
if (gc != null) {
TextualStyle styleObj = new TextualStyle();
BorderAndPadding ins = TemplateGenerator.applyBaseComponentProperties(gc, view.fc.getForm(), styleObj, (Insets) TemplateGenerator.DEFAULT_LABEL_PADDING.clone(), null, application);
if (ins.border != null)
borderWidth = ins.border.left + ins.border.right;
}
}
}
int headerPadding = TemplateGenerator.SORTABLE_HEADER_PADDING;
// If there is no label-for, we leave place for the default border placed at the right of headers.
if (view.labelsFor.size() == 0) {
int extraWidth = TemplateGenerator.NO_LABELFOR_DEFAULT_BORDER_WIDTH;
String headerBorder = view.getHeaderBorder();
if (headerBorder != null) {
Properties properties = new Properties();
Insets borderIns = ComponentFactoryHelper.createBorderCSSProperties(headerBorder, properties);
extraWidth = borderIns.left + borderIns.right;
headerPadding = 0;
}
borderWidth += extraWidth;
}
// we have only left padding
int clientWidth = width - headerPadding - borderWidth;
// if we have grid_style for the header, then don't change the header width
this.width = (view.labelsFor.size() == 0 && view.getHeaderBorder() != null) ? width : clientWidth;
StyleAppendingModifier widthStyleModifier = new StyleAppendingModifier(new Model<String>() {
@Override
public String getObject() {
// $NON-NLS-1$//$NON-NLS-2$
return "width: " + SortableCellViewHeader.this.width + "px";
}
});
add(widthStyleModifier);
headerColumnTable.add(widthStyleModifier);
labelResolver.setWidth(clientWidth - SortableCellViewHeader.ARROW_WIDTH);
getStylePropertyChanges().setChanged();
}
use of com.servoy.j2db.persistence.ISupportName in project servoy-client by Servoy.
the class ComponentFactory method getWebID.
public static String getWebID(Form form, IPersist meta) {
StringBuilder prefix = new StringBuilder();
// to stay javascript id ref compatible
prefix.append(WEB_ID_PREFIX);
if (element_name_as_uid_prefix == null) {
Settings s = Settings.getInstance();
element_name_as_uid_prefix = Boolean.valueOf(Utils.getAsBoolean(s.getProperty("servoy.webclient.templates.element_name_as_uid_prefix")));
}
if (element_name_as_uid_prefix == Boolean.TRUE && meta instanceof ISupportName) {
String name = ((ISupportName) meta).getName();
if (name != null && name.trim().length() != 0) {
prefix.append('_');
prefix.append(name);
}
}
prefix.append('_');
String uid = meta.getUUID().toString();
uid = Utils.stringReplace(uid, "-", "_");
prefix.append(uid);
return prefix.toString();
}
use of com.servoy.j2db.persistence.ISupportName in project servoy-client by Servoy.
the class JSSecurity method hasFormAccess.
private boolean hasFormAccess(String formName, String elementName, int accessType) {
Form form = application.getFlattenedSolution().getForm(formName);
int access = 0;
if (form != null) {
UUID accesUUID = null;
if (elementName != null) {
for (IPersist persist : form.getFlattenedFormElementsAndLayoutContainers()) {
if (persist instanceof ISupportName && Utils.equalObjects(elementName, ((ISupportName) persist).getName())) {
accesUUID = persist.getUUID();
break;
}
}
} else {
accesUUID = form.getUUID();
}
if (accesUUID != null) {
access = application.getFlattenedSolution().getSecurityAccess(accesUUID, form.getImplicitSecurityNoRights() ? IRepository.IMPLICIT_FORM_NO_ACCESS : IRepository.IMPLICIT_FORM_ACCESS);
}
}
return ((access & accessType) != 0);
}
use of com.servoy.j2db.persistence.ISupportName in project servoy-client by Servoy.
the class JSSecurity method js_getElementUUIDs.
/**
* Returns the form elements UUID's as dataset, the one with no name is the form itself.
*
* @sample var formElementsUUIDDataSet = security.getElementUUIDs('orders_form');
*
* @param formname the formname to retieve the dataset for
* @return dataset with element info
*/
public // return dataset with name, uuid (note: null name is form uuid)
JSDataSet js_getElementUUIDs(// return dataset with name, uuid (note: null name is form uuid)
String formname) {
Form f = application.getFlattenedSolution().getForm(formname);
if (f == null)
f = application.getFormManager().getPossibleForm(formname);
if (f != null) {
List elements = new ArrayList();
elements.add(new Object[] { null, f.getUUID() });
Iterator<? extends IPersist> it = f.isResponsiveLayout() ? f.getFlattenedObjects(NameComparator.INSTANCE).iterator() : f.getAllObjects();
while (it.hasNext()) {
IPersist elem = it.next();
int type = elem.getTypeID();
if (type == IRepository.GRAPHICALCOMPONENTS || type == IRepository.FIELDS || type == IRepository.PORTALS || type == IRepository.RECTSHAPES || type == IRepository.SHAPES || type == IRepository.BEANS || type == IRepository.TABPANELS || type == IRepository.WEBCOMPONENTS) {
if (elem instanceof ISupportName && ((ISupportName) elem).getName() != null) {
elements.add(new Object[] { ((ISupportName) elem).getName(), elem.getUUID() });
}
}
}
IDataSet set = new BufferedDataSet(new String[] { "name", "uuid" }, elements);
return new JSDataSet(application, set);
}
return new JSDataSet(application);
}
Aggregations