Package smilehouse.util

Examples of smilehouse.util.LabelResource


        String description = null;

        // -------------------------------------------------------
        // Try to read the localized name from a custom label file
        // -------------------------------------------------------
        LabelResource labels = PipeComponentUtils.getCustomLabelResource(locale, null, componentClass);
        if(labels != null)
            description = labels.getLabel(PipeComponentIF.COMPONENT_DESCRIPTION_LABEL_KEY);

        if(description == null)
            description = "";

        return description;
View Full Code Here


        // ----------------------------
        // Read the menus from the file
        // ----------------------------
        InputStream in = null;
        SimpleParser.Record[] menus = null;
        LabelResource labelResource = null;
        try {
            in = getClass().getResourceAsStream(menuDirectory + menuName + ".menu");
            SimpleParser parser = new SimpleParser(KEYWORDS, in);
            SimpleParser.Record all = parser.readAll();

            // --------------
            // Custom labels?
            // --------------
            SimpleParser.Entity labelEntity = all.getEntityByKeyword(LABELRESOURCE, false);
            if(labelEntity != null) {
                labelResource = getCustomLabelResource(labelEntity, lang);
            }
            if(labelResource == null)
                labelResource = new LabelResource(labels, lang);


            menus = all.getRecords(MENU);
        } finally {
            if(in != null)
View Full Code Here

        if(labelParameters.length == 1)
            customLabels = new ResourceLabelProvider(labelParameters[0]);
        else if(labelParameters.length == 2)
            customLabels = new ResourceLabelProvider(labelParameters[0], labelParameters[1]);
        if(customLabels != null)
            return new LabelResource(customLabels, lang);
        else
            return null;
    }
View Full Code Here

            ServletException {
        HttpSession session = environment.getSession(req, res);
        if(session == null) // No session? Probably the authentication failed...
            return;

        LabelResource labels = environment.getLabelResource(session);
       
        String lang = environment.getLanguage(session);

        res.setContentType(environment.getContentType());
        PrintWriter out = res.getWriter();
        try {
            Table menuBar = menuGenerator.getMenuBar(
                MENU_NAME,
                null,
                MENU_BG_IMAGE,
                MENU_SPACER_IMAGE,
                lang);
            Head head = new Head().addElement(new Link()
                .setRel("stylesheet")
                .setType("text/css")
                .setHref("smilemenu.css"));
            menuGenerator.createMenu(MENU_NAME, head, StandaloneEnvironment.standaloneZones, lang);

            TD logoCell = new TD()
                .setVAlign(AlignType.TOP)
                .setBackground(TOPBAR_BG_IMAGE)
                .addElement(new IMG("pics/logo_smilehouse.gif"));

            TR topRow = new TR().addElement(logoCell).addElement(
                new TD().setBackground(TOPBAR_BG_IMAGE)).addElement(
                new TD().setBackground(TOPBAR_BG_IMAGE).setAlign(AlignType.RIGHT).addElement(
                    new Span().addElement("OpenSyncro " + OPENSYNCRO_VERSION).setClass("syncroTitle")));

            TR menuRow = new TR().setVAlign(AlignType.TOP).addElement(
                new TD().setBackground(MENU_BG_IMAGE).setVAlign(AlignType.BOTTOM).addElement(
                    menuBar)).addElement(
                new TD()
                    .setBackground(MENU_BG_IMAGE)
                    .setAlign(AlignType.RIGHT)
                    .setColSpan(2)
                    .addElement(
                        new Span().addElement(
                            new A("Login?logout=yes", "[" + labels.getLabel("logout") + "]")
                            .setTarget("_top")).setClass("syncroText")));

            Body body = new Body().addElement(new Table()
                .setWidth("100%")
                .setBorder(0)
View Full Code Here

            if(guiContext != null) {

            // Component might have it's own labels...
               
            LabelResource customLabelResource = PipeComponentUtils.getCustomLabelResource(new Locale(
                environment.getLanguage(session)), labels, component.getClass());

            Map fields = guiContext.makeFields(component, customLabelResource, req);

            // -----------
View Full Code Here

        PrintWriter out = null;
        try {
            res.setContentType(environment.getContentType());
            out = res.getWriter();
            pers = new Persister(database);
            LabelResource labels = environment.getLabelResource(session);

            Script script = null;
            String scriptString = getScript(labels);
            if(scriptString != null)
                script = new Script()
View Full Code Here

        return label;
    }

    public LabelResource getLabelResource(String lang) {
        return new LabelResource(this, lang);
    }
View Full Code Here

    public LabelResource getLabelResource(String lang) {
        return new LabelResource(this, lang);
    }

    public LabelResource getLabelResource(HttpSession session) {
        return new LabelResource(this, getLanguage(session));
    }
View Full Code Here

    /**
     * Parses the given String to a Double-object. Uses Smilehouse.util.Utils.parseDouble for the
     * conversion. It accepts both . and , characters as the decimalseparator.
     */
    public Object stringToValue(String value, EditorResources editorResources) throws FormatterException {
      LabelResource labels = editorResources.getResource();
        // Return NaN for null or an empty string if empty values are to be accepted.
        if(acceptEmptyValues && (value == null || value.length() == 0))
            return NAN_DOUBLE;
        if(value == null)
            throw new FormatterException(labels, errorLabel, value);
View Full Code Here

     * Parses the given (Double) value to a string. The given value can also be a String-object,
     * then the string is parsed and the resulting Double.toString is returned. So this always
     * return's a . character as the decimal separator.
     */
    public String valueToString(Object value, EditorResources editorResources) throws FormatterException {
      LabelResource labels = editorResources.getResource();
        if(value == null) {
            if(acceptEmptyValues)
                return "";
            else
                throw new FormatterException(labels, errorLabel);
View Full Code Here

TOP

Related Classes of smilehouse.util.LabelResource

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.