Example usage for com.google.gwt.user.client.ui FlexTable FlexTable

List of usage examples for com.google.gwt.user.client.ui FlexTable FlexTable

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui FlexTable FlexTable.

Prototype

public FlexTable() 

Source Link

Usage

From source file:com.npisoft.officine.client.application.GridExample.java

License:sencha.com license

public ToolBar createMulti() {
    ToolBar toolBar = new ToolBar();
    toolBar.setSpacing(2);/*from  w ww.java2 s.  c  om*/

    ButtonGroup group = new ButtonGroup();
    group.setHeadingText("Clipboard");
    toolBar.add(group);

    FlexTable table = new FlexTable();
    group.add(table);

    TextButton btn = new TextButton("Cool", ExampleImages.INSTANCE.add16());
    table.setWidget(0, 0, btn);

    btn = new TextButton("Cut", ExampleImages.INSTANCE.add16());
    Menu menu = new Menu();
    menu.add(new MenuItem("Copy me"));
    btn.setMenu(menu);
    table.setWidget(0, 1, btn);

    btn = new TextButton("Copy", ExampleImages.INSTANCE.add16());
    table.setWidget(1, 0, btn);
    // //
    btn = new TextButton("Paste", ExampleImages.INSTANCE.add16());
    table.setWidget(1, 1, btn);

    group = new ButtonGroup();
    group.setHeadingText("Other Bogus Actions");
    toolBar.add(group);

    table = new FlexTable();
    group.add(table);

    btn = new TextButton("Cool", ExampleImages.INSTANCE.add16());
    table.setWidget(0, 0, btn);

    btn = new TextButton("Cut", ExampleImages.INSTANCE.add16());
    menu = new Menu();
    menu.add(new MenuItem("Copy me"));
    btn.setMenu(menu);
    table.setWidget(0, 1, btn);

    btn = new TextButton("Copy", ExampleImages.INSTANCE.add16());
    table.setWidget(1, 0, btn);
    // //
    btn = new TextButton("Paste", ExampleImages.INSTANCE.add16());
    table.setWidget(1, 1, btn);

    return toolBar;
}

From source file:com.openkm.extension.frontend.client.widget.openmeetings.finddocument.FindDocumentSelectPopup.java

License:Open Source License

/**
 * FindDocumentSelectPopup/*from   w  w  w.j av  a 2s .  c o  m*/
 */
