Skip to content

Commit

Permalink
add actions menu to pdf preview toolbar (no actions yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Mar 6, 2012
1 parent 400593d commit a2d98a0
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 36 deletions.
Expand Up @@ -172,9 +172,6 @@ public void onClick(ClickEvent event)
}
});

toolbar.getFileIcon().addClickHandler(commands.showPdfExternal());
toolbar.getFilenameLabel().addClickHandler(commands.showPdfExternal());

releaseOnDismiss_.add(PDFView.addPageChangeHandler(new PageChangeEvent.Handler()
{
@Override
Expand Down Expand Up @@ -218,8 +215,8 @@ public void onActivated(PDFViewerParams pdfParams)
@Override
public void onCompilePdfStarted(CompilePdfStartedEvent event)
{
view_.getToolbarDisplay().setFilename(
FileSystemItem.getNameFromPath(event.getTargetFile()));
view_.getToolbarDisplay().setPdfFile(
FileSystemItem.createFile(event.getPdfPath()));

updateState(true);

Expand Down
Expand Up @@ -17,6 +17,8 @@
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.*;

import org.rstudio.core.client.files.FileSystemItem;
import org.rstudio.core.client.widget.InlineToolbarButton;
import org.rstudio.core.client.widget.NumericTextBox;
import org.rstudio.core.client.widget.SpanLabel;
Expand Down Expand Up @@ -84,18 +86,6 @@ public void onMouseOut(MouseOutEvent event)
});
}

@Override
public HasClickHandlers getFileIcon()
{
return fileIcon_;
}

@Override
public HasClickHandlers getFilenameLabel()
{
return filename_;
}

@Override
public HasClickHandlers getPrevButton()
{
Expand All @@ -121,9 +111,10 @@ public void setPageCount(int pageCount)
}

@Override
public void setFilename(String filename)
public void setPdfFile(FileSystemItem pdfFile)
{
filename_.setText(filename);
filename_.setText(pdfFile.getName());
filename_.setTitle(pdfFile.getPath());
}

@Override
Expand Down Expand Up @@ -151,7 +142,7 @@ public void selectPageNumber()
}

@UiField
Image fileOptions_;
InlineToolbarButton btnActions_;
@UiField
InlineToolbarButton btnPrevious_;
@UiField
Expand Down
Expand Up @@ -51,11 +51,6 @@
color: #838994;
margin-right: 20px;
text-decoration: none;
cursor: pointer;
}

.filename:hover {
text-decoration: underline;
}

.inlineBlock {
Expand Down Expand Up @@ -99,12 +94,10 @@
</widget:child>
</widget:ZeroHeightPanel>
<g:Anchor ui:field="filename_" styleName="{style.filename}" />
<widget:ZeroHeightPanel yOffset="4" height="18" width="20" visible="false">
<widget:child>
<g:Image resource="{res.fileOptionsIcon}" ui:field="fileOptions_"/>
<!-- TODO: This should be a menu -->
</widget:child>
</widget:ZeroHeightPanel>
<widget:InlineToolbarButton ui:field="btnActions_"
icon="{res.fileActionsIcon}"
label=""
description=""/>
</td>
<td class="{style.alignCell}" align="center" nowrap="nowrap" style="min-width: 400px">
<widget:InlineToolbarButton ui:field="btnPrevious_"
Expand Down
Expand Up @@ -12,13 +12,13 @@
*/
package org.rstudio.studio.client.pdfviewer.ui;

import org.rstudio.core.client.files.FileSystemItem;

import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.user.client.ui.HasValue;

public interface PDFViewerToolbarDisplay
{
HasClickHandlers getFileIcon();
HasClickHandlers getFilenameLabel();
HasClickHandlers getPrevButton();
HasClickHandlers getNextButton();
HasClickHandlers getThumbnailsButton();
Expand All @@ -27,5 +27,5 @@ public interface PDFViewerToolbarDisplay
HasValue<String> getPageNumber();
void selectPageNumber();
void setPageCount(int pageCount);
void setFilename(String filename);
void setPdfFile(FileSystemItem pdfFile);
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Expand Up @@ -17,8 +17,8 @@

public interface Resources extends ClientBundle
{
@Source("FileOptionsIcon.png")
ImageResource fileOptionsIcon();
@Source("FileActionsIcon.png")
ImageResource fileActionsIcon();

@Source("NextPageIcon.png")
ImageResource nextPageIcon();
Expand Down

0 comments on commit a2d98a0

Please sign in to comment.