Differences
This shows you the differences between two versions of the page.
gallery [2012/04/09 19:00] dragan.milicev |
gallery [2012/07/09 10:55] (current) srdjan.lukovic [GUI Code] |
||
---|---|---|---|
Line 143: | Line 143: | ||
import rs.sol.soloist.helpers.init.Initializer; | import rs.sol.soloist.helpers.init.Initializer; | ||
import rs.sol.soloist.helpers.init.InitializerFailedException; | import rs.sol.soloist.helpers.init.InitializerFailedException; | ||
- | import rs.sol.soloist.server.builtindomains.builtindatatypes.Integer; | ||
- | import rs.sol.soloist.server.builtindomains.builtindatatypes.Text; | ||
import rs.sol.soloist.server.guiconfiguration.components.GUIApplicationComponent; | import rs.sol.soloist.server.guiconfiguration.components.GUIApplicationComponent; | ||
import rs.sol.soloist.server.guiconfiguration.components.GUILabelComponent; | import rs.sol.soloist.server.guiconfiguration.components.GUILabelComponent; | ||
import rs.sol.soloist.server.guiconfiguration.components.GUIPanelComponent; | import rs.sol.soloist.server.guiconfiguration.components.GUIPanelComponent; | ||
import rs.sol.soloist.server.guiconfiguration.construction.GUIComponentBinding; | import rs.sol.soloist.server.guiconfiguration.construction.GUIComponentBinding; | ||
- | import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUICollectionInput; | + | import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUIInput; |
- | import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUIElementComponent; | + | |
- | import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUIInputKind; | + | |
- | import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUISuggestWidget; | + | |
import rs.sol.soloist.server.guiconfiguration.nonvisualcompoments.GUIFindAllInstancesSAPComponent; | import rs.sol.soloist.server.guiconfiguration.nonvisualcompoments.GUIFindAllInstancesSAPComponent; | ||
import rs.sol.soloist.server.guiconfiguration.style.GUIContext; | import rs.sol.soloist.server.guiconfiguration.style.GUIContext; | ||
Line 166: | Line 161: | ||
public void init() throws InitializerFailedException { | public void init() throws InitializerFailedException { | ||
GUIApplicationComponent application = new GUIApplicationComponent(); | GUIApplicationComponent application = new GUIApplicationComponent(); | ||
- | application.name.set(Text.fromString("GallerySample")); | + | application.setName("GallerySample"); |
SoloistServiceServlet.registerApplication(application); | SoloistServiceServlet.registerApplication(application); | ||
- | application.context.set(createContextAndStyles()); | + | application.setContext(createContextAndStyles()); |
GUIPanelComponent root = GUIPanelComponent.createFlow(application); | GUIPanelComponent root = GUIPanelComponent.createFlow(application); | ||
GUILabelComponent title = GUILabelComponent.create(root, "Gallery"); | GUILabelComponent title = GUILabelComponent.create(root, "Gallery"); | ||
- | title.styleName.set(Text.fromString("titleStyle")); | + | title.setStyle("titleStyle"); |
GUIPanelComponent topPanel = GUIPanelComponent.createFlow(root); | GUIPanelComponent topPanel = GUIPanelComponent.createFlow(root); | ||
- | topPanel.styleName.set(Text.fromString("topPanel")); | + | topPanel.setStyle("topPanel"); |
- | GUILabelComponent.create(topPanel, "Choose house:").styleName.set(Text.fromString("formLabel")); | + | GUILabelComponent.create(topPanel, "Choose house:").setStyle("formLabel"); |
- | GUIFindAllInstancesSAPComponent allHouses = GUIFindAllInstancesSAPComponent.create(topPanel, House.FQ_TYPE_NAME); | + | GUIFindAllInstancesSAPComponent allHouses = GUIFindAllInstancesSAPComponent.create(topPanel, House.CLASSIFIER); |
- | GUIElementComponent suggestBox = GUIElementComponent.createInput(topPanel, new GUISuggestWidget(), new GUICollectionInput()); | + | GUIInput suggestBox = GUIInput.createSuggest(topPanel); |
- | GUIInputKind.get(suggestBox).lowerBound.set(Integer.valueOf(1)); | + | suggestBox.setLowerBound(1); |
- | GUIComponentBinding.create(allHouses.value, GUICollectionInput.get(suggestBox).collection); | + | GUIComponentBinding.create(allHouses.opValue(), suggestBox.ipCollection()); |
- | new GalleryFragment(topPanel); | + | GalleryFragment gf = new GalleryFragment(topPanel); |
- | + | GUIComponentBinding.create(suggestBox.opValue(), gf.ipOwner()); | |
- | GUIComponentBinding.create(suggestBox.value, topPanel.input); | + | |
} | } | ||
private GUIContext createContextAndStyles() { | private GUIContext createContextAndStyles() { | ||
GUIContext context = new GUIContext(); | GUIContext context = new GUIContext(); | ||
- | context.supercontext.set(DefaultContextInit.getRoot()); | + | DefaultContextInit.getRoot().addContext(context); |
GUIObjectSetting person = GUIObjectSetting.create(context, House.CLASSIFIER); | GUIObjectSetting person = GUIObjectSetting.create(context, House.CLASSIFIER); | ||
GUITextFeature.createName(person, House.PROPERTIES.code); | GUITextFeature.createName(person, House.PROPERTIES.code); | ||
Line 212: | Line 206: | ||
import rs.sol.soloist.server.builtindomains.builtincommands.CmdCreateObjectOfClass; | import rs.sol.soloist.server.builtindomains.builtincommands.CmdCreateObjectOfClass; | ||
import rs.sol.soloist.server.builtindomains.builtindatatypes.Boolean; | import rs.sol.soloist.server.builtindomains.builtindatatypes.Boolean; | ||
- | import rs.sol.soloist.server.builtindomains.builtindatatypes.Integer; | ||
- | import rs.sol.soloist.server.builtindomains.builtindatatypes.Text; | ||
import rs.sol.soloist.server.guiconfiguration.components.GUIButtonComponent; | import rs.sol.soloist.server.guiconfiguration.components.GUIButtonComponent; | ||
import rs.sol.soloist.server.guiconfiguration.components.GUICommandComponent; | import rs.sol.soloist.server.guiconfiguration.components.GUICommandComponent; | ||
Line 221: | Line 213: | ||
import rs.sol.soloist.server.guiconfiguration.components.PerformImmediately; | import rs.sol.soloist.server.guiconfiguration.components.PerformImmediately; | ||
import rs.sol.soloist.server.guiconfiguration.construction.GUIComponentBinding; | import rs.sol.soloist.server.guiconfiguration.construction.GUIComponentBinding; | ||
- | import rs.sol.soloist.server.guiconfiguration.construction.GUIFactory; | + | import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUIEdit; |
- | import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUIElementComponent; | + | |
- | import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUIFieldWidget; | + | |
- | import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUISlotEditorKind; | + | |
- | import rs.sol.soloist.server.guiconfiguration.layout.CellLayoutData; | + | |
import rs.sol.soloist.server.guiconfiguration.layout.TableLayoutData; | import rs.sol.soloist.server.guiconfiguration.layout.TableLayoutData; | ||
import rs.sol.soloist.server.guiconfiguration.layout.VerticalAlignment; | import rs.sol.soloist.server.guiconfiguration.layout.VerticalAlignment; | ||
import rs.sol.soloist.server.guiconfiguration.nonvisualcompoments.GUIBooleanFilter; | import rs.sol.soloist.server.guiconfiguration.nonvisualcompoments.GUIBooleanFilter; | ||
import rs.sol.soloist.server.guiconfiguration.nonvisualcompoments.GUIBufferComponent; | import rs.sol.soloist.server.guiconfiguration.nonvisualcompoments.GUIBufferComponent; | ||
+ | import rs.sol.soloist.server.guiconfiguration.nonvisualcompoments.GUIRelayComponent; | ||
import rs.sol.soloist.server.uml.concepts.runtime.ISlot; | import rs.sol.soloist.server.uml.concepts.runtime.ISlot; | ||
public class GalleryFragment { | public class GalleryFragment { | ||
- | private GUIPanelComponent rootPanel; | + | private ISlot<?> owner; |
- | private ISlot<Text> galleryOwner; | + | |
- | private GUIGalleryPanel galleryPanel; | + | public ISlot<?> ipOwner(){ |
+ | return owner; | ||
+ | } | ||
- | public static MoveWithinGallery moveWithinGallery = new MoveWithinGallery(); | + | public static MoveWithinGallery cmdMoveWithinGallery = new MoveWithinGallery(); |
- | public static RemoveFromGallery removeFromGallery = new RemoveFromGallery(); | + | public static RemoveFromGallery cmdRemoveFromGallery = new RemoveFromGallery(); |
public GalleryFragment(GUIPanelComponent rootPanel) { | public GalleryFragment(GUIPanelComponent rootPanel) { | ||
- | this.rootPanel = rootPanel; | + | GUIRelayComponent ownerRelay = GUIRelayComponent.create(rootPanel); |
- | this.galleryOwner = rootPanel.input; | + | owner = ownerRelay.ipRelay(); |
- | init(); | + | |
- | } | + | |
- | + | ||
- | private void init() | + | |
- | { | + | |
GUIDisclosurePanel newPictureDisclosure = GUIDisclosurePanel.create(rootPanel, "Add picture to gallery"); | GUIDisclosurePanel newPictureDisclosure = GUIDisclosurePanel.create(rootPanel, "Add picture to gallery"); | ||
GUIPanelComponent subDisclosure = GUIPanelComponent.createFlow(newPictureDisclosure); | GUIPanelComponent subDisclosure = GUIPanelComponent.createFlow(newPictureDisclosure); | ||
- | subDisclosure.styleName.set(Text.fromString("disclosureForm")); | + | subDisclosure.setStyle("disclosureForm"); |
GUIPanelComponent table = GUIPanelComponent.createTable(subDisclosure); | GUIPanelComponent table = GUIPanelComponent.createTable(subDisclosure); | ||
- | table.styleName.set(Text.fromString("table")); | + | table.setStyle("table"); |
CmdCreateObjectOfClass cmd = new CmdCreateObjectOfClass(); | CmdCreateObjectOfClass cmd = new CmdCreateObjectOfClass(); | ||
- | cmd.className.set(Text.fromString(PictureFromGallery.FQ_TYPE_NAME)); | + | cmd.setClass(PictureFromGallery.CLASSIFIER); |
GUICommandComponent cmdNewBlank = GUICommandComponent.create(rootPanel, cmd, PerformImmediately.NOTHING); | GUICommandComponent cmdNewBlank = GUICommandComponent.create(rootPanel, cmd, PerformImmediately.NOTHING); | ||
- | GUIBooleanFilter gbf = GUIBooleanFilter.create(rootPanel, newPictureDisclosure.open); | + | GUIBooleanFilter gbf = GUIBooleanFilter.create(rootPanel); |
- | GUIComponentBinding.create(gbf.yes, cmdNewBlank.click); | + | GUIComponentBinding.create(newPictureDisclosure.opOpen(), gbf.ipInput()); |
+ | GUIComponentBinding.create(gbf.opYes(), cmdNewBlank.ipClick()); | ||
int row = 0; | int row = 0; | ||
- | GUILabelComponent.create(table, "Title", row++, 0).styleName.set(Text.fromString("formLabel")); | + | GUILabelComponent.create(table, "Title", row++, 0).setStyle("formLabel"); |
- | GUILabelComponent.create(table, "Description", row++, 0).styleName.set(Text.fromString("formLabel")); | + | GUILabelComponent.create(table, "Description", row++, 0).setStyle("formLabel"); |
- | GUILabelComponent.create(table, "Picture", row++, 0).styleName.set(Text.fromString("formLabel")); | + | GUILabelComponent.create(table, "Picture", row++, 0).setStyle("formLabel"); |
row = 0; | row = 0; | ||
- | GUIElementComponent title = GUIElementComponent.createSlotEditor(table, Document.PROPERTIES.title, row++, 1); | + | GUIEdit title = GUIEdit.createField(table, Document.PROPERTIES.title, row++, 1); |
- | GUIElementComponent descrip = GUIElementComponent.createSlotEditor(table, Document.PROPERTIES.description, row++, 1); | + | GUIEdit descrip = GUIEdit.createField(table, Document.PROPERTIES.description, row++, 1); |
- | GUIFieldWidget.get(descrip).maxLength.set(Integer.valueOf(2000)); | + | descrip.setMaxLength(2000); |
- | GUIFieldWidget.get(descrip).multiline.set(Boolean.TRUE); | + | descrip.setMultiline(true); |
- | CellLayoutData.setSize(descrip, "265px", "192px"); | + | descrip.setSize("265px", "192px"); |
- | GUIPanelComponent picUpload = GUIFactory.createPictureFileComponent(table, PictureFromGallery.PROPERTIES.picture, true); | + | GUIPanelComponent picUpload = GUIEdit.createPicture(table, PictureFromGallery.PROPERTIES.picture, true); |
- | TableLayoutData.setRowColumn(picUpload, row++, 1); | + | picUpload.setRowColumn(row++, 1); |
- | GUIPanelComponent picture = GUIFactory.createPictureFileComponent(table, PictureFromGallery.PROPERTIES.picture, false); | + | GUIPanelComponent picture = GUIEdit.createPicture(table, PictureFromGallery.PROPERTIES.picture, false); |
- | TableLayoutData.setRowColumn(picture, 0, 2, 4, 1); | + | picture.setRowColumn(0, 2, 4, 1); |
- | TableLayoutData.setAlignment(picture, VerticalAlignment.TOP); | + | picture.setCellAlignment(null, VerticalAlignment.TOP); |
- | GUIComponentBinding.create(cmdNewBlank, CmdCreateObjectOfClass.PROPERTIES.output, GUISlotEditorKind.get(title).element); | + | GUIComponentBinding.create(cmdNewBlank, CmdCreateObjectOfClass.PROPERTIES.output, title.ipElement()); |
- | GUIComponentBinding.create(cmdNewBlank, CmdCreateObjectOfClass.PROPERTIES.output, GUISlotEditorKind.get(descrip).element); | + | GUIComponentBinding.create(cmdNewBlank, CmdCreateObjectOfClass.PROPERTIES.output, descrip.ipElement()); |
- | GUIComponentBinding.create(cmdNewBlank, CmdCreateObjectOfClass.PROPERTIES.output, picUpload.input); | + | GUIComponentBinding.create(cmdNewBlank, CmdCreateObjectOfClass.PROPERTIES.output, picUpload.ipRelay1()); |
- | GUIComponentBinding.create(cmdNewBlank, CmdCreateObjectOfClass.PROPERTIES.output, picture.input); | + | GUIComponentBinding.create(cmdNewBlank, CmdCreateObjectOfClass.PROPERTIES.output, picture.ipRelay1()); |
- | GUICommandComponent cmdAdd = GUIButtonComponent.create(table, "Add picture", new AddToGallery(), row++, 0); | + | GUIButtonComponent cmdAdd = GUIButtonComponent.create(table, "Add picture", new AddToGallery()); |
- | GUIComponentBinding.create(galleryOwner, cmdAdd, AddToGallery.PROPERTIES.galleryOwner); | + | cmdAdd.setLayoutData(TableLayoutData.create(row++, 0)); |
+ | GUIComponentBinding.create(ownerRelay.opRelay(), cmdAdd, AddToGallery.PROPERTIES.galleryOwner); | ||
GUIComponentBinding.create(cmdNewBlank, CmdCreateObjectOfClass.PROPERTIES.output, cmdAdd, AddToGallery.PROPERTIES.picture); | GUIComponentBinding.create(cmdNewBlank, CmdCreateObjectOfClass.PROPERTIES.output, cmdAdd, AddToGallery.PROPERTIES.picture); | ||
- | galleryPanel = new GUIGalleryPanel(); | + | GUIGalleryPanel galleryPanel = new GUIGalleryPanel(); |
- | rootPanel.children.add(galleryPanel); | + | rootPanel.add(galleryPanel); |
- | GUIComponentBinding.create(galleryOwner, galleryPanel.element); | + | GUIComponentBinding.create(ownerRelay.opRelay(), galleryPanel.ipElement()); |
- | GUIComponentBinding.create(cmdAdd.commandExecuted, galleryPanel.refreshContents); | + | GUIComponentBinding.create(cmdAdd.opCommandExecuted(), galleryPanel.ipRefreshContents()); |
- | GUIBufferComponent gbc = GUIBufferComponent.create(rootPanel, Boolean.FALSE); | + | GUIBufferComponent gbc = GUIBufferComponent.create(rootPanel, false, Boolean.FALSE); |
- | GUIComponentBinding.create(gbc.output, newPictureDisclosure.open); | + | GUIComponentBinding.create(gbc.opOutput(), newPictureDisclosure.ipOpen()); |
- | GUIComponentBinding.create(cmdAdd.commandExecuted, gbc.send); | + | GUIComponentBinding.create(cmdAdd.opCommandExecuted(), gbc.ipSend()); |
} | } | ||
- | |||
} | } | ||
</code> | </code> |