public FindDocumentSelectPopup() {
    // Establishes auto-close when click outside
    super(false, true);

    status = new Status(this);
    status.setStyleName("okm-StatusPopup");

    vPanel = new VerticalPanel();
    vPanel.setWidth("700");
    vPanel.setHeight("350");
    hPanel = new HorizontalPanel();

    scrollDocumentPanel = new ScrollPanel();
    scrollDocumentPanel.setStyleName("okm-Popup-text");

    cancelButton = new Button(GeneralComunicator.i18n("button.close"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            hide();
        }
    });

    actionButton = new Button(GeneralComunicator.i18n("button.add"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            String docPath = documentTable.getText(selectedRow, 1);
            String path = docPath.substring(0, docPath.lastIndexOf("/"));
            OpenMeetings.get().toolBarBoxOpenMeeting.manager.addDocumentToRoom(roomId, path);
            hide();
        }
    });

    keyword = new TextBox();
    keyword.setWidth("692");
    keyword.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent event) {
            if (keyword.getText().length() >= 3 && !EventUtils.isNavigationKey(event.getNativeKeyCode())
                    && !EventUtils.isModifierKey(event.getNativeKeyCode())) {
                GWTQueryParams gwtParams = new GWTQueryParams();
                int actualView = Main.get().mainPanel.desktop.navigator.stackPanel.getStackIndex();

                switch (actualView) {
                case UIDesktopConstants.NAVIGATOR_TAXONOMY:
                    gwtParams.setPath(Main.get().taxonomyRootFolder.getPath());
                    break;
                case UIDesktopConstants.NAVIGATOR_TEMPLATES:
                    gwtParams.setPath(Main.get().templatesRootFolder.getPath());
                    break;
                case UIDesktopConstants.NAVIGATOR_PERSONAL:
                    gwtParams.setPath(Main.get().personalRootFolder.getPath());
                    break;
                case UIDesktopConstants.NAVIGATOR_MAIL:
                    gwtParams.setPath(Main.get().mailRootFolder.getPath());
                    break;
                case UIDesktopConstants.NAVIGATOR_TRASH:
                    gwtParams.setPath(Main.get().trashRootFolder.getPath());
                    break;
                }

                gwtParams.setMimeType("");
                gwtParams.setKeywords("");
                gwtParams.setMimeType("");
                gwtParams.setName(keyword.getText() + "*");
                gwtParams.setAuthor("");
                gwtParams.setMailFrom("");
                gwtParams.setMailTo("");
                gwtParams.setMailSubject("");
                gwtParams.setOperator(GWTQueryParams.OPERATOR_AND);
                gwtParams.setLastModifiedFrom(null);
                gwtParams.setLastModifiedTo(null);
                gwtParams.setDomain(GWTQueryParams.DOCUMENT);
                gwtParams.setProperties(new HashMap<String, GWTPropertyParams>());

                find(gwtParams);
            } else {
                removeAllRows();
            }
        }
    });

    documentTable = new FlexTable();
    documentTable.setWidth("100%");
    documentTable.setCellPadding(2);
    documentTable.setCellSpacing(0);

    documentTable.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            markSelectedRow(documentTable.getCellForEvent(event).getRowIndex());
            evaluateEnableAction();
        }
    });

    documentTable.addDoubleClickHandler(new DoubleClickHandler() {
        @Override
        public void onDoubleClick(DoubleClickEvent event) {
            String docPath = documentTable.getText(selectedRow, 1);
            CommonUI.openPath(UtilComunicator.getParent(docPath), docPath);
            hide();
        }
    });

    scrollDocumentPanel.add(documentTable);
    scrollDocumentPanel.setPixelSize(690, 300);

    vPanel.add(keyword);
    vPanel.add(scrollDocumentPanel);
    vPanel.add(new HTML("<br>"));
    hPanel.add(cancelButton);
    HTML space = new HTML();
    space.setWidth("50");
    hPanel.add(space);
    hPanel.add(actionButton);
    vPanel.add(hPanel);
    vPanel.add(new HTML("<br>"));

    vPanel.setCellHorizontalAlignment(keyword, HasAlignment.ALIGN_CENTER);
    vPanel.setCellVerticalAlignment(keyword, HasAlignment.ALIGN_MIDDLE);
    vPanel.setCellHorizontalAlignment(scrollDocumentPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(hPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHeight(keyword, "25");
    vPanel.setCellHeight(scrollDocumentPanel, "300");

    cancelButton.setStyleName("okm-NoButton");
    actionButton.setStyleName("okm-YesButton");
    documentTable.setStyleName("okm-NoWrap");
    documentTable.addStyleName("okm-Table-Row");
    keyword.setStyleName("okm-Input");

    super.hide();
    setWidget(vPanel);
}

From source file:com.openkm.extension.frontend.client.widget.openmeetings.ManageRoom.java

License:Open Source License

/**
 * ManageRoom/*  w w w.j av  a2 s  . c  o  m*/
 */
public ManageRoom() {
    // Main panel
    vPanel = new VerticalPanel();
    vPanel.setStyleName("okm-WorkflowFormPanel");

    // Table
    table = new FlexTable();
    table.setWidth("100%");
    table.setCellPadding(2);
    table.setCellSpacing(0);
    table.setStyleName("okm-NoWrap");

    // create new room title
    createRoomTitle = new TitleWidget(GeneralComunicator.i18nExtension("openmeetings.room.create"));
    createRoomTitle.setWidth("100%");
    createRoomTitle.setStyleName("okm-WorkflowFormPanel-Title");

    // Room name
    nameText = new HTML("<b>" + GeneralComunicator.i18nExtension("openmeetings.room.name") + "</b>");
    name = new TextBox();
    name.setWidth("200");
    name.setStyleName("okm-Input");

    // Room type
    typeText = new HTML("<b>" + GeneralComunicator.i18nExtension("openmeetings.room.type") + "</b>");
    typeList = new ListBox();

    // Room participent
    participentText = new HTML(
            "<b>" + GeneralComunicator.i18nExtension("openmeetings.room.participent") + "</b>");
    participentList = new ListBox();
    participentList.addItem("5", "5");
    participentList.addItem("10", "10");
    participentList.addItem("15", "15");
    participentList.addItem("20", "20");
    participentList.addItem("30", "30");
    participentList.addItem("60", "60");
    participentList.addItem("100", "100");
    participentList.addItem("150", "150");
    participentList.setStyleName("okm-Input");

    // Room is public
    publicText = new HTML("<b>" + GeneralComunicator.i18nExtension("openmeetings.room.public") + "</b>");
    publicCheck = new CheckBox();

    // Appointment
    appointment = new HTML("<b>" + GeneralComunicator.i18nExtension("openmeetings.room.appointment") + "</b>");
    apointmentCheck = new CheckBox();

    // moderated
    moderated = new HTML("<b>" + GeneralComunicator.i18nExtension("openmeetings.room.moderated") + "</b>");
    moderatedCheck = new CheckBox();

    // allow user questions
    allowUserQuestions = new HTML(
            "<b>" + GeneralComunicator.i18nExtension("openmeetings.room.allowuserquestions") + "</b>");
    allowUserQuestionsCheck = new CheckBox();

    // audio only
    audioOnly = new HTML("<b>" + GeneralComunicator.i18nExtension("openmeetings.room.only.audio") + "</b>");
    audioOnlyCheck = new CheckBox();

    // wait for recording
    waitForRecording = new HTML(
            "<b>" + GeneralComunicator.i18nExtension("openmeetings.room.waitforrecording") + "</b>");
    waitForRecordingCheck = new CheckBox();

    // allow recording
    allowRecording = new HTML(
            "<b>" + GeneralComunicator.i18nExtension("openmeetings.room.allow.recording") + "</b>");
    allowRecordingCheck = new CheckBox();

    // topbar visible
    topBar = new HTML("<b>" + GeneralComunicator.i18nExtension("openmeetings.room.topbar.visible") + "</b>");
    topBarCheck = new CheckBox();
    topBarCheck.setValue(true);

    // Create button
    create = new Button(GeneralComunicator.i18n("button.create"));
    create.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            String roomName = name.getText();
            long roomType = new Long(typeList.getValue(typeList.getSelectedIndex())).longValue();
            long numberOfPartizipants = new Long(participentList.getValue(participentList.getSelectedIndex()))
                    .longValue();
            boolean isPublic = publicCheck.getValue();
            boolean isAppointment = apointmentCheck.getValue();
            boolean isModerated = moderatedCheck.getValue();
            boolean isAllowUserQuestions = allowUserQuestionsCheck.getValue();
            boolean isAudioOnly = audioOnlyCheck.getValue();
            boolean isWaitForRecording = waitForRecordingCheck.getValue();
            boolean isAllowRecording = allowRecordingCheck.getValue();
            boolean isTopBar = topBarCheck.getValue();
            OpenMeetings.get().toolBarBoxOpenMeeting.manager.createNewRoom(roomName, roomType,
                    numberOfPartizipants, isPublic, isAppointment, isModerated, isAllowUserQuestions,
                    isAudioOnly, isWaitForRecording, isAllowRecording, isTopBar);
            reset();
        }
    });
    create.setStyleName("okm-AddButton");

    int row = 0;
    table.setWidget(row, 0, nameText);
    table.setWidget(row, 1, name);
    table.setHTML(row++, 2, "");
    table.setWidget(row, 0, typeText);
    table.setWidget(row++, 1, typeList);
    table.setWidget(row, 0, participentText);
    table.setWidget(row++, 1, participentList);
    table.setWidget(row, 0, publicText);
    table.setWidget(row++, 1, publicCheck);
    table.setWidget(row, 0, appointment);
    table.setWidget(row++, 1, apointmentCheck);
    table.setWidget(row, 0, moderated);
    table.setWidget(row++, 1, moderatedCheck);
    table.setWidget(row, 0, allowUserQuestions);
    table.setWidget(row++, 1, allowUserQuestionsCheck);
    table.setWidget(row, 0, audioOnly);
    table.setWidget(row++, 1, audioOnlyCheck);
    table.setWidget(row, 0, waitForRecording);
    table.setWidget(row++, 1, waitForRecordingCheck);
    table.setWidget(row, 0, allowRecording);
    table.setWidget(row++, 1, allowRecordingCheck);
    table.setWidget(row, 0, topBar);
    table.setWidget(row++, 1, topBarCheck);
    table.getFlexCellFormatter().setWidth(0, 2, "100%");

    vPanel.add(createRoomTitle);
    vPanel.add(table);
    vPanel.add(create);
    HTML space = Util.hSpace("5");
    vPanel.add(space);
    ;
    vPanel.setWidth("100%");
    vPanel.setCellHorizontalAlignment(create, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHeight(space, "100%");

    firstTimeInitTypeList(); // Initialize type list ( waiting workspace is loaded ) 

    initWidget(vPanel);
}

