use of com.twinsoft.convertigo.beans.mobile.components.PageComponent in project convertigo by convertigo.
the class MobilePageComponentTreeObject method getNamedSourceSelector.
@Override
public NamedSourceSelector getNamedSourceSelector() {
return new NamedSourceSelector() {
@Override
Object thisTreeObject() {
return MobilePageComponentTreeObject.this;
}
@Override
protected List<String> getPropertyNamesForSource(Class<?> c) {
List<String> list = new ArrayList<String>();
if (getObject() instanceof PageComponent) {
if (ProjectTreeObject.class.isAssignableFrom(c) || MobileApplicationTreeObject.class.isAssignableFrom(c) || MobileApplicationComponentTreeObject.class.isAssignableFrom(c) || MobileUIComponentTreeObject.class.isAssignableFrom(c)) {
list.add("menu");
}
}
return list;
}
@Override
protected boolean isNamedSource(String propertyName) {
if (getObject() instanceof PageComponent) {
return "menu".equals(propertyName);
}
return false;
}
@Override
public boolean isSelectable(String propertyName, Object nsObject) {
if (getObject() instanceof PageComponent) {
if ("menu".equals(propertyName)) {
PageComponent pc = getObject();
if (nsObject instanceof UIDynamicMenu) {
return (((UIDynamicMenu) nsObject).getProject().equals(pc.getProject()));
}
}
}
return false;
}
@Override
protected void handleSourceCleared(String propertyName) {
// nothing to do
}
@Override
protected void handleSourceRenamed(String propertyName, String oldName, String newName) {
if (isNamedSource(propertyName)) {
boolean hasBeenRenamed = false;
String pValue = (String) getPropertyValue(propertyName);
if (pValue != null && pValue.startsWith(oldName)) {
String _pValue = newName + pValue.substring(oldName.length());
if (!pValue.equals(_pValue)) {
if (getObject() instanceof PageComponent) {
if ("menu".equals(propertyName)) {
getObject().setMenu(_pValue);
hasBeenRenamed = true;
}
}
}
}
if (hasBeenRenamed) {
hasBeenModified(true);
ConvertigoPlugin.projectManager.getProjectExplorerView().updateTreeObject(MobilePageComponentTreeObject.this);
// refresh editors (e.g labels in combobox)
getDescriptors();
TreeObjectEvent treeObjectEvent = new TreeObjectEvent(MobilePageComponentTreeObject.this, propertyName, "", "");
ConvertigoPlugin.projectManager.getProjectExplorerView().fireTreeObjectPropertyChanged(treeObjectEvent);
}
}
}
};
}
use of com.twinsoft.convertigo.beans.mobile.components.PageComponent in project convertigo by convertigo.
the class MobilePageComponentTreeObject method rename.
@Override
public boolean rename(String newName, boolean bDialog) {
PageComponent page = getObject();
String oldName = page.getName();
boolean isRenamed = super.rename(newName, bDialog);
if (isRenamed && !oldName.equals(newName)) {
String oldSegment = page.getSegment();
if (oldSegment.equals(PageComponent.SEGMENT_PREFIX + oldName.toLowerCase())) {
// path-to-<page_name>
page.setSegment(oldSegment.replace(oldName.toLowerCase(), newName.toLowerCase()));
Engine.logEngine.debug("For page renamed to \"" + newName + "\", segment has been replaced with \"" + page.getSegment() + "\"");
}
}
return isRenamed;
}
use of com.twinsoft.convertigo.beans.mobile.components.PageComponent in project convertigo by convertigo.
the class MobileRouteActionComponentTreeObject method getNamedSourceSelector.
@Override
public NamedSourceSelector getNamedSourceSelector() {
return new NamedSourceSelector() {
@Override
Object thisTreeObject() {
return MobileRouteActionComponentTreeObject.this;
}
@Override
protected List<String> getPropertyNamesForSource(Class<?> c) {
List<String> list = new ArrayList<String>();
if (getObject() instanceof RouteActionComponent) {
if (ProjectTreeObject.class.isAssignableFrom(c) || MobileApplicationTreeObject.class.isAssignableFrom(c) || MobileApplicationComponentTreeObject.class.isAssignableFrom(c) || MobilePageComponentTreeObject.class.isAssignableFrom(c)) {
list.add("page");
}
}
return list;
}
@Override
protected boolean isNamedSource(String propertyName) {
if (getObject() instanceof RouteActionComponent) {
return "page".equals(propertyName);
}
return false;
}
@Override
public boolean isSelectable(String propertyName, Object nsObject) {
if (getObject() instanceof RouteActionComponent) {
if ("page".equals(propertyName)) {
RouteActionComponent rc = getObject();
if (rc instanceof RouteDataActionComponent) {
if (nsObject instanceof PageComponent) {
return (((PageComponent) nsObject).getProject().equals(rc.getProject()));
}
}
}
}
return false;
}
@Override
protected void handleSourceCleared(String propertyName) {
// nothing to do
}
@Override
protected void handleSourceRenamed(String propertyName, String oldName, String newName) {
if (isNamedSource(propertyName)) {
boolean hasBeenRenamed = false;
String pValue = (String) getPropertyValue(propertyName);
if (pValue != null && pValue.startsWith(oldName)) {
String _pValue = newName + pValue.substring(oldName.length());
if (!pValue.equals(_pValue)) {
if (getObject() instanceof RouteActionComponent) {
if ("page".equals(propertyName)) {
getObject().setPage(_pValue);
hasBeenRenamed = true;
}
}
}
}
if (hasBeenRenamed) {
hasBeenModified(true);
ConvertigoPlugin.projectManager.getProjectExplorerView().updateTreeObject(MobileRouteActionComponentTreeObject.this);
// refresh editors (e.g labels in combobox)
getDescriptors();
TreeObjectEvent treeObjectEvent = new TreeObjectEvent(MobileRouteActionComponentTreeObject.this, propertyName, "", "");
ConvertigoPlugin.projectManager.getProjectExplorerView().fireTreeObjectPropertyChanged(treeObjectEvent);
}
}
}
};
}
use of com.twinsoft.convertigo.beans.mobile.components.PageComponent in project convertigo by convertigo.
the class SharedComponentWizard method doFinish.
private void doFinish(IProgressMonitor monitor) throws CoreException {
UISharedComponent uisc = null;
UIUseShared uius = null;
try {
if (page1 != null) {
shared_comp_name = page1.getSharedComponentName();
keep_original = page1.keepComponent();
}
if (page2 != null) {
dlg_map = page2.getVariableMap();
}
// Create shared component
uisc = createSharedComponent();
monitor.setTaskName("SharedComponent created");
monitor.worked(1);
// Create UseShared
uius = createUseShared(uisc.getQName());
monitor.setTaskName("UseShared component created");
monitor.worked(1);
// Disable or Remove selected databaseObject(s)
for (DatabaseObject dbo : objectList) {
UIComponent uic = (UIComponent) dbo;
if (keep_original) {
uic.setEnabled(false);
uic.hasChanged = true;
} else {
MobileComponent mc = (MobileComponent) uic.getParent();
if (mc instanceof ApplicationComponent) {
ApplicationComponent parent = (ApplicationComponent) mc;
parent.remove(uic);
parent.hasChanged = true;
} else if (mc instanceof PageComponent) {
PageComponent parent = (PageComponent) mc;
parent.remove(uic);
parent.hasChanged = true;
} else if (mc instanceof UIComponent) {
UIComponent parent = (UIComponent) mc;
parent.remove(uic);
parent.hasChanged = true;
}
}
}
// Set newBean to new shared component
newBean = uisc;
} catch (Exception e) {
try {
if (uisc != null) {
uisc.getParent().remove(uisc);
}
if (uius != null) {
uius.getParent().remove(uius);
}
} catch (Exception ex) {
}
String message = "Unable to create a new object from class '" + this.className + "'.";
ConvertigoPlugin.logException(e, message);
newBean = null;
}
}
use of com.twinsoft.convertigo.beans.mobile.components.PageComponent in project convertigo by convertigo.
the class SharedComponentWizard method createUseShared.
private UIUseShared createUseShared(String qname) throws Exception {
UIUseShared uius = new UIUseShared();
uius.setSharedComponentQName(qname);
uius.hasChanged = true;
uius.bNew = true;
for (String name : dlg_map.keySet()) {
String value = ovarMap.get(name).keySet().iterator().next();
uius.add(createControlVariable(dlg_map.get(name), value));
}
UIComponent uic = (UIComponent) getLastInList();
MobileComponent mc = (MobileComponent) uic.getParent();
if (mc instanceof ApplicationComponent) {
ApplicationComponent parent = (ApplicationComponent) mc;
parent.add((DatabaseObject) uius, uic.priority);
} else if (mc instanceof PageComponent) {
PageComponent parent = (PageComponent) mc;
parent.add((DatabaseObject) uius, uic.priority);
} else if (mc instanceof UIComponent) {
UIComponent parent = (UIComponent) mc;
parent.add((DatabaseObject) uius, uic.priority);
}
return uius;
}
Aggregations