Package org.locationtech.udig.style.advanced.common.styleattributeclasses

Examples of org.locationtech.udig.style.advanced.common.styleattributeclasses.RuleWrapper


        propertiesComposite.setLayout(propertiesStackLayout);
        GridData propertiesCompositeGD = new GridData(SWT.FILL, SWT.FILL, true, true);
        // propertiesCompositeGD.horizontalSpan = 2;
        propertiesComposite.setLayoutData(propertiesCompositeGD);

        RuleWrapper ruleWrapper = styleWrapper.getFirstRule();
        if (ruleWrapper != null) {
            setRuleToSelected(ruleWrapper);
        } else {
            // if it came here, nothing to select
            Label l = new Label(propertiesComposite, SWT.SHADOW_ETCHED_IN);
View Full Code Here


                if (selectedItem instanceof FeatureTypeStyleWrapper) {
                    showEmptyLabel();
                }

                if (selectedItem instanceof RuleWrapper) {
                    RuleWrapper currentSelectedRule = (RuleWrapper) selectedItem;
                    if (propertiesComposite != null) {
                        if (linePropertieComposite == null) {
                            linePropertieComposite = new LinePropertiesComposite(LinePropertiesEditor.this, propertiesComposite);
                        }
                        linePropertieComposite.setRule(currentSelectedRule);
View Full Code Here

        addButton.setToolTipText(Messages.LinePropertiesEditor_6);
        addButton.addSelectionListener(new SelectionAdapter(){
            public void widgetSelected( SelectionEvent e ) {
                FeatureTypeStyleWrapper selectedFtsw = getSelectedFtsw();
                if (selectedFtsw == null) {
                    RuleWrapper selectedRule = getSelectedRule();
                    if (selectedRule != null) {
                        selectedFtsw = selectedRule.getParent();
                    }
                }
                if (selectedFtsw == null) {
                    MessageDialog.openWarning(addButton.getShell(), Messages.LinePropertiesEditor_7,
                            Messages.LinePropertiesEditor_8);
                    return;
                }
                RuleWrapper addedRuleWrapper = selectedFtsw.addRule(null, LineSymbolizerWrapper.class);
                String tmpName = Messages.LinePropertiesEditor_9;
                tmpName = Utilities.checkSameNameRule(addedRuleWrapper.getParent().getRulesWrapperList(), tmpName);
                addedRuleWrapper.setName(tmpName);

                reloadGroupsAndRules();
                refreshPreviewCanvasOnStyle();
                setRuleToSelected(addedRuleWrapper);
            }
        });

        Button deleteButton = new Button(rulesGroup, SWT.PUSH);
        deleteButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
        deleteButton.setImage(delImg);
        deleteButton.setToolTipText(Messages.LinePropertiesEditor_10);
        deleteButton.addSelectionListener(new SelectionAdapter(){
            public void widgetSelected( SelectionEvent e ) {
                FeatureTypeStyleWrapper selectedFtsw = getSelectedFtsw();
                RuleWrapper selectedRule = getSelectedRule();
                if (selectedFtsw != null) {
                    styleWrapper.removeFeatureTypeStyle(selectedFtsw);
                } else if (selectedRule != null) {
                    selectedRule.getParent().removeRule(selectedRule);
                } else {
                    MessageDialog.openWarning(addButton.getShell(), Messages.LinePropertiesEditor_11, Messages.LinePropertiesEditor_12);
                    return;
                }
View Full Code Here

        saveButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
        saveButton.setImage(saveImg);
        saveButton.setToolTipText(Messages.LinePropertiesEditor_16);
        saveButton.addSelectionListener(new SelectionAdapter(){
            public void widgetSelected( SelectionEvent e ) {
                RuleWrapper selectedRule = getSelectedRule();

                FeatureTypeStyle featureTypeStyle = Utilities.sf.createFeatureTypeStyle();
                featureTypeStyle.rules().add(selectedRule.getRule());
                Style namedStyle = Utilities.sf.createStyle();
                namedStyle.featureTypeStyles().add(featureTypeStyle);
                namedStyle.setName(selectedRule.getName());

                try {
                    lineStyleManager.addStyle(new StyleWrapper(namedStyle));
                } catch (Exception e1) {
                    e1.printStackTrace();
View Full Code Here

        }

        styleWrapper = new StyleWrapper(style);

        groupRulesTreeViewer.setInput(styleWrapper.getFeatureTypeStylesWrapperList());
        RuleWrapper ruleWrapper = styleWrapper.getFirstRule();
        if (ruleWrapper != null) {
            setRuleToSelected(ruleWrapper);
            refreshTreeViewer(ruleWrapper);
            refreshPreviewCanvasOnStyle();
        }
View Full Code Here

    protected RuleWrapper getSelectedRule() {
        TreeSelection selection = (TreeSelection) groupRulesTreeViewer.getSelection();
        Object firstElement = selection.getFirstElement();
        if (firstElement instanceof RuleWrapper) {
            RuleWrapper wrapper = (RuleWrapper) firstElement;
            return wrapper;
        }
        return null;
    }
View Full Code Here

        return null;
    }

    protected void swap( boolean doUp ) {
        FeatureTypeStyleWrapper selectedFtsw = getSelectedFtsw();
        RuleWrapper selectedRule = getSelectedRule();
        if (selectedFtsw != null) {
            List<FeatureTypeStyleWrapper> featureTypeStylesWrapperList = selectedFtsw.getParent()
                    .getFeatureTypeStylesWrapperList();
            if (featureTypeStylesWrapperList.size() < 2) {
                return;
            }
            int ftsWIndex = featureTypeStylesWrapperList.indexOf(selectedFtsw);
            if (doUp) {
                if (ftsWIndex > 0) {
                    styleWrapper.swap(ftsWIndex, ftsWIndex - 1);
                    reloadGroupsAndRules();
                    refreshPreviewCanvasOnStyle();
                }
            } else {
                if (ftsWIndex < featureTypeStylesWrapperList.size() - 1) {
                    styleWrapper.swap(ftsWIndex + 1, ftsWIndex);
                    reloadGroupsAndRules();
                    refreshPreviewCanvasOnStyle();
                }
            }
        } else if (selectedRule != null) {
            FeatureTypeStyleWrapper featureTypeStyleWrapper = selectedRule.getParent();
            List<RuleWrapper> rulesWrapperList = featureTypeStyleWrapper.getRulesWrapperList();
            if (rulesWrapperList.size() < 2) {
                return;
            }
            int ruleWrapperIndex = rulesWrapperList.indexOf(selectedRule);
View Full Code Here

     */
    public static String checkSameNameRule( List<RuleWrapper> rulesWrapper, String ruleName ) {
        int index = 1;
        String name = ruleName.trim();
        for( int i = 0; i < rulesWrapper.size(); i++ ) {
            RuleWrapper ruleWrapper = rulesWrapper.get(i);
            String tmpName = ruleWrapper.getName();
            if (tmpName == null) {
                continue;
            }

            tmpName = tmpName.trim();
View Full Code Here

        propertiesComposite.setLayout(propertiesStackLayout);
        GridData propertiesCompositeGD = new GridData(SWT.FILL, SWT.FILL, true, true);
        // propertiesCompositeGD.horizontalSpan = 2;
        propertiesComposite.setLayoutData(propertiesCompositeGD);

        RuleWrapper ruleWrapper = styleWrapper.getFirstRule();
        if (ruleWrapper != null) {
            setRuleToSelected(ruleWrapper);
        } else {
            // if it came here, nothing to select
            Label l = new Label(propertiesComposite, SWT.SHADOW_ETCHED_IN);
View Full Code Here

                if (selectedItem instanceof FeatureTypeStyleWrapper) {
                    showEmptyLabel();
                }

                if (selectedItem instanceof RuleWrapper) {
                    RuleWrapper currentSelectedRule = (RuleWrapper) selectedItem;
                    if (propertiesComposite != null) {
                        if (pointPropertieComposite == null) {
                            pointPropertieComposite = new PointPropertiesComposite(PointPropertiesEditor.this,
                                    propertiesComposite);
                        }
View Full Code Here

TOP

Related Classes of org.locationtech.udig.style.advanced.common.styleattributeclasses.RuleWrapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.