From source file:com.openkm.extension.frontend.client.widget.openmeetings.RoomPanel.java

License:Open Source License

/**
 * RoomPanel/*from   w w  w  .  ja  v  a 2  s. com*/
 */
public RoomPanel(String headerTextKey, boolean zoom, boolean delete, boolean invitate) {
    spTop = new SimplePanel();
    spLeft = new SimplePanel();
    spRight = new SimplePanel();
    panelData = new SimplePanel();
    table = new FlexTable();
    vCenterPanel = new VerticalPanel();
    hPanel = new HorizontalPanel();
    header = new Header(zoom);
    vPanel = new VerticalPanel();
    this.headerTextKey = headerTextKey;
    this.delete = delete;
    this.invitate = invitate;

    // Sets or unsets visible table
    table.setVisible(zoom);

    header.setHeaderText(GeneralComunicator.i18nExtension(headerTextKey));

    panelData.add(table);

    vCenterPanel.add(header);
    vCenterPanel.add(panelData);

    hPanel.add(spLeft);
    hPanel.add(vCenterPanel);
    hPanel.add(spRight);

    vPanel.add(spTop);
    vPanel.add(hPanel);

    spTop.setHeight("" + SEPARATOR_HEIGHT);
    spLeft.setWidth("" + SEPARATOR_WIDTH);
    spRight.setWidth("" + SEPARATOR_WIDTH);

    vPanel.setStyleName("okm-DashboardWidget ");
    panelData.setStyleName("data");
    table.setStyleName("okm-NoWrap");

    panelData.setWidth("99.6%");
    header.setWidth("100%");

    table.setCellPadding(0);
    table.setCellSpacing(0);

    vPanel.addStyleName("okm-DisableSelect");

    initWidget(vPanel);
}

From source file:com.openkm.frontend.client.widget.dashboard.keymap.KeyMapTable.java

License:Open Source License

/**
 * Adding document row//from  w w w .j  a va 2 s. co m
 * 
 * @param gwtQueryResult Query result
 * @param score Document score
 */
