Java 类com.google.gwt.dom.client.Style.FontStyle 实例源码

项目:platypus-js    文件:PublishedCell.java   
public final void styleToElementBackgroundToTd(Element aElement) {
    if (aElement != null) {
        Style eStyle = aElement.getStyle();
        if (getBackground() != null){
            Element td = aElement;
            while(td != null && !"td".equalsIgnoreCase(td.getTagName())){
                td = td.getParentElement();
            }
            if(td != null){
                td.getStyle().setBackgroundColor(getBackground().toStyled());
            }
        }
        if (getForeground() != null) {
            eStyle.setColor(getForeground().toStyled());
        }
        if (getFont() != null) {
            eStyle.setFontSize(getFont().getSize(), Unit.PT);
            eStyle.setFontStyle(getFont().isItalic() ? FontStyle.ITALIC : FontStyle.NORMAL);
            eStyle.setFontWeight(getFont().isBold() ? FontWeight.BOLD : FontWeight.NORMAL);
        }
    }
}
项目:unitimes    文件:TeachingRequestDetailPage.java   
public RequestConflicts(List<AssignmentInfo> conflicts, int column) {
    super("conflicts");
    for (AssignmentInfo conflict: conflicts) {
        int idx = 0;
        for (SectionInfo section: conflict.getRequest().getSections()) {
            P conf = new P("conflict");
            switch (column) {
            case 0:
                if (idx == 0) conf.setText(conflict.getRequest().getCourse().getCourseName());
                else conf.setHTML("<br>");
                break;
            case 1:
                conf.setText(section.getSectionType() + (section.getExternalId() == null ? "" : " " + section.getExternalId()));
                break;
            case 2:
                conf.setHTML(section.getTime() == null ? SECTMSG.arrangeHours() : section.getTime());
                break;
            case 3:
                conf.setHTML(section.getDate() == null ? SECTMSG.noDate() : section.getDate());
                break;
            case 4:
                conf.setHTML(section.getRoom() == null ? SECTMSG.noRoom() : section.getRoom());
                break;
            case 5:
                if (idx == 0 && conflict.hasConflicts()) conf.setText(conflict.getConflicts(", "));
                else conf.setHTML("<br>");
                break;
            }
            if (section.isCommon()) conf.getElement().getStyle().setFontStyle(FontStyle.ITALIC);
            idx ++;
            add(conf);
        }
    }
}
项目:unitimes    文件:TeachingRequestDetailPage.java   
public InstructorConflicts(List<AssignmentInfo> conflicts, int column) {
    super("conflicts");
    for (AssignmentInfo conflict: conflicts) {
        P conf = new P("conflict");
        int idx = 0;
        for (Iterator<SectionInfo> i = conflict.getRequest().getSections().iterator(); i.hasNext(); ) {
            SectionInfo section = i.next();
            P sct = new P("section");
            switch (column) {
            case 0:
                if (idx == 0) sct.setText(conflict.getRequest().getCourse().getCourseName());
                break;
            case 1:
                sct.setText(section.getSectionType() + (section.getExternalId() == null ? "" : " " + section.getExternalId()) + (i.hasNext() ? "," : ""));
                break;
            case 2:
                if (idx == 0) {
                    InstructorInfo instructor = conflict.getRequest().getInstructor(conflict.getIndex());
                    if (instructor != null) sct.setText(instructor.getInstructorName());
                }
                break;
            }
            if (section.isCommon()) sct.getElement().getStyle().setFontStyle(FontStyle.ITALIC);
            idx ++;
            conf.add(sct);
        }
        add(conf);
    }
}
项目:unitimes    文件:CurriculaCourses.java   
public Group(String name, int type, boolean editable) {
    super(name, false);
    iName = name;
    iType = type;
    iGroupEditable = editable;
    setStylePrimaryName("unitime-TinyLabel" + (iType == 1 ? "White" : ""));
    if (iEditable && !iGroupEditable)
        getElement().getStyle().setFontStyle(FontStyle.ITALIC);
    if (iEditable && iGroupEditable) {
        addClickHandler(iNewGroupDialog.getClickHandler());
        getElement().getStyle().setCursor(Cursor.POINTER);
    }
    iOperation = new Operation() {
        @Override
        public String getName() {
            return getElement().getString();
        }
        @Override
        public boolean hasSeparator() {
            return false;
        }

        @Override
        public boolean isApplicable() {
            return iEditable && iGroupEditable && iVisibleCourses == null;
        }

        @Override
        public void execute() {
            assignGroup(null, iName, iType);
        }
    };
}
项目:unitimes    文件:TimetableGrid.java   
private Meeting(TimetableGridCell cell, boolean showRoom, boolean showInstructor, boolean showTime, boolean showPreference, boolean showDate) {
    super();
    iCell = cell;

       setStyleName("meeting");
       if (cell.hasBackground())
        getElement().getStyle().setBackgroundColor(cell.getBackground());

       P header = new P("header", "label");
       header.setHeight(sLineHeight * cell.getNrNames());
       header.setHTML(cell.getName("<br>"));
       header.getElement().getStyle().setWhiteSpace(WhiteSpace.NOWRAP);
       if (cell.isItalics())
        header.getElement().getStyle().setFontStyle(FontStyle.ITALIC);
       add(header);

       P footer = new P("footer");
       String notes = "";
       if (showTime && cell.hasTime()) notes += (notes.isEmpty() ? "" : "<br>") + cell.getTime();
       if (showDate && cell.hasDate()) notes += (notes.isEmpty() ? "" : "<br>") + cell.getDate();
       if (showRoom && cell.getNrRooms() > 0) notes += (notes.isEmpty() ? "" : "<br>") + cell.getRoom("<br>");
       if (showInstructor && cell.getNrInstructors() > 0) notes += (notes.isEmpty() ? "" : "<br>") + cell.getInstructor("<br>");
       if (showPreference && cell.hasPreference()) notes += (notes.isEmpty() ? "" : "<br>") + "<span style='color:rgb(200,200,200)'>" + cell.getPreference() + "</span>";
       footer.setHTML(notes);
       footer.getElement().getStyle().setWhiteSpace(WhiteSpace.NOWRAP);
       add(footer);

       sinkEvents(Event.ONCLICK);
    sinkEvents(Event.ONMOUSEOVER);
    sinkEvents(Event.ONMOUSEOUT);

    getElement().getStyle().setPosition(Position.ABSOLUTE);
}
项目:unitime    文件:TeachingRequestDetailPage.java   
public RequestConflicts(List<AssignmentInfo> conflicts, int column) {
    super("conflicts");
    for (AssignmentInfo conflict: conflicts) {
        int idx = 0;
        for (SectionInfo section: conflict.getRequest().getSections()) {
            P conf = new P("conflict");
            switch (column) {
            case 0:
                if (idx == 0) conf.setText(conflict.getRequest().getCourse().getCourseName());
                else conf.setHTML("<br>");
                break;
            case 1:
                conf.setText(section.getSectionType() + (section.getExternalId() == null ? "" : " " + section.getExternalId()));
                break;
            case 2:
                conf.setHTML(section.getTime() == null ? SECTMSG.arrangeHours() : section.getTime());
                break;
            case 3:
                conf.setHTML(section.getDate() == null ? SECTMSG.noDate() : section.getDate());
                break;
            case 4:
                conf.setHTML(section.getRoom() == null ? SECTMSG.noRoom() : section.getRoom());
                break;
            case 5:
                if (idx == 0 && conflict.hasConflicts()) conf.setText(conflict.getConflicts(", "));
                else conf.setHTML("<br>");
                break;
            }
            if (section.isCommon()) conf.getElement().getStyle().setFontStyle(FontStyle.ITALIC);
            idx ++;
            add(conf);
        }
    }
}
项目:unitime    文件:TeachingRequestDetailPage.java   
public InstructorConflicts(List<AssignmentInfo> conflicts, int column) {
    super("conflicts");
    for (AssignmentInfo conflict: conflicts) {
        P conf = new P("conflict");
        int idx = 0;
        for (Iterator<SectionInfo> i = conflict.getRequest().getSections().iterator(); i.hasNext(); ) {
            SectionInfo section = i.next();
            P sct = new P("section");
            switch (column) {
            case 0:
                if (idx == 0) sct.setText(conflict.getRequest().getCourse().getCourseName());
                break;
            case 1:
                sct.setText(section.getSectionType() + (section.getExternalId() == null ? "" : " " + section.getExternalId()) + (i.hasNext() ? "," : ""));
                break;
            case 2:
                if (idx == 0) {
                    InstructorInfo instructor = conflict.getRequest().getInstructor(conflict.getIndex());
                    if (instructor != null) sct.setText(instructor.getInstructorName());
                }
                break;
            }
            if (section.isCommon()) sct.getElement().getStyle().setFontStyle(FontStyle.ITALIC);
            idx ++;
            conf.add(sct);
        }
        add(conf);
    }
}
项目:unitime    文件:CurriculaCourses.java   
public Group(String name, int type, boolean editable) {
    super(name, false);
    iName = name;
    iType = type;
    iGroupEditable = editable;
    setStylePrimaryName("unitime-TinyLabel" + (iType == 1 ? "White" : ""));
    if (iEditable && !iGroupEditable)
        getElement().getStyle().setFontStyle(FontStyle.ITALIC);
    if (iEditable && iGroupEditable) {
        addClickHandler(iNewGroupDialog.getClickHandler());
        getElement().getStyle().setCursor(Cursor.POINTER);
    }
    iOperation = new Operation() {
        @Override
        public String getName() {
            return getElement().getString();
        }
        @Override
        public boolean hasSeparator() {
            return false;
        }

        @Override
        public boolean isApplicable() {
            return iEditable && iGroupEditable && iVisibleCourses == null;
        }

        @Override
        public void execute() {
            assignGroup(null, iName, iType);
        }
    };
}
项目:unitime    文件:TimetableGrid.java   
private Meeting(TimetableGridCell cell, boolean showRoom, boolean showInstructor, boolean showTime, boolean showPreference, boolean showDate) {
    super();
    iCell = cell;

       setStyleName("meeting");
       if (cell.hasBackground())
        getElement().getStyle().setBackgroundColor(cell.getBackground());

       P header = new P("header", "label");
       header.setHeight(sLineHeight * cell.getNrNames());
       header.setHTML(cell.getName("<br>"));
       header.getElement().getStyle().setWhiteSpace(WhiteSpace.NOWRAP);
       if (cell.isItalics())
        header.getElement().getStyle().setFontStyle(FontStyle.ITALIC);
       add(header);

       P footer = new P("footer");
       String notes = "";
       if (showTime && cell.hasTime()) notes += (notes.isEmpty() ? "" : "<br>") + cell.getTime();
       if (showDate && cell.hasDate()) notes += (notes.isEmpty() ? "" : "<br>") + cell.getDate();
       if (showRoom && cell.getNrRooms() > 0) notes += (notes.isEmpty() ? "" : "<br>") + cell.getRoom("<br>");
       if (showInstructor && cell.getNrInstructors() > 0) notes += (notes.isEmpty() ? "" : "<br>") + cell.getInstructor("<br>");
       if (showPreference && cell.hasPreference()) notes += (notes.isEmpty() ? "" : "<br>") + "<span style='color:rgb(200,200,200)'>" + cell.getPreference() + "</span>";
       footer.setHTML(notes);
       footer.getElement().getStyle().setWhiteSpace(WhiteSpace.NOWRAP);
       add(footer);

       sinkEvents(Event.ONCLICK);
    sinkEvents(Event.ONMOUSEOVER);
    sinkEvents(Event.ONMOUSEOUT);

    getElement().getStyle().setPosition(Position.ABSOLUTE);
}
项目:platypus-js    文件:PublishedCell.java   
public final void styleToElement(Element aElement) {
    if (aElement != null) {
        Style eStyle = aElement.getStyle();
        if (getBackground() != null)
            eStyle.setBackgroundColor(getBackground().toStyled());
        if (getForeground() != null) {
            eStyle.setColor(getForeground().toStyled());
        }
        if (getFont() != null) {
            eStyle.setFontSize(getFont().getSize(), Unit.PT);
            eStyle.setFontStyle(getFont().isItalic() ? FontStyle.ITALIC : FontStyle.NORMAL);
            eStyle.setFontWeight(getFont().isBold() ? FontWeight.BOLD : FontWeight.NORMAL);
        }
    }
}
项目:hexa.tools    文件:GrowingTextArea.java   
void applyStyle( Element element )
{
    element.getStyle().setPadding( 5, Unit.PX );
    element.getStyle().setBorderColor( "black" );
    element.getStyle().setBorderStyle( BorderStyle.SOLID );
    element.getStyle().setBorderWidth( 1, Unit.PX );

    element.getStyle().setProperty( "fontFamily", "Arial Unicode MS,Arial,sans-serif" );

    element.getStyle().setFontSize( 12, Unit.PT );
    element.getStyle().setFontStyle( FontStyle.NORMAL );
    element.getStyle().setFontWeight( FontWeight.NORMAL );
}
项目:unitimes    文件:AcademicSessionSelector.java   
EmptyTableCell(String text) {
    super(text, false);
    getElement().getStyle().setFontStyle(FontStyle.ITALIC);
}
项目:che    文件:StyleConfigurator.java   
public Builder withFontStyle(FontStyle fontStyle) {
  this.fontStyle = fontStyle;
  return this;
}
项目:unitime    文件:AcademicSessionSelector.java   
EmptyTableCell(String text) {
    super(text, false);
    getElement().getStyle().setFontStyle(FontStyle.ITALIC);
}
项目:daris    文件:SplashWindow.java   
public static void show(String message, final ActionEntry ae) {
    if (!_visible) {

        WindowProperties wp = new WindowProperties();
        wp.setModal(true);
        wp.setCanBeResized(false);
        wp.setCanBeClosed(false);
        wp.setCanBeMoved(false);
        wp.setSize(0.4, 0.4);
        wp.setTitle("DaRIS Portal");
        wp.setShowHeader(false);
        wp.setShowFooter(false);

        _win = Window.create(wp);
    }

    HTML content = new HTML();
    content.setFontStyle(FontStyle.NORMAL);
    content.setFontSize(12);
    content.setFontWeight(FontWeight.BOLD);
    content.setHTML(message);
    content.setMargin(20);

    CenteringPanel cp = new CenteringPanel();
    cp.setContent(content);
    cp.setBackgroundColour(new RGB(0xb2, 0xb2, 0xb2));

    VerticalPanel vp = new VerticalPanel();
    vp.fitToParent();
    vp.add(cp);

    if (ae != null) {
        ButtonBar bb = ButtonUtil.createButtonBar(Position.BOTTOM, Alignment.RIGHT, 28);
        Button b = bb.addButton(ae.label());
        b.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                if (ae.action() != null) {
                    ae.action().execute();
                }
            }
        });
        b.setMarginRight(15);
        vp.add(bb);
    }

    _win.setContent(vp);
    _win.centerInPage();
    _win.show();
    _visible = true;
}
项目:platypus-js    文件:ThemedHeaderOrFooterBuilder.java   
protected void buildNodes(List<HeaderNode<T>> aHeaders, Map<Column<T, ?>, ColumnSortList.ColumnSortInfo> sortedColumns) {
    // AbstractCellTable<T> table = getTable();
    List<HeaderNode<T>> children = new ArrayList<>();
    boolean isFooter = isBuildingFooter();
    // Get the common style names.
    String className = isBuildingFooter() ? ThemedGridResources.instance.cellTableStyle().cellTableFooter() : ThemedGridResources.instance.cellTableStyle().cellTableHeader();
    String sortableStyle = ThemedGridResources.instance.cellTableStyle().cellTableSortableHeader();
    String sortedAscStyle = ThemedGridResources.instance.cellTableStyle().cellTableSortedHeaderAscending();
    String sortedDescStyle = ThemedGridResources.instance.cellTableStyle().cellTableSortedHeaderDescending();
    TableRowBuilder tr = startRow();
    // Loop through all column header nodes.
    for (int i = 0; i < aHeaders.size(); i++) {
        HeaderNode<T> headerNode = aHeaders.get(i);
        children.addAll(headerNode.getChildren());
        Header<?> headerOrFooter = headerNode.getHeader();
        Column<T, ?> column = null;
        if (headerOrFooter instanceof HasColumn<?>)
            column = ((HasColumn<T>) headerOrFooter).getColumn();
        boolean isSortable = !isFooter && column != null && column.isSortable();
        ColumnSortList.ColumnSortInfo sortedInfo = sortedColumns.get(column);
        boolean isSorted = sortedInfo != null;
        StringBuilder classesBuilder = new StringBuilder(className);
        boolean isSortAscending = isSortable && sortedInfo != null ? sortedInfo.isAscending() : false;
        if (isSortable) {
            if (classesBuilder.length() > 0) {
                classesBuilder.append(" ");
            }
            classesBuilder.append(sortableStyle);
            if (isSorted) {
                if (classesBuilder.length() > 0) {
                    classesBuilder.append(" ");
                }
                classesBuilder.append(isSortAscending ? sortedAscStyle : sortedDescStyle);
            }
        }
        // Render the header or footer.
        TableCellBuilder th = tr.startTH();
        if (headerNode.getDepthRemainder() > 0)
            th.rowSpan(headerNode.getDepthRemainder() + 1);
        if (headerNode.getLeavesCount() > 1)
            th.colSpan(headerNode.getLeavesCount());
        th.className(classesBuilder.toString());
        StylesBuilder thStyles = th.style();
        if (headerNode.getBackground() != null) {
            thStyles.trustedBackgroundColor(headerNode.getBackground().toStyled());
        }
        if (headerNode.getForeground() != null) {
            thStyles.trustedColor(headerNode.getForeground().toStyled());
        }
        if (headerNode.getFont() != null) {
            thStyles.trustedProperty("font-family", headerNode.getFont().getFamily());
            thStyles.fontSize(headerNode.getFont().getSize(), Style.Unit.PX);
            thStyles.fontStyle(headerNode.getFont().isItalic() ? FontStyle.ITALIC : FontStyle.NORMAL);
            thStyles.fontWeight(headerNode.getFont().isBold() ? FontWeight.BOLD : FontWeight.NORMAL);
        }
        if (headerOrFooter != null) {
            appendExtraStyles(headerOrFooter, classesBuilder);
            if (column != null) {
                enableColumnHandlers(th, column);
            }
            // Build the header.
            Cell.Context context = new Cell.Context(0, i, headerOrFooter.getKey());
            // Add div element with aria button role
            if (isSortable) {
                // TODO: Figure out aria-label and translation
                // of label text
                th.attribute("role", "button");
                th.tabIndex(-1);
            }
            renderSortableHeader(th, context, headerOrFooter, isSorted, isSortAscending);
        }
        th.endTH();
    }
    // End the row.
    tr.endTR();
    if (!children.isEmpty()) {
        buildNodes(children, sortedColumns);
    }
}
项目:SmartMonitoring    文件:LoginWidget.java   
public LoginWidget(ConfigurationServiceAsync<CC> service) {

        if (!GWT.isScript()) {
            userName.setText("admin");
            password.setText("password");
        }
        initWidget(fp);

        fp.setStyleName("login");
        Label un = new Label("User Name:");
        un.getElement().setId("label");
        fp.add(un);
        fp.add(userName);
        Label pw = new Label("Password:");
        pw.getElement().setId("label");
        fp.add(pw);
        fp.add(password);
        fp.add(login);
        fp.add(staySignedIn);
        fp.add(errorMsg);
        errorMsg.getElement().getStyle().setColor("red");
        errorMsg.getElement().getStyle().setFontStyle(FontStyle.ITALIC);

        password.addKeyPressHandler(enterhandler);
        password.getElement().setId("input");

        userName.addKeyPressHandler(enterhandler);
        userName.getElement().setId("input");

        login.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                login.setEnabled(false);
                login();
            }

        });

        final HTML version = new HTML();
        version.getElement().setId("version");
        fp.add(version);
        service.getClientConfigurations(new AsyncCallback<CC>() {

            @Override
            public void onSuccess(CC result) {
                version.setText("Env:" + result.getTitle() + ", Version:" + result.getVersion());
                Window.setTitle(result.getTitle() + ", v:" + result.getVersion());
                cc = result;

                staySignedIn.setValue(LocalStorage.readStoredItem(SSICH) != null && LocalStorage.readStoredItem(SSICH).equals("on"));
                String user = StringFormatter.Base64Decode(LocalStorage.readStoredItem(SSIU));
                String pass = StringFormatter.Base64Decode(LocalStorage.readStoredItem(SSIP));
                if (staySignedIn.getValue() && user != null && pass != null) {
                    userName.setText(user);
                    password.setText(pass);
                    login();
                }
            }

            @Override
            public void onFailure(Throwable caught) {
                version.setText("Error getting version:" + caught.getMessage());
            }
        });

    }