private void addDocumentRow(GWTQueryResult gwtQueryResult, Score score) {
    Collection<String> selectedKeyList = Main.get().mainPanel.dashboard.keyMapDashboard.getFiltering();
    int rows = table.getRowCount();
    int firstRow = rows;

    firtRowList.add("" + firstRow);
    GWTDocument doc = new GWTDocument();

    if (gwtQueryResult.getDocument() != null) {
        doc = gwtQueryResult.getDocument();
    } else if (gwtQueryResult.getAttachment() != null) {
        doc = gwtQueryResult.getAttachment();
    }

    final String docPath = doc.getPath();
    Image gotoDocument = new Image("img/icon/actions/goto_document.gif");
    gotoDocument.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            CommonUI.openPath(Util.getParent(docPath), docPath);
        }

    });
    gotoDocument.setTitle(Main.i18n("dashboard.keyword.goto.document"));
    gotoDocument.setStyleName("okm-KeyMap-ImageHover");
    table.setWidget(rows, 0, gotoDocument);

    if (doc.isAttachment()) {
        SimplePanel sp = new SimplePanel(); // Solves some middle alignament problem derived from mimeImageHTML method
        sp.add(new HTML(Util.imageItemHTML("img/email_attach.gif") + Util.mimeImageHTML(doc.getMimeType())));
        table.setWidget(rows, 1, sp);
    } else {
        SimplePanel sp = new SimplePanel(); // Solves some middle alignament problem derived from mimeImageHTML method
        sp.add(new HTML(Util.mimeImageHTML(doc.getMimeType())));
        table.setWidget(rows, 1, sp);
    }
    Hyperlink hLink = new Hyperlink();
    hLink.setHTML(doc.getName());

    // On attachment case must remove last folder path, because it's internal usage not for visualization
    if (doc.isAttachment()) {
        hLink.setTitle(doc.getParentPath().substring(0, doc.getParentPath().lastIndexOf("/")));
    } else {
        hLink.setTitle(doc.getParentPath());
    }

    table.setWidget(rows, 2, hLink);

    // Format
    table.getCellFormatter().setHorizontalAlignment(rows, 0, HasAlignment.ALIGN_CENTER);
    table.getCellFormatter().setHorizontalAlignment(rows, 1, HasAlignment.ALIGN_RIGHT);
    table.getCellFormatter().setHorizontalAlignment(rows, 2, HasAlignment.ALIGN_LEFT);
    table.getCellFormatter().setVerticalAlignment(rows, 0, HasAlignment.ALIGN_MIDDLE);
    table.getCellFormatter().setVerticalAlignment(rows, 0, HasAlignment.ALIGN_MIDDLE);
    table.getCellFormatter().setVerticalAlignment(rows, 2, HasAlignment.ALIGN_MIDDLE);
    table.getFlexCellFormatter().setWidth(rows, 0, "24");
    table.getFlexCellFormatter().setWidth(rows, 1, "47");

    for (int i = 0; i < 2; i++) {
        table.getCellFormatter().addStyleName(rows, i, "okm-DisableSelect");
    }

    // Writing detail
    rows++; // Next row line
    FlexTable tableDocument = new FlexTable();
    FlexTable tableProperties = new FlexTable();
    FlexTable tableSubscribedUsers = new FlexTable();
    tableDocument.setWidget(0, 0, tableProperties);
    tableDocument.setHTML(0, 1, "");
    tableDocument.setWidget(0, 2, tableSubscribedUsers);
    tableDocument.getFlexCellFormatter().setVerticalAlignment(0, 0, HasAlignment.ALIGN_TOP);
    tableDocument.getFlexCellFormatter().setVerticalAlignment(0, 2, HasAlignment.ALIGN_TOP);
    tableDocument.getCellFormatter().setWidth(0, 0, "75%");
    tableDocument.getCellFormatter().setWidth(0, 1, "25");
    tableDocument.getCellFormatter().setWidth(0, 2, "25%");

    tableDocument.setWidth("100%");
    table.setWidget(rows, 0, tableDocument);
    table.getFlexCellFormatter().setColSpan(rows, 0, 3);
    table.getCellFormatter().setHorizontalAlignment(rows, 0, HasHorizontalAlignment.ALIGN_LEFT);

    tableDocument.setStyleName("okm-DisableSelect");
    tableProperties.setStyleName("okm-DisableSelect");
    tableSubscribedUsers.setStyleName("okm-DisableSelect");

    tableProperties.setHTML(0, 0, "<b>" + Main.i18n("document.folder") + "</b>");
    tableProperties.setHTML(0, 1, doc.getParentPath());
    tableProperties.setHTML(1, 0, "<b>" + Main.i18n("document.size") + "</b>");
    tableProperties.setHTML(1, 1, Util.formatSize(doc.getActualVersion().getSize()));
    tableProperties.setHTML(2, 0, "<b>" + Main.i18n("document.created") + "</b>");
    DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.date.pattern"));
    tableProperties.setHTML(2, 1,
            dtf.format(doc.getCreated()) + " " + Main.i18n("document.by") + " " + doc.getAuthor());
    tableProperties.setHTML(3, 0, "<b>" + Main.i18n("document.lastmodified") + "</b>");
    tableProperties.setHTML(3, 1, dtf.format(doc.getLastModified()) + " " + Main.i18n("document.by") + " "
            + doc.getActualVersion().getAuthor());
    tableProperties.setHTML(4, 0, "<b>" + Main.i18n("document.mimetype") + "</b>");
    tableProperties.setHTML(4, 1, doc.getMimeType());
    tableProperties.setHTML(5, 0, "<b>" + Main.i18n("document.status") + "</b>");
    if (doc.isCheckedOut()) {
        tableProperties.setHTML(5, 1,
                Main.i18n("document.status.checkout") + " " + doc.getLockInfo().getOwner());
    } else if (doc.isLocked()) {
        tableProperties.setHTML(5, 1, Main.i18n("document.status.locked") + " " + doc.getLockInfo().getOwner());
    } else {
        tableProperties.setHTML(5, 1, Main.i18n("document.status.normal"));
    }
    tableProperties.setHTML(6, 0, "<b>" + Main.i18n("document.subscribed") + "</b>");
    if (doc.isSubscribed()) {
        tableProperties.setHTML(6, 1, Main.i18n("document.subscribed.yes"));
    } else {
        tableProperties.setHTML(6, 1, Main.i18n("document.subscribed.no"));
    }

    // Sets wordWrap for al rows
    for (int i = 0; i < 7; i++) {
        setRowWordWarp(i, 2, false, tableProperties);
    }

    // Setting subscribers
    tableSubscribedUsers.setHTML(0, 0, "<b>" + Main.i18n("document.subscribed.users") + "<b>");
    setRowWordWarp(0, 1, false, tableSubscribedUsers);

    // Sets the folder subscribers
    for (GWTUser subscriptor : doc.getSubscriptors()) {
        tableSubscribedUsers.setHTML(tableSubscribedUsers.getRowCount(), 0, subscriptor.getUsername());
        setRowWordWarp(tableSubscribedUsers.getRowCount() - 1, 1, false, tableSubscribedUsers);
    }

    HorizontalPanel hKeyPanel = addKeywords(table, doc.getKeywords(), selectedKeyList); // Drawing keywords

    // Setting visibility
    switch (visibleStatus) {
    case VISIBLE_SMALL:
        tableDocument.setVisible(false);
        hKeyPanel.setVisible(false);
        table.getCellFormatter().addStyleName(firstRow, 0, "okm-Table-BottomBorder");
        table.getCellFormatter().addStyleName(firstRow, 1, "okm-Table-BottomBorder");
        table.getCellFormatter().addStyleName(firstRow, 2, "okm-Table-BottomBorder");
        break;
    case VISIBLE_MEDIUM:
        tableDocument.setVisible(false);
        hKeyPanel.setVisible(true);
        break;
    case VISIBLE_BIG:
        tableDocument.setVisible(true);
        hKeyPanel.setVisible(true);
        break;
    }

    // Saving object for refreshing language and setting visible ( true / false )
    tableDocumentList.add(tableDocument);
    hKeyPanelList.add(hKeyPanel);
}

From source file:com.openkm.frontend.client.widget.dashboard.keymap.KeyMapTable.java

License:Open Source License

/**
 * Adding mail/*w  w w .ja v  a 2s .c  o m*/
 * 
 * @param gwtQueryResult Query result
 * @param score The mail score
 */
private void addMailRow(GWTQueryResult gwtQueryResult, Score score) {
    Collection<String> selectedKeyList = Main.get().mainPanel.dashboard.keyMapDashboard.getFiltering();
    int rows = table.getRowCount();
    int firstRow = rows;

    firtRowList.add("" + firstRow);

    GWTMail mail = gwtQueryResult.getMail();
    ;
    final String mailPath = mail.getPath();

    Image gotoMail = new Image("img/icon/actions/goto_document.gif");
    gotoMail.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            CommonUI.openPath(Util.getParent(mailPath), mailPath);
        }

    });
    gotoMail.setTitle(Main.i18n("dashboard.keyword.goto.mail"));
    gotoMail.setStyleName("okm-KeyMap-ImageHover");
    table.setWidget(rows, 0, gotoMail);

    SimplePanel sp = new SimplePanel(); // Solves some middle alignament problem derived from mimeImageHTML method
    if (mail.getAttachments().size() > 0) {
        sp.add(new HTML(Util.imageItemHTML("img/email_attach.gif")));
    } else {
        sp.add(new HTML(Util.imageItemHTML("img/email.gif")));
    }
    table.setWidget(rows, 1, sp);
    Hyperlink hLink = new Hyperlink();
    hLink.setHTML(mail.getSubject());
    // On attachemt case must remove last folder path, because it's internal usage not for visualization
    hLink.setTitle(mail.getSubject());

    table.setWidget(rows, 2, hLink);

    // Format
    table.getCellFormatter().setHorizontalAlignment(rows, 0, HasAlignment.ALIGN_CENTER);
    table.getCellFormatter().setHorizontalAlignment(rows, 1, HasAlignment.ALIGN_RIGHT);
    table.getCellFormatter().setHorizontalAlignment(rows, 2, HasAlignment.ALIGN_LEFT);
    table.getCellFormatter().setVerticalAlignment(rows, 0, HasAlignment.ALIGN_MIDDLE);
    table.getCellFormatter().setVerticalAlignment(rows, 0, HasAlignment.ALIGN_MIDDLE);
    table.getCellFormatter().setVerticalAlignment(rows, 2, HasAlignment.ALIGN_MIDDLE);
    table.getFlexCellFormatter().setWidth(rows, 0, "24");
    table.getFlexCellFormatter().setWidth(rows, 1, "47");

    for (int i = 0; i < 2; i++) {
        table.getCellFormatter().addStyleName(rows, i, "okm-DisableSelect");
    }

    // Writing detail
    rows++; // Next row line
    FlexTable tableMail = new FlexTable();
    FlexTable tableProperties = new FlexTable();
    FlexTable tableSubscribedUsers = new FlexTable();
    tableMail.setWidget(0, 0, tableProperties);
    tableMail.setHTML(0, 1, "");
    tableMail.setWidget(0, 2, tableSubscribedUsers);
    tableMail.getFlexCellFormatter().setVerticalAlignment(0, 0, HasAlignment.ALIGN_TOP);
    tableMail.getFlexCellFormatter().setVerticalAlignment(0, 2, HasAlignment.ALIGN_TOP);
    tableMail.getCellFormatter().setWidth(0, 0, "75%");
    tableMail.getCellFormatter().setWidth(0, 1, "25");
    tableMail.getCellFormatter().setWidth(0, 2, "25%");

    tableMail.setWidth("100%");
    table.setWidget(rows, 0, tableMail);
    table.getFlexCellFormatter().setColSpan(rows, 0, 3);
    table.getCellFormatter().setHorizontalAlignment(rows, 0, HasHorizontalAlignment.ALIGN_LEFT);

    tableMail.setStyleName("okm-DisableSelect");
    tableProperties.setStyleName("okm-DisableSelect");
    tableSubscribedUsers.setStyleName("okm-DisableSelect");

    tableProperties.setHTML(0, 0, "<b>" + Main.i18n("mail.folder") + "</b>");
    tableProperties.setHTML(0, 1, mail.getParentPath());
    tableProperties.setHTML(1, 0, "<b>" + Main.i18n("mail.size") + "</b>");
    tableProperties.setHTML(1, 1, Util.formatSize(mail.getSize()));
    tableProperties.setHTML(2, 0, "<b>" + Main.i18n("mail.created") + "</b>");
    DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.date.pattern"));
    tableProperties.setHTML(2, 1,
            dtf.format(mail.getCreated()) + " " + Main.i18n("mail.by") + " " + mail.getAuthor());
    tableProperties.setHTML(3, 0, "<b>" + Main.i18n("mail.mimetype") + "</b>");
    tableProperties.setHTML(3, 1, mail.getMimeType());

    // Sets wordWrap for al rows
    for (int i = 0; i < 4; i++) {
        setRowWordWarp(i, 2, false, tableProperties);
    }

    HorizontalPanel hKeyPanel = addKeywords(table, mail.getKeywords(), selectedKeyList); // Drawing keywords

    // Setting visibility
    switch (visibleStatus) {
    case VISIBLE_SMALL:
        tableMail.setVisible(false);
        hKeyPanel.setVisible(false);
        table.getCellFormatter().addStyleName(firstRow, 0, "okm-Table-BottomBorder");
        table.getCellFormatter().addStyleName(firstRow, 1, "okm-Table-BottomBorder");
        table.getCellFormatter().addStyleName(firstRow, 2, "okm-Table-BottomBorder");
        break;
    case VISIBLE_MEDIUM:
        tableMail.setVisible(false);
        hKeyPanel.setVisible(true);
        break;
    case VISIBLE_BIG:
        tableMail.setVisible(true);
        hKeyPanel.setVisible(true);
        break;
    }

    tableMailList.add(tableMail);
    hKeyPanelList.add(hKeyPanel);
}

From source file:com.openkm.frontend.client.widget.finddocument.FindDocumentSelectPopup.java

License:Open Source License

/**
 * FindDocumentSelectPopup//from w w w.  ja va 2  s  . c  o  m
 */
public FindDocumentSelectPopup() {
    // Establishes auto-close when click outside
    super(false, true);

    status = new Status();
    status.setStyleName("okm-StatusPopup");

    vPanel = new VerticalPanel();
    vPanel.setWidth("700");
    vPanel.setHeight("350");
    hPanel = new HorizontalPanel();

    scrollDocumentPanel = new ScrollPanel();
    scrollDocumentPanel.setStyleName("okm-Popup-text");

    cancelButton = new Button(Main.i18n("button.close"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            hide();
        }
    });

    actionButton = new Button(Main.i18n("search.result.menu.go.document"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            String docPath = documentTable.getText(selectedRow, 1);
            CommonUI.openPath(Util.getParent(docPath), docPath);
            hide();
        }
    });

    keyword = new TextBox();
    keyword.setWidth("692");
    keyword.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent event) {
            if (keyword.getText().length() >= 3 && !EventUtils.isNavigationKey(event.getNativeKeyCode())
                    && !EventUtils.isModifierKey(event.getNativeKeyCode())) {
                GWTQueryParams gwtParams = new GWTQueryParams();
                int actualView = Main.get().mainPanel.desktop.navigator.stackPanel.getStackIndex();

                switch (actualView) {
                case UIDesktopConstants.NAVIGATOR_TAXONOMY:
                    gwtParams.setPath(Main.get().taxonomyRootFolder.getPath());
                    break;
                case UIDesktopConstants.NAVIGATOR_TEMPLATES:
                    gwtParams.setPath(Main.get().templatesRootFolder.getPath());
                    break;
                case UIDesktopConstants.NAVIGATOR_PERSONAL:
                    gwtParams.setPath(Main.get().personalRootFolder.getPath());
                    break;
                case UIDesktopConstants.NAVIGATOR_MAIL:
                    gwtParams.setPath(Main.get().mailRootFolder.getPath());
                    break;
                case UIDesktopConstants.NAVIGATOR_TRASH:
                    gwtParams.setPath(Main.get().trashRootFolder.getPath());
                    break;
                }

                gwtParams.setMimeType("");
                gwtParams.setKeywords("");
                gwtParams.setMimeType("");
                gwtParams.setName(keyword.getText() + "*");
                gwtParams.setAuthor("");
                gwtParams.setMailFrom("");
                gwtParams.setMailTo("");
                gwtParams.setMailSubject("");
                gwtParams.setOperator(GWTQueryParams.OPERATOR_AND);
                gwtParams.setLastModifiedFrom(null);
                gwtParams.setLastModifiedTo(null);
                gwtParams.setDomain(GWTQueryParams.DOCUMENT);
                gwtParams.setProperties(new HashMap<String, GWTPropertyParams>());

                find(gwtParams);
            } else {
                removeAllRows();
            }
        }
    });

    documentTable = new FlexTable();
    documentTable.setWidth("100%");
    documentTable.setCellPadding(2);
    documentTable.setCellSpacing(0);

    documentTable.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            markSelectedRow(documentTable.getCellForEvent(event).getRowIndex());
            evaluateEnableAction();
        }
    });

    documentTable.addDoubleClickHandler(new DoubleClickHandler() {
        @Override
        public void onDoubleClick(DoubleClickEvent event) {
            String docPath = documentTable.getText(selectedRow, 1);
            CommonUI.openPath(Util.getParent(docPath), docPath);
            hide();
        }
    });

    scrollDocumentPanel.add(documentTable);
    scrollDocumentPanel.setPixelSize(690, 300);

    vPanel.add(keyword);
    vPanel.add(scrollDocumentPanel);
    vPanel.add(new HTML("<br>"));
    hPanel.add(cancelButton);
    HTML space = new HTML();
    space.setWidth("50");
    hPanel.add(space);
    hPanel.add(actionButton);
    vPanel.add(hPanel);
    vPanel.add(new HTML("<br>"));

    vPanel.setCellHorizontalAlignment(keyword, HasAlignment.ALIGN_CENTER);
    vPanel.setCellVerticalAlignment(keyword, HasAlignment.ALIGN_MIDDLE);
    vPanel.setCellHorizontalAlignment(scrollDocumentPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(hPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHeight(keyword, "25");
    vPanel.setCellHeight(scrollDocumentPanel, "300");

    cancelButton.setStyleName("okm-NoButton");
    actionButton.setStyleName("okm-YesButton");
    documentTable.setStyleName("okm-NoWrap");
    documentTable.addStyleName("okm-Table-Row");
    keyword.setStyleName("okm-Input");

    super.hide();
    setWidget(vPanel);
}

From source file:com.openkm.frontend.client.widget.findfolder.FindFolderSelectPopup.java

License:Open Source License

public FindFolderSelectPopup() {
    // Establishes auto-close when click outside
    super(false, true);

    status = new Status();
    status.setStyleName("okm-StatusPopup");

    vPanel = new VerticalPanel();
    vPanel.setWidth("700");
    vPanel.setHeight("350");
    hPanel = new HorizontalPanel();

    scrollFolderPanel = new ScrollPanel();
    scrollFolderPanel.setStyleName("okm-Popup-text");

    cancelButton = new Button(Main.i18n("button.close"), new ClickHandler() {
        @Override//from  w  w  w.j a va 2s .co  m
        public void onClick(ClickEvent event) {
            hide();
        }
    });

    actionButton = new Button(Main.i18n("search.result.menu.go.folder"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            CommonUI.openPath(folderTable.getText(selectedRow, 1), "");
            hide();
        }
    });

    keyword = new TextBox();
    keyword.setWidth("692");
    keyword.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent event) {
            if (keyword.getText().length() >= 3 && !EventUtils.isNavigationKey(event.getNativeKeyCode())
                    && !EventUtils.isModifierKey(event.getNativeKeyCode())) {
                GWTQueryParams gwtParams = new GWTQueryParams();
                int actualView = Main.get().mainPanel.desktop.navigator.stackPanel.getStackIndex();

                switch (actualView) {
                case UIDesktopConstants.NAVIGATOR_TAXONOMY:
                    gwtParams.setPath(Main.get().taxonomyRootFolder.getPath());
                    break;
                case UIDesktopConstants.NAVIGATOR_TEMPLATES:
                    gwtParams.setPath(Main.get().templatesRootFolder.getPath());
                    break;
                case UIDesktopConstants.NAVIGATOR_PERSONAL:
                    gwtParams.setPath(Main.get().personalRootFolder.getPath());
                    break;
                case UIDesktopConstants.NAVIGATOR_MAIL:
                    gwtParams.setPath(Main.get().mailRootFolder.getPath());
                    break;
                case UIDesktopConstants.NAVIGATOR_TRASH:
                    gwtParams.setPath(Main.get().trashRootFolder.getPath());
                    break;
                }

                gwtParams.setMimeType("");
                gwtParams.setKeywords("");
                gwtParams.setMimeType("");
                gwtParams.setName(keyword.getText() + "*");
                gwtParams.setAuthor("");
                gwtParams.setMailFrom("");
                gwtParams.setMailTo("");
                gwtParams.setMailSubject("");
                gwtParams.setOperator(GWTQueryParams.OPERATOR_AND);
                gwtParams.setLastModifiedFrom(null);
                gwtParams.setLastModifiedTo(null);
                gwtParams.setDomain(GWTQueryParams.FOLDER);
                gwtParams.setProperties(new HashMap<String, GWTPropertyParams>());

                find(gwtParams);
            } else {
                removeAllRows();
            }
        }
    });

    folderTable = new FlexTable();
    folderTable.setWidth("100%");
    folderTable.setCellPadding(2);
    folderTable.setCellSpacing(0);

    folderTable.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            markSelectedRow(folderTable.getCellForEvent(event).getRowIndex());
            evaluateEnableAction();
        }
    });

    folderTable.addDoubleClickHandler(new DoubleClickHandler() {
        @Override
        public void onDoubleClick(DoubleClickEvent event) {
            CommonUI.openPath(folderTable.getText(selectedRow, 1), "");
            hide();
        }
    });

    scrollFolderPanel.add(folderTable);
    scrollFolderPanel.setPixelSize(690, 300);

    vPanel.add(keyword);
    vPanel.add(scrollFolderPanel);
    vPanel.add(new HTML("<br>"));
    hPanel.add(cancelButton);
    HTML space = new HTML();
    space.setWidth("50");
    hPanel.add(space);
    hPanel.add(actionButton);
    vPanel.add(hPanel);
    vPanel.add(new HTML("<br>"));

    vPanel.setCellHorizontalAlignment(keyword, HasAlignment.ALIGN_CENTER);
    vPanel.setCellVerticalAlignment(keyword, HasAlignment.ALIGN_MIDDLE);
    vPanel.setCellHorizontalAlignment(scrollFolderPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(hPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHeight(keyword, "25");
    vPanel.setCellHeight(scrollFolderPanel, "300");

    cancelButton.setStyleName("okm-NoButton");
    actionButton.setStyleName("okm-YesButton");
    folderTable.setStyleName("okm-NoWrap");
    folderTable.addStyleName("okm-Table-Row");
    keyword.setStyleName("okm-Input");

    super.hide();
    setWidget(vPanel);
}

From source file:com.openkm.frontend.client.widget.findsimilar.FindSimilarDocumentSelectPopup.java

License:Open Source License

/**
 * FindSimilarDocumentSelectPopup/*w w w  . j  a va 2 s. co m*/
 */
public FindSimilarDocumentSelectPopup() {
    // Establishes auto-close when click outside
    super(false, true);

    status = new Status();
    status.setStyleName("okm-StatusPopup");

    vPanel = new VerticalPanel();
    vPanel.setWidth("700");
    vPanel.setHeight("350");
    hPanel = new HorizontalPanel();

    scrollDocumentPanel = new ScrollPanel();
    scrollDocumentPanel.setStyleName("okm-Popup-text");

    cancelButton = new Button(Main.i18n("button.close"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            hide();
        }
    });

    actionButton = new Button(Main.i18n("search.result.menu.go.document"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            String docPath = documentTable.getText(selectedRow, 1);
            CommonUI.openPath(Util.getParent(docPath), docPath);
            hide();
        }
    });

    documentTable = new FlexTable();
    documentTable.setWidth("100%");
    documentTable.setCellPadding(2);
    documentTable.setCellSpacing(0);

    documentTable.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            markSelectedRow(documentTable.getCellForEvent(event).getRowIndex());
            evaluateEnableAction();
        }
    });

    documentTable.addDoubleClickHandler(new DoubleClickHandler() {
        @Override
        public void onDoubleClick(DoubleClickEvent event) {
            String docPath = documentTable.getText(selectedRow, 1);
            CommonUI.openPath(Util.getParent(docPath), docPath);
            hide();
        }
    });

    scrollDocumentPanel.add(documentTable);
    scrollDocumentPanel.setPixelSize(690, 300);

    vPanel.add(scrollDocumentPanel);
    vPanel.add(new HTML("<br>"));
    hPanel.add(cancelButton);
    HTML space = new HTML();
    space.setWidth("50");
    hPanel.add(space);
    hPanel.add(actionButton);
    vPanel.add(hPanel);
    vPanel.add(new HTML("<br>"));

    vPanel.setCellHorizontalAlignment(scrollDocumentPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(hPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHeight(scrollDocumentPanel, "300");

    cancelButton.setStyleName("okm-NoButton");
    actionButton.setStyleName("okm-YesButton");
    documentTable.setStyleName("okm-NoWrap");
    documentTable.addStyleName("okm-Table-Row");

    super.hide();
    setWidget(vPanel);
}

From source file:com.openkm.frontend.client.widget.form.DatabaseRecordSelectPopup.java

License:Open Source License

/**
 * DatabaseRecordSelectPopup/*  w  ww .  ja  v  a2 s .co  m*/
 */
public DatabaseRecordSelectPopup(final GWTSuggestBox suggestBox, final HasDatabaseRecord databaseRecord,
        final HasPropertyHandler propertyHandler) {
    // Establishes auto-close when click outside
    super(false, true);
    this.suggestBox = suggestBox;

    tables = new ArrayList<String>();
    if (suggestBox.getTable() != null) {
        tables.add(suggestBox.getTable());
    }
    setText(suggestBox.getDialogTitle());

    vPanel = new VerticalPanel();
    vPanel.setWidth("300");
    vPanel.setHeight("200");

    record = new TextBox();
    record.setWidth("292");
    record.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent event) {
            if (record.getText().length() >= suggestBox.getFilterMinLen()) {
                findFilteredDatabaseRecords();
            } else {
                removeAllRows();
            }
        }
    });
    record.setStyleName("okm-Input");

    recordTabla = new FlexTable();
    recordTabla.setWidth("100%");
    recordTabla.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            markSelectedRow(recordTabla.getCellForEvent(event).getRowIndex());
            acceptButton.setEnabled(true);
        }
    });

    scrollDatabaseRecordPanel = new ScrollPanel(recordTabla);
    scrollDatabaseRecordPanel.setPixelSize(290, 150);
    scrollDatabaseRecordPanel.setStyleName("okm-Popup-text");

    cancelButton = new Button(Main.i18n("button.cancel"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            hide();
        }
    });
    cancelButton.setStyleName("okm-NoButton");

    acceptButton = new Button(Main.i18n("button.accept"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (selectedRow >= 0) {
                databaseRecord.setKeyValue(rowKeyValueMap.get(selectedRow));
                // Updating suggestbox values ( for when value will be update )
                suggestBox.setValue(rowKeyValueMap.get(selectedRow).getKey());
                suggestBox.setText(rowKeyValueMap.get(selectedRow).getValue());
                if (propertyHandler != null) {
                    propertyHandler.metadataValueChanged();
                }
            }
            hide();
        }
    });
    acceptButton.setEnabled(false);
    acceptButton.setStyleName("okm-YesButton");

    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.add(cancelButton);
    hPanel.add(new HTML("&nbsp;"));
    hPanel.add(acceptButton);

    if (suggestBox.getFilterMinLen() > 0) {
        HorizontalPanel hInfoPanel = new HorizontalPanel();
        HTML filterInfo = new HTML(MessageFormat.format(Main.i18n("form.manager.suggestbox.min.filter"),
                suggestBox.getFilterMinLen()));
        HTML space = Util.hSpace("5");
        hInfoPanel.add(filterInfo);
        hInfoPanel.add(space);
        vPanel.add(hInfoPanel);
        vPanel.setCellHorizontalAlignment(hInfoPanel, HasAlignment.ALIGN_RIGHT);
    }

    vPanel.add(record);
    vPanel.add(scrollDatabaseRecordPanel);
    vPanel.add(hPanel);

    vPanel.setCellHeight(record, "25");
    vPanel.setCellHeight(hPanel, "25");
    vPanel.setCellVerticalAlignment(record, HasAlignment.ALIGN_MIDDLE);
    vPanel.setCellVerticalAlignment(hPanel, HasAlignment.ALIGN_MIDDLE);
    vPanel.setCellHorizontalAlignment(record, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(scrollDatabaseRecordPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(hPanel, HasAlignment.ALIGN_CENTER);

    status = new Status(this);
    status.setStyleName("okm-StatusPopup");

    super.hide();
    setWidget(vPanel);
}